Skip to content

Commit ef7d1b2

Browse files
committed
Merge gregkh@master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
2 parents ed0da6f + 78eb887 commit ef7d1b2

19 files changed

Lines changed: 175 additions & 120 deletions

File tree

‎Documentation/networking/ip-sysctl.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,15 @@ tcp_rmem - vector of 3 INTEGERs: min, default, max
294294
Default: 87380*2 bytes.
295295

296296
tcp_mem - vector of 3 INTEGERs: min, pressure, max
297-
low: below this number of pages TCP is not bothered about its
297+
min: below this number of pages TCP is not bothered about its
298298
memory appetite.
299299

300300
pressure: when amount of memory allocated by TCP exceeds this number
301301
of pages, TCP moderates its memory consumption and enters memory
302302
pressure mode, which is exited when memory consumption falls
303-
under "low".
303+
under "min".
304304

305-
high: number of pages allowed for queueing by all TCP sockets.
305+
max: number of pages allowed for queueing by all TCP sockets.
306306

307307
Defaults are calculated at boot time from amount of available
308308
memory.

‎drivers/net/bnx2.c‎

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656

5757
#define DRV_MODULE_NAME "bnx2"
5858
#define PFX DRV_MODULE_NAME ": "
59-
#define DRV_MODULE_VERSION "1.4.43"
60-
#define DRV_MODULE_RELDATE "June 28, 2006"
59+
#define DRV_MODULE_VERSION "1.4.44"
60+
#define DRV_MODULE_RELDATE "August 10, 2006"
6161

6262
#define RUN_AT(x) (jiffies + (x))
6363

@@ -209,8 +209,10 @@ MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl);
209209

210210
static inline u32 bnx2_tx_avail(struct bnx2 *bp)
211211
{
212-
u32 diff = TX_RING_IDX(bp->tx_prod) - TX_RING_IDX(bp->tx_cons);
212+
u32 diff;
213213

214+
smp_mb();
215+
diff = TX_RING_IDX(bp->tx_prod) - TX_RING_IDX(bp->tx_cons);
214216
if (diff > MAX_TX_DESC_CNT)
215217
diff = (diff & MAX_TX_DESC_CNT) - 1;
216218
return (bp->tx_ring_size - diff);
@@ -1569,7 +1571,7 @@ bnx2_alloc_rx_skb(struct bnx2 *bp, u16 index)
15691571
struct rx_bd *rxbd = &bp->rx_desc_ring[RX_RING(index)][RX_IDX(index)];
15701572
unsigned long align;
15711573

1572-
skb = dev_alloc_skb(bp->rx_buf_size);
1574+
skb = netdev_alloc_skb(bp->dev, bp->rx_buf_size);
15731575
if (skb == NULL) {
15741576
return -ENOMEM;
15751577
}
@@ -1578,7 +1580,6 @@ bnx2_alloc_rx_skb(struct bnx2 *bp, u16 index)
15781580
skb_reserve(skb, 8 - align);
15791581
}
15801582

1581-
skb->dev = bp->dev;
15821583
mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_use_size,
15831584
PCI_DMA_FROMDEVICE);
15841585

@@ -1686,15 +1687,20 @@ bnx2_tx_int(struct bnx2 *bp)
16861687
}
16871688

16881689
bp->tx_cons = sw_cons;
1690+
/* Need to make the tx_cons update visible to bnx2_start_xmit()
1691+
* before checking for netif_queue_stopped(). Without the
1692+
* memory barrier, there is a small possibility that bnx2_start_xmit()
1693+
* will miss it and cause the queue to be stopped forever.
1694+
*/
1695+
smp_mb();
16891696

1690-
if (unlikely(netif_queue_stopped(bp->dev))) {
1691-
spin_lock(&bp->tx_lock);
1697+
if (unlikely(netif_queue_stopped(bp->dev)) &&
1698+
(bnx2_tx_avail(bp) > bp->tx_wake_thresh)) {
1699+
netif_tx_lock(bp->dev);
16921700
if ((netif_queue_stopped(bp->dev)) &&
1693-
(bnx2_tx_avail(bp) > MAX_SKB_FRAGS)) {
1694-
1701+
(bnx2_tx_avail(bp) > bp->tx_wake_thresh))
16951702
netif_wake_queue(bp->dev);
1696-
}
1697-
spin_unlock(&bp->tx_lock);
1703+
netif_tx_unlock(bp->dev);
16981704
}
16991705
}
17001706

