Skip to content

Commit bb7e95c

Browse files
committed
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/bnx2x_main.c Merge bnx2x bug fixes in by hand... :-/ Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents b8bc042 + 5447080 commit bb7e95c

19 files changed

Lines changed: 147 additions & 32 deletions

File tree

‎drivers/net/bnx2x/bnx2x.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,10 @@ struct bnx2x {
863863

864864
/* used to synchronize stats collecting */
865865
int stats_state;
866+
867+
/* used for synchronization of concurrent threads statistics handling */
868+
spinlock_t stats_lock;
869+
866870
/* used by dmae command loader */
867871
struct dmae_command stats_dmae;
868872
int executer_idx;

‎drivers/net/bnx2x/bnx2x_main.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6714,6 +6714,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
67146714

67156715
mutex_init(&bp->port.phy_mutex);
67166716
mutex_init(&bp->fw_mb_mutex);
6717+
spin_lock_init(&bp->stats_lock);
67176718
#ifdef BCM_CNIC
67186719
mutex_init(&bp->cnic_mutex);
67196720
#endif

‎drivers/net/bnx2x/bnx2x_stats.c‎

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ static void bnx2x_storm_stats_post(struct bnx2x *bp)
156156
struct eth_query_ramrod_data ramrod_data = {0};
157157
int i, rc;
158158

159+
spin_lock_bh(&bp->stats_lock);
160+
159161
ramrod_data.drv_counter = bp->stats_counter++;
160162
ramrod_data.collect_port = bp->port.pmf ? 1 : 0;
161163
for_each_queue(bp, i)
@@ -169,6 +171,8 @@ static void bnx2x_storm_stats_post(struct bnx2x *bp)
169171
bp->spq_left++;
170172
bp->stats_pending = 1;
171173
}
174+
175+
spin_unlock_bh(&bp->stats_lock);
172176
}
173177
}
174178

@@ -734,6 +738,14 @@ static int bnx2x_storm_stats_update(struct bnx2x *bp)
734738
struct host_func_stats *fstats = bnx2x_sp(bp, func_stats);
735739
struct bnx2x_eth_stats *estats = &bp->eth_stats;
736740
int i;
741+
u16 cur_stats_counter;
742+
743+
/* Make sure we use the value of the counter
744+
* used for sending the last stats ramrod.
745+
*/
746+
spin_lock_bh(&bp->stats_lock);
747+
cur_stats_counter = bp->stats_counter - 1;
748+
spin_unlock_bh(&bp->stats_lock);
737749

