Skip to content

Commit 05cf807

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Missing device reference in IPSEC input path results in crashes during device unregistration. From Subash Abhinov Kasiviswanathan. 2) Per-queue ISR register writes not being done properly in macb driver, from Cyrille Pitchen. 3) Stats accounting bugs in bcmgenet, from Patri Gynther. 4) Lightweight tunnel's TTL and TOS were swapped in netlink dumps, from Quentin Armitage. 5) SXGBE driver has off-by-one in probe error paths, from Rasmus Villemoes. 6) Fix race in save/swap/delete options in netfilter ipset, from Vishwanath Pai. 7) Ageing time of bridge not set properly when not operating over a switchdev device. Fix from Haishuang Yan. 8) Fix GRO regression wrt nested FOU/GUE based tunnels, from Alexander Duyck. 9) IPV6 UDP code bumps wrong stats, from Eric Dumazet. 10) FEC driver should only access registers that actually exist on the given chipset, fix from Fabio Estevam. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (73 commits) net: mvneta: fix changing MTU when using per-cpu processing stmmac: fix MDIO settings Revert "stmmac: Fix 'eth0: No PHY found' regression" stmmac: fix TX normal DESC net: mvneta: use cache_line_size() to get cacheline size net: mvpp2: use cache_line_size() to get cacheline size net: mvpp2: fix maybe-uninitialized warning tun, bpf: fix suspicious RCU usage in tun_{attach, detach}_filter net: usb: cdc_ncm: adding Telit LE910 V2 mobile broadband card rtnl: fix msg size calculation in if_nlmsg_size() fec: Do not access unexisting register in Coldfire net: mvneta: replace MVNETA_CPU_D_CACHE_LINE_SIZE with L1_CACHE_BYTES net: mvpp2: replace MVPP2_CPU_D_CACHE_LINE_SIZE with L1_CACHE_BYTES net: dsa: mv88e6xxx: Clear the PDOWN bit on setup net: dsa: mv88e6xxx: Introduce _mv88e6xxx_phy_page_{read, write} bpf: make padding in bpf_tunnel_key explicit ipv6: udp: fix UDP_MIB_IGNOREDMULTI updates bnxt_en: Fix ethtool -a reporting. bnxt_en: Fix typo in bnxt_hwrm_set_pause_common(). bnxt_en: Implement proper firmware message padding. ...
2 parents cf78031 + db5dd0d commit 05cf807

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+824
-610
lines changed

Documentation/networking/switchdev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ used. First phase is to "prepare" anything needed, including various checks,
386386
memory allocation, etc. The goal is to handle the stuff that is not unlikely
387387
to fail here. The second phase is to "commit" the actual changes.
388388