@@ -1786,7 +1792,7 @@ bnx2_rx_int(struct bnx2 *bp, int budget)
17861792
if ((bp->dev->mtu > 1500) && (len <= RX_COPY_THRESH)) {
17871793
struct sk_buff *new_skb;
17881794

1789-
new_skb = dev_alloc_skb(len + 2);
1795+
new_skb = netdev_alloc_skb(bp->dev, len + 2);
17901796
if (new_skb == NULL)
17911797
goto reuse_rx;
17921798

@@ -1797,7 +1803,6 @@ bnx2_rx_int(struct bnx2 *bp, int budget)
17971803

17981804
skb_reserve(new_skb, 2);
17991805
skb_put(new_skb, len);
1800-
new_skb->dev = bp->dev;
18011806

18021807
bnx2_reuse_rx_skb(bp, skb,
18031808
sw_ring_cons, sw_ring_prod);
@@ -3503,6 +3508,8 @@ bnx2_init_tx_ring(struct bnx2 *bp)
35033508
struct tx_bd *txbd;
35043509
u32 val;
35053510

3511+
bp->tx_wake_thresh = bp->tx_ring_size / 2;
3512+
35063513
txbd = &bp->tx_desc_ring[MAX_TX_DESC_CNT];
35073514

35083515
txbd->tx_bd_haddr_hi = (u64) bp->tx_desc_mapping >> 32;
@@ -3952,7 +3959,7 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode)
39523959
return -EINVAL;
39533960

39543961
pkt_size = 1514;
3955-
skb = dev_alloc_skb(pkt_size);
3962+
skb = netdev_alloc_skb(bp->dev, pkt_size);
39563963
if (!skb)
39573964
return -ENOMEM;
39583965
packet = skb_put(skb, pkt_size);
@@ -4390,10 +4397,8 @@ bnx2_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
43904397
#endif
43914398

43924399
/* Called with netif_tx_lock.
4393-
* hard_start_xmit is pseudo-lockless - a lock is only required when
4394-
* the tx queue is full. This way, we get the benefit of lockless
4395-
* operations most of the time without the complexities to handle
4396-
* netif_stop_queue/wake_queue race conditions.
4400+
* bnx2_tx_int() runs without netif_tx_lock unless it needs to call
4401+
* netif_wake_queue().
43974402
*/
43984403
static int
43994404
bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -4512,12 +4517,9 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
45124517
dev->trans_start = jiffies;
45134518

45144519
if (unlikely(bnx2_tx_avail(bp) <= MAX_SKB_FRAGS)) {
4515-
spin_lock(&bp->tx_lock);
45164520
netif_stop_queue(dev);
4517-
4518-
if (bnx2_tx_avail(bp) > MAX_SKB_FRAGS)
4521+
if (bnx2_tx_avail(bp) > bp->tx_wake_thresh)
45194522
netif_wake_queue(dev);
4520-
spin_unlock(&bp->tx_lock);
45214523
}
45224524

45234525
return NETDEV_TX_OK;
@@ -5628,7 +5630,6 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
56285630
bp->pdev = pdev;
56295631

56305632
spin_lock_init(&bp->phy_lock);
5631-
spin_lock_init(&bp->tx_lock);
56325633
INIT_WORK(&bp->reset_task, bnx2_reset_task, bp);
56335634

56345635
dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0);
@@ -5751,7 +5752,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
57515752
bp->mac_addr[5] = (u8) reg;
57525753

57535754
bp->tx_ring_size = MAX_TX_DESC_CNT;
5754-
bnx2_set_rx_ring_size(bp, 100);
5755+
bnx2_set_rx_ring_size(bp, 255);
57555756

57565757
bp->rx_csum = 1;
57575758

‎drivers/net/bnx2.h‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3890,10 +3890,6 @@ struct bnx2 {
38903890
u32 tx_prod_bseq __attribute__((aligned(L1_CACHE_BYTES)));
38913891
u16 tx_prod;
38923892

3893-
struct tx_bd *tx_desc_ring;
3894-
struct sw_bd *tx_buf_ring;
3895-
int tx_ring_size;
3896-
38973893
u16 tx_cons __attribute__((aligned(L1_CACHE_BYTES)));
38983894
u16 hw_tx_cons;
38993895

@@ -3916,9 +3912,11 @@ struct bnx2 {
39163912
struct sw_bd *rx_buf_ring;
39173913
struct rx_bd *rx_desc_ring[MAX_RX_RINGS];
39183914

3919-
/* Only used to synchronize netif_stop_queue/wake_queue when tx */
3920-
/* ring is full */
3921-
spinlock_t tx_lock;
3915+
/* TX constants */
3916+
struct tx_bd *tx_desc_ring;
3917+
struct sw_bd *tx_buf_ring;
3918+
int tx_ring_size;
3919+
u32 tx_wake_thresh;
39223920

39233921
/* End of fields used in the performance code paths. */
39243922

‎drivers/net/ppp_generic.c‎

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ struct cardmap {
192192
void *ptr[CARDMAP_WIDTH];
193193
};
194194
static void *cardmap_get(struct cardmap *map, unsigned int nr);
195-
static void cardmap_set(struct cardmap **map, unsigned int nr, void *ptr);
195+
static int cardmap_set(struct cardmap **map, unsigned int nr, void *ptr);
196196
static unsigned int cardmap_find_first_free(struct cardmap *map);
197197
static void cardmap_destroy(struct cardmap **map);
198198

@@ -1995,10 +1995,9 @@ ppp_register_channel(struct ppp_channel *chan)
19951995
{
19961996
struct channel *pch;
19971997

1998-
pch = kmalloc(sizeof(struct channel), GFP_KERNEL);
1998+
pch = kzalloc(sizeof(struct channel), GFP_KERNEL);
19991999
if (pch == 0)
20002000
return -ENOMEM;
2001-
memset(pch, 0, sizeof(struct channel));
20022001
pch->ppp = NULL;
20032002
pch->chan = chan;
20042003
chan->ppp = pch;
@@ -2408,13 +2407,12 @@ ppp_create_interface(int unit, int *retp)
24082407
int ret = -ENOMEM;
24092408
int i;
24102409

2411-
ppp = kmalloc(sizeof(struct ppp), GFP_KERNEL);
2410+
ppp = kzalloc(sizeof(struct ppp), GFP_KERNEL);
24122411
if (!ppp)
24132412
goto out;
24142413
dev = alloc_netdev(0, "", ppp_setup);
24152414
if (!dev)
24162415
goto out1;
2417-
memset(ppp, 0, sizeof(struct ppp));
24182416

24192417
ppp->mru = PPP_MRU;
24202418
init_ppp_file(&ppp->file, INTERFACE);
@@ -2454,11 +2452,16 @@ ppp_create_interface(int unit, int *retp)
24542452
}
24552453

24562454
atomic_inc(&ppp_unit_count);
2457-
cardmap_set(&all_ppp_units, unit, ppp);
2455+
ret = cardmap_set(&all_ppp_units, unit, ppp);
2456+
if (ret != 0)
2457+
goto out3;
2458+
24582459
mutex_unlock(&all_ppp_mutex);
24592460
*retp = 0;
24602461
return ppp;
24612462

2463+
out3:
2464+
atomic_dec(&ppp_unit_count);
24622465
out2:
24632466
mutex_unlock(&all_ppp_mutex);
24642467
free_netdev(dev);
@@ -2695,7 +2698,7 @@ static void *cardmap_get(struct cardmap *map, unsigned int nr)
26952698
return NULL;
26962699
}
26972700

2698-
static void cardmap_set(struct cardmap **pmap, unsigned int nr, void *ptr)
2701+
static int cardmap_set(struct cardmap **pmap, unsigned int nr, void *ptr)
26992702
{
27002703
struct cardmap *p;
27012704
int i;
@@ -2704,8 +2707,9 @@ static void cardmap_set(struct cardmap **pmap, unsigned int nr, void *ptr)
27042707
if (p == NULL || (nr >> p->shift) >= CARDMAP_WIDTH) {
27052708
do {
27062709
/* need a new top level */
2707-
struct cardmap *np = kmalloc(sizeof(*np), GFP_KERNEL);
2708-
memset(np, 0, sizeof(*np));
2710+
struct cardmap *np = kzalloc(sizeof(*np), GFP_KERNEL);
2711+
if (!np)
2712+
goto enomem;
27092713
np->ptr[0] = p;
27102714
if (p != NULL) {
27112715
np->shift = p->shift + CARDMAP_ORDER;
@@ -2719,8 +2723,9 @@ static void cardmap_set(struct cardmap **pmap, unsigned int nr, void *ptr)
27192723
while (p->shift > 0) {
27202724
i = (nr >> p->shift) & CARDMAP_MASK;
27212725
if (p->ptr[i] == NULL) {
2722-
struct cardmap *np = kmalloc(sizeof(*np), GFP_KERNEL);
2723-
memset(np, 0, sizeof(*np));
2726+
struct cardmap *np = kzalloc(sizeof(*np), GFP_KERNEL);
2727+
if (!np)
2728+
goto enomem;
27242729
np->shift = p->shift - CARDMAP_ORDER;
27252730
np->parent = p;
27262731
p->ptr[i] = np;
@@ -2735,6 +2740,9 @@ static void cardmap_set(struct cardmap **pmap, unsigned int nr, void *ptr)
27352740
set_bit(i, &p->inuse);
27362741
else
27372742
clear_bit(i, &p->inuse);
2743+
return 0;
2744+
enomem:
2745+
return -ENOMEM;
27382746
}
27392747

27402748
static unsigned int cardmap_find_first_free(struct cardmap *map)

‎include/linux/if_vlan.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
155155
{
156156
struct net_device_stats *stats;
157157

158+
if (skb_bond_should_drop(skb)) {
159+
dev_kfree_skb_any(skb);
160+
return NET_RX_DROP;
161+
}
162+
158163
skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK];
159164
if (skb->dev == NULL) {
160165
dev_kfree_skb_any(skb);

‎include/linux/netdevice.h‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,9 @@ struct net_device
320320
#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
321321
#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
322322

323+
/* List of features with software fallbacks. */
324+
#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
325+
323326
#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
324327
#define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM)
325328

@@ -1012,6 +1015,30 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
10121015
unlikely(skb->ip_summed != CHECKSUM_HW));
10131016
}
10141017

1018+
/* On bonding slaves other than the currently active slave, suppress
1019+
* duplicates except for 802.3ad ETH_P_SLOW and alb non-mcast/bcast.
1020+
*/
1021+
static inline int skb_bond_should_drop(struct sk_buff *skb)
1022+
{
1023+
struct net_device *dev = skb->dev;
1024+
struct net_device *master = dev->master;
1025+
1026+
if (master &&
1027+
(dev->priv_flags & IFF_SLAVE_INACTIVE)) {
1028+
if (master->priv_flags & IFF_MASTER_ALB) {
1029+
if (skb->pkt_type != PACKET_BROADCAST &&
1030+
skb->pkt_type != PACKET_MULTICAST)
1031+
return 0;
1032+
}
1033+
if (master->priv_flags & IFF_MASTER_8023AD &&
1034+
skb->protocol == __constant_htons(ETH_P_SLOW))
1035+
return 0;
1036+
1037+
return 1;
1038+
}
1039+
return 0;
1040+
}
1041+
10151042
#endif /* __KERNEL__ */
10161043

10171044
#endif /* _LINUX_DEV_H */

‎net/atm/proc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ int __init atm_proc_init(void)
507507
goto out;
508508
}
509509

510-
void __exit atm_proc_exit(void)
510+
void atm_proc_exit(void)
511511
{
512512
atm_proc_dirs_remove();
513513
}

‎net/bridge/br_if.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,17 @@ void br_features_recompute(struct net_bridge *br)
386386
checksum = 0;
387387

388388
if (feature & NETIF_F_GSO)
389-
feature |= NETIF_F_TSO;
389+
feature |= NETIF_F_GSO_SOFTWARE;
390390
feature |= NETIF_F_GSO;
391391

392392
features &= feature;
393393
}
394394

395+
if (!(checksum & NETIF_F_ALL_CSUM))
396+
features &= ~NETIF_F_SG;
397+
if (!(features & NETIF_F_SG))
398+
features &= ~NETIF_F_GSO_MASK;
399+
395400
br->dev->features = features | checksum | NETIF_F_LLTX |
396401
NETIF_F_GSO_ROBUST;
397402
}

0 commit comments

Comments
 (0)