738750
memcpy(&(fstats->total_bytes_received_hi),
739751
&(bnx2x_sp(bp, func_stats_base)->total_bytes_received_hi),
@@ -761,25 +773,22 @@ static int bnx2x_storm_stats_update(struct bnx2x *bp)
761773
u32 diff;
762774

763775
/* are storm stats valid? */
764-
if ((u16)(le16_to_cpu(xclient->stats_counter) + 1) !=
765-
bp->stats_counter) {
776+
if (le16_to_cpu(xclient->stats_counter) != cur_stats_counter) {
766777
DP(BNX2X_MSG_STATS, "[%d] stats not updated by xstorm"
767778
" xstorm counter (0x%x) != stats_counter (0x%x)\n",
768-
i, xclient->stats_counter, bp->stats_counter);
779+
i, xclient->stats_counter, cur_stats_counter + 1);
769780
return -1;
770781
}
771-
if ((u16)(le16_to_cpu(tclient->stats_counter) + 1) !=
772-
bp->stats_counter) {
782+
if (le16_to_cpu(tclient->stats_counter) != cur_stats_counter) {
773783
DP(BNX2X_MSG_STATS, "[%d] stats not updated by tstorm"
774784
" tstorm counter (0x%x) != stats_counter (0x%x)\n",
775-
i, tclient->stats_counter, bp->stats_counter);
785+
i, tclient->stats_counter, cur_stats_counter + 1);
776786
return -2;
777787
}
778-
if ((u16)(le16_to_cpu(uclient->stats_counter) + 1) !=
779-
bp->stats_counter) {
788+
if (le16_to_cpu(uclient->stats_counter) != cur_stats_counter) {
780789
DP(BNX2X_MSG_STATS, "[%d] stats not updated by ustorm"
781790
" ustorm counter (0x%x) != stats_counter (0x%x)\n",
782-
i, uclient->stats_counter, bp->stats_counter);
791+
i, uclient->stats_counter, cur_stats_counter + 1);
783792
return -4;
784793
}
785794

@@ -1216,16 +1225,18 @@ static const struct {
12161225

12171226
void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event)
12181227
{
1219-
enum bnx2x_stats_state state = bp->stats_state;
1228+
enum bnx2x_stats_state state;
12201229

12211230
if (unlikely(bp->panic))
12221231
return;
12231232

1224-
bnx2x_stats_stm[state][event].action(bp);
1233+
/* Protect a state change flow */
1234+
spin_lock_bh(&bp->stats_lock);
1235+
state = bp->stats_state;
12251236
bp->stats_state = bnx2x_stats_stm[state][event].next_state;
1237+
spin_unlock_bh(&bp->stats_lock);
12261238

1227-
/* Make sure the state has been "changed" */
1228-
smp_wmb();
1239+
bnx2x_stats_stm[state][event].action(bp);
12291240

12301241
if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))
12311242
DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",

‎drivers/net/bonding/bond_alb.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ static int rlb_initialize(struct bonding *bond)
815815

816816
/*initialize packet type*/
817817
pk_type->type = cpu_to_be16(ETH_P_ARP);
818-
pk_type->dev = NULL;
818+
pk_type->dev = bond->dev;
819819
pk_type->func = rlb_arp_recv;
820820

821821
/* register to receive ARPs */

‎drivers/net/igb/igb_main.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,6 +1722,15 @@ static int __devinit igb_probe(struct pci_dev *pdev,
17221722
u16 eeprom_apme_mask = IGB_EEPROM_APME;
17231723
u32 part_num;
17241724

1725+
/* Catch broken hardware that put the wrong VF device ID in
1726+
* the PCIe SR-IOV capability.
1727+
*/
1728+
if (pdev->is_virtfn) {
1729+
WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n",
1730+
pci_name(pdev), pdev->vendor, pdev->device);
1731+
return -EINVAL;
1732+
}
1733+
17251734
err = pci_enable_device_mem(pdev);
17261735
if (err)
17271736
return err;

‎drivers/net/ixgbe/ixgbe_main.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6539,6 +6539,15 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
65396539
#endif
65406540
u32 part_num, eec;
65416541

6542+
/* Catch broken hardware that put the wrong VF device ID in
6543+
* the PCIe SR-IOV capability.
6544+
*/
6545+
if (pdev->is_virtfn) {
6546+
WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n",
6547+
pci_name(pdev), pdev->vendor, pdev->device);
6548+
return -EINVAL;
6549+
}
6550+
65426551
err = pci_enable_device_mem(pdev);
65436552
if (err)
65446553
return err;

‎drivers/net/macvlan.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ static const struct net_device_ops macvlan_netdev_ops = {
515515
.ndo_validate_addr = eth_validate_addr,
516516
};
517517

518-
static void macvlan_setup(struct net_device *dev)
518+
void macvlan_common_setup(struct net_device *dev)
519519
{
520520
ether_setup(dev);
521521

@@ -524,6 +524,12 @@ static void macvlan_setup(struct net_device *dev)
524524
dev->destructor = free_netdev;
525525
dev->header_ops = &macvlan_hard_header_ops,
526526
dev->ethtool_ops = &macvlan_ethtool_ops;
527+
}
528+
EXPORT_SYMBOL_GPL(macvlan_common_setup);
529+
530+
static void macvlan_setup(struct net_device *dev)
531+
{
532+
macvlan_common_setup(dev);
527533
dev->tx_queue_len = 0;
528534
}
529535

@@ -735,7 +741,6 @@ int macvlan_link_register(struct rtnl_link_ops *ops)
735741
/* common fields */
736742
ops->priv_size = sizeof(struct macvlan_dev);
737743
ops->get_tx_queues = macvlan_get_tx_queues;
738-
ops->setup = macvlan_setup;
739744
ops->validate = macvlan_validate;
740745
ops->maxtype = IFLA_MACVLAN_MAX;
741746
ops->policy = macvlan_policy;
@@ -749,6 +754,7 @@ EXPORT_SYMBOL_GPL(macvlan_link_register);
749754

750755
static struct rtnl_link_ops macvlan_link_ops = {
751756
.kind = "macvlan",
757+
.setup = macvlan_setup,
752758
.newlink = macvlan_newlink,
753759
.dellink = macvlan_dellink,
754760
};

‎drivers/net/macvtap.c‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,18 @@ static int macvtap_forward(struct net_device *dev, struct sk_buff *skb)
180180
{
181181
struct macvtap_queue *q = macvtap_get_queue(dev, skb);
182182
if (!q)
183-
return -ENOLINK;
183+
goto drop;
184+
185+
if (skb_queue_len(&q->sk.sk_receive_queue) >= dev->tx_queue_len)
186+
goto drop;
184187

185188
skb_queue_tail(&q->sk.sk_receive_queue, skb);
186189
wake_up_interruptible_poll(sk_sleep(&q->sk), POLLIN | POLLRDNORM | POLLRDBAND);
187-
return 0;
190+
return NET_RX_SUCCESS;
191+
192+
drop:
193+
kfree_skb(skb);
194+
return NET_RX_DROP;
188195
}
189196

190197
/*
@@ -235,8 +242,15 @@ static void macvtap_dellink(struct net_device *dev,
235242
macvlan_dellink(dev, head);
236243
}
237244

245+
static void macvtap_setup(struct net_device *dev)
246+
{
247+
macvlan_common_setup(dev);
248+
dev->tx_queue_len = TUN_READQ_SIZE;
249+
}
250+
238251
static struct rtnl_link_ops macvtap_link_ops __read_mostly = {
239252
.kind = "macvtap",
253+
.setup = macvtap_setup,
240254
.newlink = macvtap_newlink,
241255
.dellink = macvtap_dellink,
242256
};

‎drivers/net/s2io.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int debug_level = ERR_DBG;
6565

6666
/* DEBUG message print. */
6767
#define DBG_PRINT(dbg_level, fmt, args...) do { \
68-
if (dbg_level >= debug_level) \
68+
if (dbg_level <= debug_level) \
6969
pr_info(fmt, ##args); \
7070
} while (0)
7171

‎drivers/net/tun.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,18 @@ static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
736736
gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
737737
else if (sinfo->gso_type & SKB_GSO_UDP)
738738
gso.gso_type = VIRTIO_NET_HDR_GSO_UDP;
739-
else
740-
BUG();
739+
else {
740+
printk(KERN_ERR "tun: unexpected GSO type: "
741+
"0x%x, gso_size %d, hdr_len %d\n",
742+
sinfo->gso_type, gso.gso_size,
743+
gso.hdr_len);
744+
print_hex_dump(KERN_ERR, "tun: ",
745+
DUMP_PREFIX_NONE,
746+
16, 1, skb->head,
747+
min((int)gso.hdr_len, 64), true);
748+
WARN_ON_ONCE(1);
749+
return -EINVAL;
750+
}
741751
if (sinfo->gso_type & SKB_GSO_TCP_ECN)
742752
gso.gso_type |= VIRTIO_NET_HDR_GSO_ECN;
743753
} else

0 commit comments

Comments
 (0)