389-
Switchdev provides an inftrastructure for sharing items (for example memory
389+
Switchdev provides an infrastructure for sharing items (for example memory
390390
allocations) between the two phases.
391391

392392
The object created by a driver in "prepare" phase and it is queued up by:

drivers/isdn/hisax/isac.c

+10-5
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,11 @@ isac_interrupt(struct IsdnCardState *cs, u_char val)
215215
if (count == 0)
216216
count = 32;
217217
isac_empty_fifo(cs, count);
218-
if ((count = cs->rcvidx) > 0) {
218+
count = cs->rcvidx;
219+
if (count > 0) {
219220
cs->rcvidx = 0;
220-
if (!(skb = alloc_skb(count, GFP_ATOMIC)))
221+
skb = alloc_skb(count, GFP_ATOMIC);
222+
if (!skb)
221223
printk(KERN_WARNING "HiSax: D receive out of memory\n");
222224
else {
223225
memcpy(skb_put(skb, count), cs->rcvbuf, count);
@@ -251,7 +253,8 @@ isac_interrupt(struct IsdnCardState *cs, u_char val)
251253
cs->tx_skb = NULL;
252254
}
253255
}
254-
if ((cs->tx_skb = skb_dequeue(&cs->sq))) {
256+
cs->tx_skb = skb_dequeue(&cs->sq);
257+
if (cs->tx_skb) {
255258
cs->tx_cnt = 0;
256259
isac_fill_fifo(cs);
257260
} else
@@ -313,7 +316,8 @@ isac_interrupt(struct IsdnCardState *cs, u_char val)
313316
#if ARCOFI_USE
314317
if (v1 & 0x08) {
315318
if (!cs->dc.isac.mon_rx) {
316-
if (!(cs->dc.isac.mon_rx = kmalloc(MAX_MON_FRAME, GFP_ATOMIC))) {
319+
cs->dc.isac.mon_rx = kmalloc(MAX_MON_FRAME, GFP_ATOMIC);
320+
if (!cs->dc.isac.mon_rx) {
317321
if (cs->debug & L1_DEB_WARN)
318322
debugl1(cs, "ISAC MON RX out of memory!");
319323
cs->dc.isac.mocr &= 0xf0;
@@ -343,7 +347,8 @@ isac_interrupt(struct IsdnCardState *cs, u_char val)
343347
afterMONR0:
344348
if (v1 & 0x80) {
345349
if (!cs->dc.isac.mon_rx) {
346-
if (!(cs->dc.isac.mon_rx = kmalloc(MAX_MON_FRAME, GFP_ATOMIC))) {
350+
cs->dc.isac.mon_rx = kmalloc(MAX_MON_FRAME, GFP_ATOMIC);
351+
if (!cs->dc.isac.mon_rx) {
347352
if (cs->debug & L1_DEB_WARN)
348353
debugl1(cs, "ISAC MON RX out of memory!");
349354
cs->dc.isac.mocr &= 0x0f;

drivers/net/dsa/mv88e6xxx.c

+72-13
Original file line numberDiff line numberDiff line change
@@ -2264,6 +2264,57 @@ static void mv88e6xxx_bridge_work(struct work_struct *work)
22642264
mutex_unlock(&ps->smi_mutex);
22652265
}
22662266

2267+
static int _mv88e6xxx_phy_page_write(struct dsa_switch *ds, int port, int page,
2268+
int reg, int val)
2269+
{
2270+
int ret;
2271+
2272+
ret = _mv88e6xxx_phy_write_indirect(ds, port, 0x16, page);
2273+
if (ret < 0)
2274+
goto restore_page_0;
2275+
2276+
ret = _mv88e6xxx_phy_write_indirect(ds, port, reg, val);
2277+
restore_page_0:
2278+
_mv88e6xxx_phy_write_indirect(ds, port, 0x16, 0x0);
2279+
2280+
return ret;
2281+
}
2282+
2283+
static int _mv88e6xxx_phy_page_read(struct dsa_switch *ds, int port, int page,
2284+
int reg)
2285+
{
2286+
int ret;
2287+
2288+
ret = _mv88e6xxx_phy_write_indirect(ds, port, 0x16, page);
2289+
if (ret < 0)
2290+
goto restore_page_0;
2291+
2292+
ret = _mv88e6xxx_phy_read_indirect(ds, port, reg);
2293+
restore_page_0:
2294+
_mv88e6xxx_phy_write_indirect(ds, port, 0x16, 0x0);
2295+
2296+
return ret;
2297+
}
2298+
2299+
static int mv88e6xxx_power_on_serdes(struct dsa_switch *ds)
2300+
{
2301+
int ret;
2302+
2303+
ret = _mv88e6xxx_phy_page_read(ds, REG_FIBER_SERDES, PAGE_FIBER_SERDES,
2304+
MII_BMCR);
2305+
if (ret < 0)
2306+
return ret;
2307+
2308+
if (ret & BMCR_PDOWN) {
2309+
ret &= ~BMCR_PDOWN;
2310+
ret = _mv88e6xxx_phy_page_write(ds, REG_FIBER_SERDES,
2311+
PAGE_FIBER_SERDES, MII_BMCR,
2312+
ret);
2313+
}
2314+
2315+
return ret;
2316+
}
2317+
22672318
static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
22682319
{
22692320
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
@@ -2367,6 +2418,23 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
23672418
goto abort;
23682419
}
23692420

2421+
/* If this port is connected to a SerDes, make sure the SerDes is not
2422+
* powered down.
2423+
*/
2424+
if (mv88e6xxx_6352_family(ds)) {
2425+
ret = _mv88e6xxx_reg_read(ds, REG_PORT(port), PORT_STATUS);
2426+
if (ret < 0)
2427+
goto abort;
2428+
ret &= PORT_STATUS_CMODE_MASK;
2429+
if ((ret == PORT_STATUS_CMODE_100BASE_X) ||
2430+
(ret == PORT_STATUS_CMODE_1000BASE_X) ||
2431+
(ret == PORT_STATUS_CMODE_SGMII)) {
2432+
ret = mv88e6xxx_power_on_serdes(ds);
2433+
if (ret < 0)
2434+
goto abort;
2435+
}
2436+
}
2437+
23702438
/* Port Control 2: don't force a good FCS, set the maximum frame size to
23712439
* 10240 bytes, disable 802.1q tags checking, don't discard tagged or
23722440
* untagged frames on this port, do a destination address lookup on all
@@ -2714,13 +2782,9 @@ int mv88e6xxx_phy_page_read(struct dsa_switch *ds, int port, int page, int reg)
27142782
int ret;
27152783

27162784
mutex_lock(&ps->smi_mutex);
2717-
ret = _mv88e6xxx_phy_write_indirect(ds, port, 0x16, page);
2718-
if (ret < 0)
2719-
goto error;
2720-
ret = _mv88e6xxx_phy_read_indirect(ds, port, reg);
2721-
error:
2722-
_mv88e6xxx_phy_write_indirect(ds, port, 0x16, 0x0);
2785+
ret = _mv88e6xxx_phy_page_read(ds, port, page, reg);
27232786
mutex_unlock(&ps->smi_mutex);
2787+
27242788
return ret;
27252789
}
27262790

@@ -2731,14 +2795,9 @@ int mv88e6xxx_phy_page_write(struct dsa_switch *ds, int port, int page,
27312795
int ret;
27322796

27332797
mutex_lock(&ps->smi_mutex);
2734-
ret = _mv88e6xxx_phy_write_indirect(ds, port, 0x16, page);
2735-
if (ret < 0)
2736-
goto error;
2737-
2738-
ret = _mv88e6xxx_phy_write_indirect(ds, port, reg, val);
2739-
error:
2740-
_mv88e6xxx_phy_write_indirect(ds, port, 0x16, 0x0);
2798+
ret = _mv88e6xxx_phy_page_write(ds, port, page, reg, val);
27412799
mutex_unlock(&ps->smi_mutex);
2800+
27422801
return ret;
27432802
}
27442803

drivers/net/dsa/mv88e6xxx.h

+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#define SMI_CMD_OP_45_READ_DATA_INC ((3 << 10) | SMI_CMD_BUSY)
2929
#define SMI_DATA 0x01
3030

31+
/* Fiber/SERDES Registers are located at SMI address F, page 1 */
32+
#define REG_FIBER_SERDES 0x0f
33+
#define PAGE_FIBER_SERDES 0x01
34+
3135
#define REG_PORT(p) (0x10 + (p))
3236
#define PORT_STATUS 0x00
3337
#define PORT_STATUS_PAUSE_EN BIT(15)
@@ -45,6 +49,10 @@
4549
#define PORT_STATUS_MGMII BIT(6) /* 6185 */
4650
#define PORT_STATUS_TX_PAUSED BIT(5)
4751
#define PORT_STATUS_FLOW_CTRL BIT(4)
52+
#define PORT_STATUS_CMODE_MASK 0x0f
53+
#define PORT_STATUS_CMODE_100BASE_X 0x8
54+
#define PORT_STATUS_CMODE_1000BASE_X 0x9
55+
#define PORT_STATUS_CMODE_SGMII 0xa
4856
#define PORT_PCS_CTRL 0x01
4957
#define PORT_PCS_CTRL_RGMII_DELAY_RXCLK BIT(15)
5058
#define PORT_PCS_CTRL_RGMII_DELAY_TXCLK BIT(14)

drivers/net/ethernet/broadcom/bnxt/bnxt.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -2653,7 +2653,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
26532653
/* Write request msg to hwrm channel */
26542654
__iowrite32_copy(bp->bar0, data, msg_len / 4);
26552655

2656-
for (i = msg_len; i < HWRM_MAX_REQ_LEN; i += 4)
2656+
for (i = msg_len; i < BNXT_HWRM_MAX_REQ_LEN; i += 4)
26572657
writel(0, bp->bar0 + i);
26582658

26592659
/* currently supports only one outstanding message */
@@ -3391,11 +3391,11 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
33913391
struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
33923392
struct bnxt_ring_struct *ring = &cpr->cp_ring_struct;
33933393

3394+
cpr->cp_doorbell = bp->bar1 + i * 0x80;
33943395
rc = hwrm_ring_alloc_send_msg(bp, ring, HWRM_RING_ALLOC_CMPL, i,
33953396
INVALID_STATS_CTX_ID);
33963397
if (rc)
33973398
goto err_out;
3398-
cpr->cp_doorbell = bp->bar1 + i * 0x80;
33993399
BNXT_CP_DB(cpr->cp_doorbell, cpr->cp_raw_cons);
34003400
bp->grp_info[i].cp_fw_ring_id = ring->fw_ring_id;
34013401
}
@@ -3830,6 +3830,7 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp)
38303830
struct hwrm_ver_get_input req = {0};
38313831
struct hwrm_ver_get_output *resp = bp->hwrm_cmd_resp_addr;
38323832

3833+
bp->hwrm_max_req_len = HWRM_MAX_REQ_LEN;
38333834
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_VER_GET, -1, -1);
38343835
req.hwrm_intf_maj = HWRM_VERSION_MAJOR;
38353836
req.hwrm_intf_min = HWRM_VERSION_MINOR;
@@ -3855,6 +3856,9 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp)
38553856
if (!bp->hwrm_cmd_timeout)
38563857
bp->hwrm_cmd_timeout = DFLT_HWRM_CMD_TIMEOUT;
38573858

3859+
if (resp->hwrm_intf_maj >= 1)
3860+
bp->hwrm_max_req_len = le16_to_cpu(resp->max_req_win_len);
3861+
38583862
hwrm_ver_get_exit:
38593863
mutex_unlock(&bp->hwrm_cmd_lock);
38603864
return rc;
@@ -4555,7 +4559,7 @@ bnxt_hwrm_set_pause_common(struct bnxt *bp, struct hwrm_port_phy_cfg_input *req)
45554559
if (bp->link_info.req_flow_ctrl & BNXT_LINK_PAUSE_RX)
45564560
req->auto_pause |= PORT_PHY_CFG_REQ_AUTO_PAUSE_RX;
45574561
if (bp->link_info.req_flow_ctrl & BNXT_LINK_PAUSE_TX)
4558-
req->auto_pause |= PORT_PHY_CFG_REQ_AUTO_PAUSE_RX;
4562+
req->auto_pause |= PORT_PHY_CFG_REQ_AUTO_PAUSE_TX;
45594563
req->enables |=
45604564
cpu_to_le32(PORT_PHY_CFG_REQ_ENABLES_AUTO_PAUSE);
45614565
} else {

drivers/net/ethernet/broadcom/bnxt/bnxt.h

+2
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ struct rx_tpa_end_cmp_ext {
477477
#define RING_CMP(idx) ((idx) & bp->cp_ring_mask)
478478
#define NEXT_CMP(idx) RING_CMP(ADV_RAW_CMP(idx, 1))
479479

480+
#define BNXT_HWRM_MAX_REQ_LEN (bp->hwrm_max_req_len)
480481
#define DFLT_HWRM_CMD_TIMEOUT 500
481482
#define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout)
482483
#define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4)
@@ -953,6 +954,7 @@ struct bnxt {
953954
dma_addr_t hw_tx_port_stats_map;
954955
int hw_port_stats_size;
955956

957+
u16 hwrm_max_req_len;
956958
int hwrm_cmd_timeout;
957959
struct mutex hwrm_cmd_lock; /* serialize hwrm messages */
958960
struct hwrm_ver_get_output ver_resp;

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -855,10 +855,8 @@ static void bnxt_get_pauseparam(struct net_device *dev,
855855
if (BNXT_VF(bp))
856856
return;
857857
epause->autoneg = !!(link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL);
858-
epause->rx_pause =
859-
((link_info->auto_pause_setting & BNXT_LINK_PAUSE_RX) != 0);
860-
epause->tx_pause =
861-
((link_info->auto_pause_setting & BNXT_LINK_PAUSE_TX) != 0);
858+
epause->rx_pause = !!(link_info->req_flow_ctrl & BNXT_LINK_PAUSE_RX);
859+
epause->tx_pause = !!(link_info->req_flow_ctrl & BNXT_LINK_PAUSE_TX);
862860
}
863861

864862
static int bnxt_set_pauseparam(struct net_device *dev,

drivers/net/ethernet/broadcom/genet/bcmgenet.c

+11-5
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,7 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
11711171
struct enet_cb *tx_cb_ptr;
11721172
struct netdev_queue *txq;
11731173
unsigned int pkts_compl = 0;
1174+
unsigned int bytes_compl = 0;
11741175
unsigned int c_index;
11751176
unsigned int txbds_ready;
11761177
unsigned int txbds_processed = 0;
@@ -1193,16 +1194,13 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
11931194
tx_cb_ptr = &priv->tx_cbs[ring->clean_ptr];
11941195
if (tx_cb_ptr->skb) {
11951196
pkts_compl++;
1196-
dev->stats.tx_packets++;
1197-
dev->stats.tx_bytes += tx_cb_ptr->skb->len;
1197+
bytes_compl += GENET_CB(tx_cb_ptr->skb)->bytes_sent;
11981198
dma_unmap_single(&dev->dev,
11991199
dma_unmap_addr(tx_cb_ptr, dma_addr),
12001200
dma_unmap_len(tx_cb_ptr, dma_len),
12011201
DMA_TO_DEVICE);
12021202
bcmgenet_free_cb(tx_cb_ptr);
12031203
} else if (dma_unmap_addr(tx_cb_ptr, dma_addr)) {
1204-
dev->stats.tx_bytes +=
1205-
dma_unmap_len(tx_cb_ptr, dma_len);
12061204
dma_unmap_page(&dev->dev,
12071205
dma_unmap_addr(tx_cb_ptr, dma_addr),
12081206
dma_unmap_len(tx_cb_ptr, dma_len),
@@ -1220,6 +1218,9 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
12201218
ring->free_bds += txbds_processed;
12211219
ring->c_index = (ring->c_index + txbds_processed) & DMA_C_INDEX_MASK;
12221220

1221+
dev->stats.tx_packets += pkts_compl;
1222+
dev->stats.tx_bytes += bytes_compl;
1223+
12231224
if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {
12241225
txq = netdev_get_tx_queue(dev, ring->queue);
12251226
if (netif_tx_queue_stopped(txq))
@@ -1296,7 +1297,7 @@ static int bcmgenet_xmit_single(struct net_device *dev,
12961297

12971298
tx_cb_ptr->skb = skb;
12981299

1299-
skb_len = skb_headlen(skb) < ETH_ZLEN ? ETH_ZLEN : skb_headlen(skb);
1300+
skb_len = skb_headlen(skb);
13001301

13011302
mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE);
13021303
ret = dma_mapping_error(kdev, mapping);
@@ -1464,6 +1465,11 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
14641465
goto out;
14651466
}
14661467

1468+
/* Retain how many bytes will be sent on the wire, without TSB inserted
1469+
* by transmit checksum offload
1470+
*/
1471+
GENET_CB(skb)->bytes_sent = skb->len;
1472+
14671473
/* set the SKB transmit checksum */
14681474
if (priv->desc_64b_en) {
14691475
skb = bcmgenet_put_tx_csum(dev, skb);

drivers/net/ethernet/broadcom/genet/bcmgenet.h

+6
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,12 @@ struct bcmgenet_hw_params {
531531
u32 flags;
532532
};
533533

534+
struct bcmgenet_skb_cb {
535+
unsigned int bytes_sent; /* bytes on the wire (no TSB) */
536+
};
537+
538+
#define GENET_CB(skb) ((struct bcmgenet_skb_cb *)((skb)->cb))
539+
534540
struct bcmgenet_tx_ring {
535541
spinlock_t lock; /* ring lock */
536542
struct napi_struct napi; /* NAPI per tx queue */

0 commit comments

Comments
 (0)