Commit 1f4a9067 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [TG3]: Update version and reldate
  [TG3]: Fix bug in nvram write
  [TG3]: Add reset_phy parameter to chip reset functions
  [TG3]: Reset chip when changing MAC address
  [TG3]: Add phy workaround
  [TG3]: Call netif_carrier_off() during phy reset
  [IPV6]: Fix race in route selection.
  [XFRM]: fix incorrect xfrm_policy_afinfo_lock use
  [XFRM]: fix incorrect xfrm_state_afinfo_lock use
  [TCP]: Fix unlikely usage in tcp_transmit_skb()
  [XFRM]: fix softirq-unsafe xfrm typemap->lock use
  [IPSEC]: Fix IP ID selection
  [NET]: use hlist_unhashed()
  [IPV4]: inet_init() -> fs_initcall
  [NETLINK]: cleanup unused macro in net/netlink/af_netlink.c
  [PKT_SCHED] netem: fix loss
  [X25]: fix for spinlock recurse and spinlock lockup with timer handler
parents 0d262424 b2767640
...@@ -69,8 +69,8 @@ ...@@ -69,8 +69,8 @@
#define DRV_MODULE_NAME "tg3" #define DRV_MODULE_NAME "tg3"
#define PFX DRV_MODULE_NAME ": " #define PFX DRV_MODULE_NAME ": "
#define DRV_MODULE_VERSION "3.56" #define DRV_MODULE_VERSION "3.57"
#define DRV_MODULE_RELDATE "Apr 1, 2006" #define DRV_MODULE_RELDATE "Apr 28, 2006"
#define TG3_DEF_MAC_MODE 0 #define TG3_DEF_MAC_MODE 0
#define TG3_DEF_RX_MODE 0 #define TG3_DEF_RX_MODE 0
...@@ -974,6 +974,8 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp) ...@@ -974,6 +974,8 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
return err; return err;
} }
static void tg3_link_report(struct tg3 *);
/* This will reset the tigon3 PHY if there is no valid /* This will reset the tigon3 PHY if there is no valid
* link unless the FORCE argument is non-zero. * link unless the FORCE argument is non-zero.
*/ */
...@@ -987,6 +989,11 @@ static int tg3_phy_reset(struct tg3 *tp) ...@@ -987,6 +989,11 @@ static int tg3_phy_reset(struct tg3 *tp)
if (err != 0) if (err != 0)
return -EBUSY; return -EBUSY;
if (netif_running(tp->dev) && netif_carrier_ok(tp->dev)) {
netif_carrier_off(tp->dev);
tg3_link_report(tp);
}
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 || if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 || GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) { GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
...@@ -1023,6 +1030,12 @@ static int tg3_phy_reset(struct tg3 *tp) ...@@ -1023,6 +1030,12 @@ static int tg3_phy_reset(struct tg3 *tp)
tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x14e2); tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x14e2);
tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400); tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
} }
else if (tp->tg3_flags2 & TG3_FLG2_PHY_JITTER_BUG) {
tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a);
tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x010b);
tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
}
/* Set Extended packet length bit (bit 14) on all chips that */ /* Set Extended packet length bit (bit 14) on all chips that */
/* support jumbo frames */ /* support jumbo frames */
if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) { if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) {
...@@ -3531,7 +3544,7 @@ static irqreturn_t tg3_test_isr(int irq, void *dev_id, ...@@ -3531,7 +3544,7 @@ static irqreturn_t tg3_test_isr(int irq, void *dev_id,
return IRQ_RETVAL(0); return IRQ_RETVAL(0);
} }
static int tg3_init_hw(struct tg3 *); static int tg3_init_hw(struct tg3 *, int);
static int tg3_halt(struct tg3 *, int, int); static int tg3_halt(struct tg3 *, int, int);
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
...@@ -3567,7 +3580,7 @@ static void tg3_reset_task(void *_data) ...@@ -3567,7 +3580,7 @@ static void tg3_reset_task(void *_data)
tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER; tp->tg3_flags2 &= ~TG3_FLG2_RESTART_TIMER;
tg3_halt(tp, RESET_KIND_SHUTDOWN, 0); tg3_halt(tp, RESET_KIND_SHUTDOWN, 0);
tg3_init_hw(tp); tg3_init_hw(tp, 1);
tg3_netif_start(tp); tg3_netif_start(tp);
...@@ -4042,7 +4055,7 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu) ...@@ -4042,7 +4055,7 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu)
tg3_set_mtu(dev, tp, new_mtu); tg3_set_mtu(dev, tp, new_mtu);
tg3_init_hw(tp); tg3_init_hw(tp, 0);
tg3_netif_start(tp); tg3_netif_start(tp);
...@@ -5719,9 +5732,23 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p) ...@@ -5719,9 +5732,23 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p)
if (!netif_running(dev)) if (!netif_running(dev))
return 0; return 0;
spin_lock_bh(&tp->lock); if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) {
__tg3_set_mac_addr(tp); /* Reset chip so that ASF can re-init any MAC addresses it
spin_unlock_bh(&tp->lock); * needs.
*/
tg3_netif_stop(tp);
tg3_full_lock(tp, 1);
tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
tg3_init_hw(tp, 0);
tg3_netif_start(tp);
tg3_full_unlock(tp);
} else {
spin_lock_bh(&tp->lock);
__tg3_set_mac_addr(tp);
spin_unlock_bh(&tp->lock);
}
return 0; return 0;
} }
...@@ -5771,7 +5798,7 @@ static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec) ...@@ -5771,7 +5798,7 @@ static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec)
} }
/* tp->lock is held. */ /* tp->lock is held. */
static int tg3_reset_hw(struct tg3 *tp) static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
{ {
u32 val, rdmac_mode; u32 val, rdmac_mode;
int i, err, limit; int i, err, limit;
...@@ -5786,7 +5813,7 @@ static int tg3_reset_hw(struct tg3 *tp) ...@@ -5786,7 +5813,7 @@ static int tg3_reset_hw(struct tg3 *tp)
tg3_abort_hw(tp, 1); tg3_abort_hw(tp, 1);
} }
if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) if ((tp->tg3_flags2 & TG3_FLG2_MII_SERDES) && reset_phy)
tg3_phy_reset(tp); tg3_phy_reset(tp);
err = tg3_chip_reset(tp); err = tg3_chip_reset(tp);
...@@ -6327,7 +6354,7 @@ static int tg3_reset_hw(struct tg3 *tp) ...@@ -6327,7 +6354,7 @@ static int tg3_reset_hw(struct tg3 *tp)
tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl); tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl);
} }
err = tg3_setup_phy(tp, 1); err = tg3_setup_phy(tp, reset_phy);
if (err) if (err)
return err; return err;
...@@ -6400,7 +6427,7 @@ static int tg3_reset_hw(struct tg3 *tp) ...@@ -6400,7 +6427,7 @@ static int tg3_reset_hw(struct tg3 *tp)
/* Called at device open time to get the chip ready for /* Called at device open time to get the chip ready for
* packet processing. Invoked with tp->lock held. * packet processing. Invoked with tp->lock held.
*/ */
static int tg3_init_hw(struct tg3 *tp) static int tg3_init_hw(struct tg3 *tp, int reset_phy)
{ {
int err; int err;
...@@ -6413,7 +6440,7 @@ static int tg3_init_hw(struct tg3 *tp) ...@@ -6413,7 +6440,7 @@ static int tg3_init_hw(struct tg3 *tp)
tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0);
err = tg3_reset_hw(tp); err = tg3_reset_hw(tp, reset_phy);
out: out:
return err; return err;
...@@ -6683,7 +6710,7 @@ static int tg3_test_msi(struct tg3 *tp) ...@@ -6683,7 +6710,7 @@ static int tg3_test_msi(struct tg3 *tp)
tg3_full_lock(tp, 1); tg3_full_lock(tp, 1);
tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
err = tg3_init_hw(tp); err = tg3_init_hw(tp, 1);
tg3_full_unlock(tp); tg3_full_unlock(tp);
...@@ -6748,7 +6775,7 @@ static int tg3_open(struct net_device *dev) ...@@ -6748,7 +6775,7 @@ static int tg3_open(struct net_device *dev)
tg3_full_lock(tp, 0); tg3_full_lock(tp, 0);
err = tg3_init_hw(tp); err = tg3_init_hw(tp, 1);
if (err) { if (err) {
tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
tg3_free_rings(tp); tg3_free_rings(tp);
...@@ -7839,7 +7866,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e ...@@ -7839,7 +7866,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
if (netif_running(dev)) { if (netif_running(dev)) {
tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
tg3_init_hw(tp); tg3_init_hw(tp, 1);
tg3_netif_start(tp); tg3_netif_start(tp);
} }
...@@ -7884,7 +7911,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam ...@@ -7884,7 +7911,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
if (netif_running(dev)) { if (netif_running(dev)) {
tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
tg3_init_hw(tp); tg3_init_hw(tp, 1);
tg3_netif_start(tp); tg3_netif_start(tp);
} }
...@@ -8522,7 +8549,7 @@ static int tg3_test_loopback(struct tg3 *tp) ...@@ -8522,7 +8549,7 @@ static int tg3_test_loopback(struct tg3 *tp)
if (!netif_running(tp->dev)) if (!netif_running(tp->dev))
return TG3_LOOPBACK_FAILED; return TG3_LOOPBACK_FAILED;
tg3_reset_hw(tp); tg3_reset_hw(tp, 1);
if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK)) if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK))
err |= TG3_MAC_LOOPBACK_FAILED; err |= TG3_MAC_LOOPBACK_FAILED;
...@@ -8596,7 +8623,7 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest, ...@@ -8596,7 +8623,7 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
if (netif_running(dev)) { if (netif_running(dev)) {
tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE; tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE;
tg3_init_hw(tp); tg3_init_hw(tp, 1);
tg3_netif_start(tp); tg3_netif_start(tp);
} }
...@@ -9377,7 +9404,7 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len, ...@@ -9377,7 +9404,7 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len,
if ((page_off == 0) || (i == 0)) if ((page_off == 0) || (i == 0))
nvram_cmd |= NVRAM_CMD_FIRST; nvram_cmd |= NVRAM_CMD_FIRST;
else if (page_off == (tp->nvram_pagesize - 4)) if (page_off == (tp->nvram_pagesize - 4))
nvram_cmd |= NVRAM_CMD_LAST; nvram_cmd |= NVRAM_CMD_LAST;
if (i == (len - 4)) if (i == (len - 4))
...@@ -10353,10 +10380,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) ...@@ -10353,10 +10380,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0) if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0)
tp->tg3_flags2 |= TG3_FLG2_PHY_5704_A0_BUG; tp->tg3_flags2 |= TG3_FLG2_PHY_5704_A0_BUG;
if ((tp->tg3_flags2 & TG3_FLG2_5705_PLUS) && if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) {
(GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5755) && if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
(GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5787)) GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787)
tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG; tp->tg3_flags2 |= TG3_FLG2_PHY_JITTER_BUG;
else
tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG;
}
tp->coalesce_mode = 0; tp->coalesce_mode = 0;
if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_AX && if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_AX &&
...@@ -11569,7 +11599,7 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -11569,7 +11599,7 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
tg3_full_lock(tp, 0); tg3_full_lock(tp, 0);
tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE; tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE;
tg3_init_hw(tp); tg3_init_hw(tp, 1);
tp->timer.expires = jiffies + tp->timer_offset; tp->timer.expires = jiffies + tp->timer_offset;
add_timer(&tp->timer); add_timer(&tp->timer);
...@@ -11603,7 +11633,7 @@ static int tg3_resume(struct pci_dev *pdev) ...@@ -11603,7 +11633,7 @@ static int tg3_resume(struct pci_dev *pdev)
tg3_full_lock(tp, 0); tg3_full_lock(tp, 0);
tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE; tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE;
tg3_init_hw(tp); tg3_init_hw(tp, 1);
tp->timer.expires = jiffies + tp->timer_offset; tp->timer.expires = jiffies + tp->timer_offset;
add_timer(&tp->timer); add_timer(&tp->timer);
......
...@@ -2215,6 +2215,7 @@ struct tg3 { ...@@ -2215,6 +2215,7 @@ struct tg3 {
#define TG3_FLG2_HW_TSO_2 0x08000000 #define TG3_FLG2_HW_TSO_2 0x08000000
#define TG3_FLG2_HW_TSO (TG3_FLG2_HW_TSO_1 | TG3_FLG2_HW_TSO_2) #define TG3_FLG2_HW_TSO (TG3_FLG2_HW_TSO_1 | TG3_FLG2_HW_TSO_2)
#define TG3_FLG2_1SHOT_MSI 0x10000000 #define TG3_FLG2_1SHOT_MSI 0x10000000
#define TG3_FLG2_PHY_JITTER_BUG 0x20000000
u32 split_mode_max_reqs; u32 split_mode_max_reqs;
#define SPLIT_MODE_5704_MAX_REQ 3 #define SPLIT_MODE_5704_MAX_REQ 3
......
...@@ -619,7 +619,7 @@ static inline void hlist_del_rcu(struct hlist_node *n) ...@@ -619,7 +619,7 @@ static inline void hlist_del_rcu(struct hlist_node *n)
static inline void hlist_del_init(struct hlist_node *n) static inline void hlist_del_init(struct hlist_node *n)
{ {
if (n->pprev) { if (!hlist_unhashed(n)) {
__hlist_del(n); __hlist_del(n);
INIT_HLIST_NODE(n); INIT_HLIST_NODE(n);
} }
......
...@@ -150,7 +150,7 @@ static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw, ...@@ -150,7 +150,7 @@ static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw) static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw)
{ {
return tw->tw_death_node.pprev != NULL; return !hlist_unhashed(&tw->tw_death_node);
} }
static inline void inet_twsk_dead_node_init(struct inet_timewait_sock *tw) static inline void inet_twsk_dead_node_init(struct inet_timewait_sock *tw)
......
...@@ -279,7 +279,7 @@ static inline int sk_unhashed(const struct sock *sk) ...@@ -279,7 +279,7 @@ static inline int sk_unhashed(const struct sock *sk)
static inline int sk_hashed(const struct sock *sk) static inline int sk_hashed(const struct sock *sk)
{ {
return sk->sk_node.pprev != NULL; return !sk_unhashed(sk);
} }
static __inline__ void sk_node_init(struct hlist_node *node) static __inline__ void sk_node_init(struct hlist_node *node)
......
...@@ -1257,7 +1257,7 @@ static int __init inet_init(void) ...@@ -1257,7 +1257,7 @@ static int __init inet_init(void)
goto out; goto out;
} }
module_init(inet_init); fs_initcall(inet_init);
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
......
...@@ -465,7 +465,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, ...@@ -465,7 +465,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
TCP_INC_STATS(TCP_MIB_OUTSEGS); TCP_INC_STATS(TCP_MIB_OUTSEGS);
err = icsk->icsk_af_ops->queue_xmit(skb, 0); err = icsk->icsk_af_ops->queue_xmit(skb, 0);
if (unlikely(err <= 0)) if (likely(err <= 0))
return err; return err;
tcp_enter_cwr(sk); tcp_enter_cwr(sk);
......
...@@ -62,7 +62,7 @@ static void xfrm4_encap(struct sk_buff *skb) ...@@ -62,7 +62,7 @@ static void xfrm4_encap(struct sk_buff *skb)
top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ? top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ?
0 : (iph->frag_off & htons(IP_DF)); 0 : (iph->frag_off & htons(IP_DF));
if (!top_iph->frag_off) if (!top_iph->frag_off)
__ip_select_ident(top_iph, dst, 0); __ip_select_ident(top_iph, dst->child, 0);
top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT); top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT);
......
...@@ -317,7 +317,7 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif, ...@@ -317,7 +317,7 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif,
__FUNCTION__, head, head ? *head : NULL, oif); __FUNCTION__, head, head ? *head : NULL, oif);
for (rt = rt0, metric = rt0->rt6i_metric; for (rt = rt0, metric = rt0->rt6i_metric;
rt && rt->rt6i_metric == metric; rt && rt->rt6i_metric == metric && (!last || rt != rt0);
rt = rt->u.next) { rt = rt->u.next) {
int m; int m;
...@@ -343,9 +343,12 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif, ...@@ -343,9 +343,12 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif,
(strict & RT6_SELECT_F_REACHABLE) && (strict & RT6_SELECT_F_REACHABLE) &&
last && last != rt0) { last && last != rt0) {
/* no entries matched; do round-robin */ /* no entries matched; do round-robin */
static spinlock_t lock = SPIN_LOCK_UNLOCKED;
spin_lock(&lock);
*head = rt0->u.next; *head = rt0->u.next;
rt0->u.next = last->u.next; rt0->u.next = last->u.next;
last->u.next = rt0; last->u.next = rt0;
spin_unlock(&lock);
} }
RT6_TRACE("%s() => %p, score=%d\n", RT6_TRACE("%s() => %p, score=%d\n",
......
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
#include <net/scm.h> #include <net/scm.h>
#include <net/netlink.h> #include <net/netlink.h>
#define Nprintk(a...)
#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8) #define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)
struct netlink_sock { struct netlink_sock {
......
...@@ -167,7 +167,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -167,7 +167,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
if (count == 0) { if (count == 0) {
sch->qstats.drops++; sch->qstats.drops++;
kfree_skb(skb); kfree_skb(skb);
return NET_XMIT_DROP; return NET_XMIT_BYPASS;
} }
/* /*
......
...@@ -114,8 +114,9 @@ static void x25_heartbeat_expiry(unsigned long param) ...@@ -114,8 +114,9 @@ static void x25_heartbeat_expiry(unsigned long param)
if (sock_flag(sk, SOCK_DESTROY) || if (sock_flag(sk, SOCK_DESTROY) ||
(sk->sk_state == TCP_LISTEN && (sk->sk_state == TCP_LISTEN &&
sock_flag(sk, SOCK_DEAD))) { sock_flag(sk, SOCK_DEAD))) {
bh_unlock_sock(sk);
x25_destroy_socket(sk); x25_destroy_socket(sk);
goto unlock; return;
} }
break; break;
...@@ -128,7 +129,6 @@ static void x25_heartbeat_expiry(unsigned long param) ...@@ -128,7 +129,6 @@ static void x25_heartbeat_expiry(unsigned long param)
} }
restart_heartbeat: restart_heartbeat:
x25_start_heartbeat(sk); x25_start_heartbeat(sk);
unlock:
bh_unlock_sock(sk); bh_unlock_sock(sk);
} }
......
...@@ -57,12 +57,12 @@ int xfrm_register_type(struct xfrm_type *type, unsigned short family) ...@@ -57,12 +57,12 @@ int xfrm_register_type(struct xfrm_type *type, unsigned short family)
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
typemap = afinfo->type_map; typemap = afinfo->type_map;
write_lock(&typemap->lock); write_lock_bh(&typemap->lock);
if (likely(typemap->map[type->proto] == NULL)) if (likely(typemap->map[type->proto] == NULL))
typemap->map[type->proto] = type; typemap->map[type->proto] = type;
else else
err = -EEXIST; err = -EEXIST;
write_unlock(&typemap->lock); write_unlock_bh(&typemap->lock);
xfrm_policy_put_afinfo(afinfo); xfrm_policy_put_afinfo(afinfo);
return err; return err;
} }
...@@ -78,12 +78,12 @@ int xfrm_unregister_type(struct xfrm_type *type, unsigned short family) ...@@ -78,12 +78,12 @@ int xfrm_unregister_type(struct xfrm_type *type, unsigned short family)
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
typemap = afinfo->type_map; typemap = afinfo->type_map;
write_lock(&typemap->lock); write_lock_bh(&typemap->lock);
if (unlikely(typemap->map[type->proto] != type)) if (unlikely(typemap->map[type->proto] != type))
err = -ENOENT; err = -ENOENT;
else else
typemap->map[type->proto] = NULL; typemap->map[type->proto] = NULL;
write_unlock(&typemap->lock); write_unlock_bh(&typemap->lock);
xfrm_policy_put_afinfo(afinfo); xfrm_policy_put_afinfo(afinfo);
return err; return err;
} }
...@@ -1251,7 +1251,7 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) ...@@ -1251,7 +1251,7 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
return -EINVAL; return -EINVAL;
if (unlikely(afinfo->family >= NPROTO)) if (unlikely(afinfo->family >= NPROTO))
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
write_lock(&xfrm_policy_afinfo_lock); write_lock_bh(&xfrm_policy_afinfo_lock);
if (unlikely(xfrm_policy_afinfo[afinfo->family] != NULL)) if (unlikely(xfrm_policy_afinfo[afinfo->family] != NULL))
err = -ENOBUFS; err = -ENOBUFS;
else { else {
...@@ -1268,7 +1268,7 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) ...@@ -1268,7 +1268,7 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
afinfo->garbage_collect = __xfrm_garbage_collect; afinfo->garbage_collect = __xfrm_garbage_collect;
xfrm_policy_afinfo[afinfo->family] = afinfo; xfrm_policy_afinfo[afinfo->family] = afinfo;
} }
write_unlock(&xfrm_policy_afinfo_lock); write_unlock_bh(&xfrm_policy_afinfo_lock);
return err; return err;
} }
EXPORT_SYMBOL(xfrm_policy_register_afinfo); EXPORT_SYMBOL(xfrm_policy_register_afinfo);
...@@ -1280,7 +1280,7 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo) ...@@ -1280,7 +1280,7 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo)
return -EINVAL; return -EINVAL;
if (unlikely(afinfo->family >= NPROTO)) if (unlikely(afinfo->family >= NPROTO))
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
write_lock(&xfrm_policy_afinfo_lock); write_lock_bh(&xfrm_policy_afinfo_lock);
if (likely(xfrm_policy_afinfo[afinfo->family] != NULL)) { if (likely(xfrm_policy_afinfo[afinfo->family] != NULL)) {
if (unlikely(xfrm_policy_afinfo[afinfo->family] != afinfo)) if (unlikely(xfrm_policy_afinfo[afinfo->family] != afinfo))
err = -EINVAL; err = -EINVAL;
...@@ -1294,7 +1294,7 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo) ...@@ -1294,7 +1294,7 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo)
afinfo->garbage_collect = NULL; afinfo->garbage_collect = NULL;
} }
} }
write_unlock(&xfrm_policy_afinfo_lock); write_unlock_bh(&xfrm_policy_afinfo_lock);
return err; return err;
} }
EXPORT_SYMBOL(xfrm_policy_unregister_afinfo); EXPORT_SYMBOL(xfrm_policy_unregister_afinfo);
......
...@@ -1061,7 +1061,7 @@ int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo) ...@@ -1061,7 +1061,7 @@ int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo)
return -EINVAL; return -EINVAL;
if (unlikely(afinfo->family >= NPROTO)) if (unlikely(afinfo->family >= NPROTO))
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
write_lock(&xfrm_state_afinfo_lock); write_lock_bh(&xfrm_state_afinfo_lock);
if (unlikely(xfrm_state_afinfo[afinfo->family] != NULL)) if (unlikely(xfrm_state_afinfo[afinfo->family] != NULL))
err = -ENOBUFS; err = -ENOBUFS;
else { else {
...@@ -1069,7 +1069,7 @@ int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo) ...@@ -1069,7 +1069,7 @@ int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo)
afinfo->state_byspi = xfrm_state_byspi; afinfo->state_byspi = xfrm_state_byspi;
xfrm_state_afinfo[afinfo->family] = afinfo; xfrm_state_afinfo[afinfo->family] = afinfo;
} }
write_unlock(&xfrm_state_afinfo_lock); write_unlock_bh(&xfrm_state_afinfo_lock);
return err; return err;
} }
EXPORT_SYMBOL(xfrm_state_register_afinfo); EXPORT_SYMBOL(xfrm_state_register_afinfo);
...@@ -1081,7 +1081,7 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo) ...@@ -1081,7 +1081,7 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo)
return -EINVAL; return -EINVAL;
if (unlikely(afinfo->family >= NPROTO)) if (unlikely(afinfo->family >= NPROTO))
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
write_lock(&xfrm_state_afinfo_lock); write_lock_bh(&xfrm_state_afinfo_lock);
if (likely(xfrm_state_afinfo[afinfo->family] != NULL)) { if (likely(xfrm_state_afinfo[afinfo->family] != NULL)) {
if (unlikely(xfrm_state_afinfo[afinfo->family] != afinfo)) if (unlikely(xfrm_state_afinfo[afinfo->family] != afinfo))
err = -EINVAL; err = -EINVAL;
...@@ -1091,7 +1091,7 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo) ...@@ -1091,7 +1091,7 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo)
afinfo->state_bydst = NULL; afinfo->state_bydst = NULL;
} }
} }
write_unlock(&xfrm_state_afinfo_lock); write_unlock_bh(&xfrm_state_afinfo_lock);
return err; return err;
} }
EXPORT_SYMBOL(xfrm_state_unregister_afinfo); EXPORT_SYMBOL(xfrm_state_unregister_afinfo);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment