Skip to content

Commit 8f5daf2

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Prevent XFRM per-cpu counter updates for one namespace from being applied to another namespace. Fix from DanS treetman. 2) Fix RCU de-reference in iwl_mvm_get_key_sta_id(), from Johannes Berg. 3) Remove ethernet header assumption in nft_do_chain_netdev(), from Pablo Neira Ayuso. 4) Fix cpsw PHY ident with multiple slaves and fixed-phy, from Pascal Speck. 5) Fix use after free in sixpack_close and mkiss_close. 6) Fix VXLAN fw assertion on bnx2x, from Yuval Mintz. 7) natsemi doesn't check for DMA mapping errors, from Alexey Khoroshilov. 8) Fix inverted test in ip6addrlbl_get(), from ANdrey Ryabinin. 9) Missing initialization of needed_headroom in geneve tunnel driver, from Paolo Abeni. 10) Fix conntrack template leak in openvswitch, from Joe Stringer. 11) Mission initialization of wq->flags in sock_alloc_inode(), from Nicolai Stange. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (35 commits) sctp: sctp should release assoc when sctp_make_abort_user return NULL in sctp_close net, socket, socket_wq: fix missing initialization of flags drivers: net: cpsw: fix error return code openvswitch: Fix template leak in error cases. sctp: label accepted/peeled off sockets sctp: use GFP_USER for user-controlled kmalloc qlcnic: fix a loop exit condition better net: cdc_ncm: avoid changing RX/TX buffers on MTU changes geneve: initialize needed_headroom ipv6: honor ifindex in case we receive ll addresses in router advertisements addrconf: always initialize sysctl table data ipv6/addrlabel: fix ip6addrlbl_get() switchdev: bridge: Pass ageing time as clock_t instead of jiffies sh_eth: fix 16-bit descriptor field access endianness too veth: don’t modify ip_summed; doing so treats packets with bad checksums as good. net: usb: cdc_ncm: Adding Dell DW5813 LTE AT&T Mobile Broadband Card net: usb: cdc_ncm: Adding Dell DW5812 LTE Verizon Mobile Broadband Card natsemi: add checks for dma mapping errors rhashtable: Kill harmless RCU warning in rhashtable_walk_init openvswitch: correct encoding of set tunnel action attributes ...
2 parents c616920 + 068d8bd commit 8f5daf2

File tree

36 files changed

+334
-198
lines changed

36 files changed

+334
-198
lines changed

Documentation/devicetree/bindings/net/cpsw.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ Optional properties:
4040

4141
Slave Properties:
4242
Required properties:
43-
- phy_id : Specifies slave phy id
4443
- phy-mode : See ethernet.txt file in the same directory
4544

4645
Optional properties:
4746
- dual_emac_res_vlan : Specifies VID to be used to segregate the ports
4847
- mac-address : See ethernet.txt file in the same directory
48+
- phy_id : Specifies slave phy id
4949
- phy-handle : See ethernet.txt file in the same directory
5050

5151
Slave sub-nodes:
5252
- fixed-link : See fixed-link.txt file in the same directory
53-
Either the properties phy_id and phy-mode,
54-
or the sub-node fixed-link can be specified
53+
Either the property phy_id, or the sub-node
54+
fixed-link can be specified
5555

5656
Note: "ti,hwmods" field is used to fetch the base address and irq
5757
resources from TI, omap hwmod data base during device registration.

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c

+13-9
Original file line numberDiff line numberDiff line change
@@ -3430,25 +3430,29 @@ static u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb)
34303430
return rc;
34313431
}
34323432

3433-
#if (MAX_SKB_FRAGS >= MAX_FETCH_BD - 3)
3433+
/* VXLAN: 4 = 1 (for linear data BD) + 3 (2 for PBD and last BD) */
3434+
#define BNX2X_NUM_VXLAN_TSO_WIN_SUB_BDS 4
3435+
3436+
/* Regular: 3 = 1 (for linear data BD) + 2 (for PBD and last BD) */
3437+
#define BNX2X_NUM_TSO_WIN_SUB_BDS 3
3438+
3439+
#if (MAX_SKB_FRAGS >= MAX_FETCH_BD - BDS_PER_TX_PKT)
34343440
/* check if packet requires linearization (packet is too fragmented)
34353441
no need to check fragmentation if page size > 8K (there will be no
34363442
violation to FW restrictions) */
34373443
static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb,
34383444
u32 xmit_type)
34393445
{
3440-
int to_copy = 0;
3441-
int hlen = 0;
3442-
int first_bd_sz = 0;
3446+
int first_bd_sz = 0, num_tso_win_sub = BNX2X_NUM_TSO_WIN_SUB_BDS;
3447+
int to_copy = 0, hlen = 0;
34433448

3444-
/* 3 = 1 (for linear data BD) + 2 (for PBD and last BD) */
3445-
if (skb_shinfo(skb)->nr_frags >= (MAX_FETCH_BD - 3)) {
3449+
if (xmit_type & XMIT_GSO_ENC)
3450+
num_tso_win_sub = BNX2X_NUM_VXLAN_TSO_WIN_SUB_BDS;
34463451

3452+
if (skb_shinfo(skb)->nr_frags >= (MAX_FETCH_BD - num_tso_win_sub)) {
34473453
if (xmit_type & XMIT_GSO) {
34483454
unsigned short lso_mss = skb_shinfo(skb)->gso_size;
3449-
/* Check if LSO packet needs to be copied:
3450-
3 = 1 (for headers BD) + 2 (for PBD and last BD) */
3451-
int wnd_size = MAX_FETCH_BD - 3;
3455+
int wnd_size = MAX_FETCH_BD - num_tso_win_sub;
34523456
/* Number of windows to check */
34533457
int num_wnds = skb_shinfo(skb)->nr_frags - wnd_size;
34543458
int wnd_idx = 0;

drivers/net/ethernet/emulex/benet/be_main.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -3299,8 +3299,10 @@ static int be_msix_register(struct be_adapter *adapter)
32993299

33003300
return 0;
33013301
err_msix:
3302-
for (i--, eqo = &adapter->eq_obj[i]; i >= 0; i--, eqo--)
3302+
for (i--; i >= 0; i--) {
3303+
eqo = &adapter->eq_obj[i];
33033304
free_irq(be_msix_vec_get(adapter, eqo), eqo);
3305+
}
33043306
dev_warn(&adapter->pdev->dev, "MSIX Request IRQ failed - err %d\n",
33053307
status);
33063308
be_msix_disable(adapter);

drivers/net/ethernet/mellanox/mlx4/en_clock.c

+7
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev)
242242
unsigned long flags;
243243
u64 ns, zero = 0;
244244

245+
/* mlx4_en_init_timestamp is called for each netdev.
246+
* mdev->ptp_clock is common for all ports, skip initialization if
247+
* was done for other port.
248+
*/
249+
if (mdev->ptp_clock)
250+
return;
251+
245252
rwlock_init(&mdev->clock_lock);
246253

247254
memset(&mdev->cycles, 0, sizeof(mdev->cycles));

drivers/net/ethernet/mellanox/mlx4/en_main.c

-7
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,6 @@ static void mlx4_en_remove(struct mlx4_dev *dev, void *endev_ptr)
232232
if (mdev->pndev[i])
233233
mlx4_en_destroy_netdev(mdev->pndev[i]);
234234

235-
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
236-
mlx4_en_remove_timestamp(mdev);
237-
238235
flush_workqueue(mdev->workqueue);
239236
destroy_workqueue(mdev->workqueue);
240237
(void) mlx4_mr_free(dev, &mdev->mr);
@@ -320,10 +317,6 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
320317
mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH)
321318
mdev->port_cnt++;
322319

323-
/* Initialize time stamp mechanism */
324-
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
325-
mlx4_en_init_timestamp(mdev);
326-
327320
/* Set default number of RX rings*/
328321
mlx4_en_set_num_rx_rings(mdev);
329322

drivers/net/ethernet/mellanox/mlx4/en_netdev.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,9 @@ void mlx4_en_destroy_netdev(struct net_device *dev)
20722072
/* flush any pending task for this netdev */
20732073
flush_workqueue(mdev->workqueue);
20742074

2075+
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
2076+
mlx4_en_remove_timestamp(mdev);
2077+
20752078
/* Detach the netdev so tasks would not attempt to access it */
20762079
mutex_lock(&mdev->state_lock);
20772080
mdev->pndev[priv->port] = NULL;
@@ -3058,9 +3061,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
30583061
}
30593062
queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY);
30603063

3064+
/* Initialize time stamp mechanism */
30613065
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
3062-
queue_delayed_work(mdev->workqueue, &priv->service_task,
3063-
SERVICE_TASK_DELAY);
3066+
mlx4_en_init_timestamp(mdev);
3067+
3068+
queue_delayed_work(mdev->workqueue, &priv->service_task,
3069+
SERVICE_TASK_DELAY);
30643070

30653071
mlx4_en_set_stats_bitmap(mdev->dev, &priv->stats_bitmap,
30663072
mdev->profile.prof[priv->port].rx_ppp,

drivers/net/ethernet/natsemi/natsemi.c

+12
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,12 @@ static void refill_rx(struct net_device *dev)
19371937
break; /* Better luck next round. */
19381938
np->rx_dma[entry] = pci_map_single(np->pci_dev,
19391939
skb->data, buflen, PCI_DMA_FROMDEVICE);
1940+
if (pci_dma_mapping_error(np->pci_dev,
1941+
np->rx_dma[entry])) {
1942+
dev_kfree_skb_any(skb);
1943+
np->rx_skbuff[entry] = NULL;
1944+
break; /* Better luck next round. */
1945+
}
19401946
np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]);
19411947
}
19421948
np->rx_ring[entry].cmd_status = cpu_to_le32(np->rx_buf_sz);
@@ -2093,6 +2099,12 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
20932099
np->tx_skbuff[entry] = skb;
20942100
np->tx_dma[entry] = pci_map_single(np->pci_dev,
20952101
skb->data,skb->len, PCI_DMA_TODEVICE);
2102+
if (pci_dma_mapping_error(np->pci_dev, np->tx_dma[entry])) {
2103+
np->tx_skbuff[entry] = NULL;
2104+
dev_kfree_skb_irq(skb);
2105+
dev->stats.tx_dropped++;
2106+
return NETDEV_TX_OK;
2107+
}
20962108

20972109
np->tx_ring[entry].addr = cpu_to_le32(np->tx_dma[entry]);
20982110

drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ int qlcnic_83xx_check_vnic_state(struct qlcnic_adapter *adapter)
252252
state = QLCRDX(ahw, QLC_83XX_VNIC_STATE);
253253
}
254254

255-
if (!idc->vnic_wait_limit) {
255+
if (state != QLCNIC_DEV_NPAR_OPER) {
256256
dev_err(&adapter->pdev->dev,
257257
"vNIC mode not operational, state check timed out.\n");
258258
return -EIO;

drivers/net/ethernet/renesas/sh_eth.c

+14-11
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,7 @@ static void sh_eth_ring_format(struct net_device *ndev)
11671167
int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring;
11681168
int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;
11691169
dma_addr_t dma_addr;
1170+
u32 buf_len;
11701171

11711172
mdp->cur_rx = 0;
11721173
mdp->cur_tx = 0;
@@ -1187,9 +1188,9 @@ static void sh_eth_ring_format(struct net_device *ndev)
11871188
/* RX descriptor */
11881189
rxdesc = &mdp->rx_ring[i];
11891190
/* The size of the buffer is a multiple of 32 bytes. */
1190-
rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32);
1191-
dma_addr = dma_map_single(&ndev->dev, skb->data,
1192-
rxdesc->buffer_length,
1191+
buf_len = ALIGN(mdp->rx_buf_sz, 32);
1192+
rxdesc->len = cpu_to_edmac(mdp, buf_len << 16);
1193+
dma_addr = dma_map_single(&ndev->dev, skb->data, buf_len,
11931194
DMA_FROM_DEVICE);
11941195
if (dma_mapping_error(&ndev->dev, dma_addr)) {
11951196
kfree_skb(skb);
@@ -1220,7 +1221,7 @@ static void sh_eth_ring_format(struct net_device *ndev)
12201221
mdp->tx_skbuff[i] = NULL;
12211222
txdesc = &mdp->tx_ring[i];
12221223
txdesc->status = cpu_to_edmac(mdp, TD_TFP);
1223-
txdesc->buffer_length = 0;
1224+
txdesc->len = cpu_to_edmac(mdp, 0);
12241225
if (i == 0) {
12251226
/* Tx descriptor address set */
12261227
sh_eth_write(ndev, mdp->tx_desc_dma, TDLAR);
@@ -1429,7 +1430,8 @@ static int sh_eth_txfree(struct net_device *ndev)
14291430
if (mdp->tx_skbuff[entry]) {
14301431
dma_unmap_single(&ndev->dev,
14311432
edmac_to_cpu(mdp, txdesc->addr),
1432-
txdesc->buffer_length, DMA_TO_DEVICE);
1433+
edmac_to_cpu(mdp, txdesc->len) >> 16,
1434+
DMA_TO_DEVICE);
14331435
dev_kfree_skb_irq(mdp->tx_skbuff[entry]);
14341436
mdp->tx_skbuff[entry] = NULL;
14351437
free_num++;
@@ -1439,7 +1441,7 @@ static int sh_eth_txfree(struct net_device *ndev)
14391441
txdesc->status |= cpu_to_edmac(mdp, TD_TDLE);
14401442

14411443
ndev->stats.tx_packets++;
1442-
ndev->stats.tx_bytes += txdesc->buffer_length;
1444+
ndev->stats.tx_bytes += edmac_to_cpu(mdp, txdesc->len) >> 16;
14431445
}
14441446
return free_num;
14451447
}
@@ -1458,6 +1460,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
14581460
u32 desc_status;
14591461
int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;
14601462
dma_addr_t dma_addr;
1463+
u32 buf_len;
14611464

14621465
boguscnt = min(boguscnt, *quota);
14631466
limit = boguscnt;
@@ -1466,7 +1469,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
14661469
/* RACT bit must be checked before all the following reads */
14671470
dma_rmb();
14681471
desc_status = edmac_to_cpu(mdp, rxdesc->status);
1469-
pkt_len = rxdesc->frame_length;
1472+
pkt_len = edmac_to_cpu(mdp, rxdesc->len) & RD_RFL;
14701473

14711474
if (--boguscnt < 0)
14721475
break;
@@ -1532,16 +1535,16 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
15321535
entry = mdp->dirty_rx % mdp->num_rx_ring;
15331536
rxdesc = &mdp->rx_ring[entry];
15341537
/* The size of the buffer is 32 byte boundary. */
1535-
rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32);
1538+
buf_len = ALIGN(mdp->rx_buf_sz, 32);
1539+
rxdesc->len = cpu_to_edmac(mdp, buf_len << 16);
15361540

15371541
if (mdp->rx_skbuff[entry] == NULL) {
15381542
skb = netdev_alloc_skb(ndev, skbuff_size);
15391543
if (skb == NULL)
15401544
break; /* Better luck next round. */
15411545
sh_eth_set_receive_align(skb);
15421546
dma_addr = dma_map_single(&ndev->dev, skb->data,
1543-
rxdesc->buffer_length,
1544-
DMA_FROM_DEVICE);
1547+
buf_len, DMA_FROM_DEVICE);
15451548
if (dma_mapping_error(&ndev->dev, dma_addr)) {
15461549
kfree_skb(skb);
15471550
break;
@@ -2407,7 +2410,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
24072410
return NETDEV_TX_OK;
24082411
}
24092412
txdesc->addr = cpu_to_edmac(mdp, dma_addr);
2410-
txdesc->buffer_length = skb->len;
2413+
txdesc->len = cpu_to_edmac(mdp, skb->len << 16);
24112414

24122415
dma_wmb(); /* TACT bit must be set after all the above writes */
24132416
if (entry >= mdp->num_tx_ring - 1)

drivers/net/ethernet/renesas/sh_eth.h

+16-17
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ enum DMAC_IM_BIT {
283283
DMAC_M_RINT1 = 0x00000001,
284284
};
285285

286-
/* Receive descriptor bit */
286+
/* Receive descriptor 0 bits */
287287
enum RD_STS_BIT {
288288
RD_RACT = 0x80000000, RD_RDLE = 0x40000000,
289289
RD_RFP1 = 0x20000000, RD_RFP0 = 0x10000000,
@@ -298,6 +298,12 @@ enum RD_STS_BIT {
298298
#define RDFEND RD_RFP0
299299
#define RD_RFP (RD_RFP1|RD_RFP0)
300300

301+
/* Receive descriptor 1 bits */
302+
enum RD_LEN_BIT {
303+
RD_RFL = 0x0000ffff, /* receive frame length */
304+
RD_RBL = 0xffff0000, /* receive buffer length */
305+
};
306+
301307
/* FCFTR */
302308
enum FCFTR_BIT {
303309
FCFTR_RFF2 = 0x00040000, FCFTR_RFF1 = 0x00020000,
@@ -307,7 +313,7 @@ enum FCFTR_BIT {
307313
#define DEFAULT_FIFO_F_D_RFF (FCFTR_RFF2 | FCFTR_RFF1 | FCFTR_RFF0)
308314
#define DEFAULT_FIFO_F_D_RFD (FCFTR_RFD2 | FCFTR_RFD1 | FCFTR_RFD0)
309315

310-
/* Transmit descriptor bit */
316+
/* Transmit descriptor 0 bits */
311317
enum TD_STS_BIT {
312318
TD_TACT = 0x80000000, TD_TDLE = 0x40000000,
313319
TD_TFP1 = 0x20000000, TD_TFP0 = 0x10000000,
@@ -317,6 +323,11 @@ enum TD_STS_BIT {
317323
#define TDFEND TD_TFP0
318324
#define TD_TFP (TD_TFP1|TD_TFP0)
319325

326+
/* Transmit descriptor 1 bits */
327+
enum TD_LEN_BIT {
328+
TD_TBL = 0xffff0000, /* transmit buffer length */
329+
};
330+
320331
/* RMCR */
321332
enum RMCR_BIT {
322333
RMCR_RNC = 0x00000001,
@@ -425,29 +436,17 @@ enum TSU_FWSLC_BIT {
425436
*/
426437
struct sh_eth_txdesc {
427438
u32 status; /* TD0 */
428-
#if defined(__LITTLE_ENDIAN)
429-
u16 pad0; /* TD1 */
430-
u16 buffer_length; /* TD1 */
431-
#else
432-
u16 buffer_length; /* TD1 */
433-
u16 pad0; /* TD1 */
434-
#endif
439+
u32 len; /* TD1 */
435440
u32 addr; /* TD2 */
436-
u32 pad1; /* padding data */
441+
u32 pad0; /* padding data */
437442
} __aligned(2) __packed;
438443

439444
/* The sh ether Rx buffer descriptors.
440445
* This structure should be 20 bytes.
441446
*/
442447
struct sh_eth_rxdesc {
443448
u32 status; /* RD0 */
444-
#if defined(__LITTLE_ENDIAN)
445-
u16 frame_length; /* RD1 */
446-
u16 buffer_length; /* RD1 */
447-
#else
448-
u16 buffer_length; /* RD1 */
449-
u16 frame_length; /* RD1 */
450-
#endif
449+
u32 len; /* RD1 */
451450
u32 addr; /* RD2 */
452451
u32 pad0; /* padding data */
453452
} __aligned(2) __packed;

0 commit comments

Comments
 (0)