Skip to content

Commit 1c212c6

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking changes from David Miller: "Most importantly this should cure the ipv4-mapped ipv6 socket TCP crashes some people were seeing, otherwise: 1) Fix e1000e autonegotiation handling regression, from Tushar Dave. 2) Fix TX data corruption race on e1000e down, also from Tushar Dave. 3) Fix bfin_sir IRDA driver build, from Sonic Zhang. 4) AF_PACKET mmap() tests a flag in the TX ring shared between userspace and the kernel for an internal consistency check. It really shouldn't do this to validate the kernel's own behavior because the user can corrupt it to be any value at all. From Daniel Borkmann. 5) Fix TCP metrics leak on netns dismantle, from Eric Dumazet. 6) Orphan the anonymous TCP socket from the SKB in ip_send_unicast_reply() so that the rest of the stack needn't see it. Otherwise we get selinux problems of all sorts, from Eric Dumazet. This is the best way to fix this since the socket is just a place holder for sending packets in a context where we have no real socket at all. 7) Fix TUN detach crashes, from Stanislav Kinsbursky. 8) dev_set_alias() leaks memory on krealloc() failure, from Alexey Khoroshilov. 9) FIB trie must use call_rcu() not call_rcu_bh(), because this code is not universally invoked from software interrupts. From Eric Dumazet. 10) PPTP looks up ipv4 routes with the wrong network namespace, fix from Gao Feng." * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (33 commits) bnx2x: Fix compiler warnings af_packet: remove BUG statement in tpacket_destruct_skb macvtap: rcu_dereference outside read-lock section codel: refine one condition to avoid a nul rec_inv_sqrt ixgbe: add missing braces ipv4: fix ip_send_skb() net: tcp: ipv6_mapped needs sk_rx_dst_set method ipv4: tcp: unicast_sock should not land outside of TCP stack bnx2x: Fix recovery flow cleanup during probe bnx2x: fix unload previous driver flow when flr-capable tun: don't zeroize sock->file on detach igb: Fix register defines for all non-82575 hardware e1000e: fix panic while dumping packets on Tx hang with IOMMU igb: fix panic while dumping packets on Tx hang with IOMMU tcp: must free metrics at net dismantle net/stmmac: mark probe function as __devinit lpc_eth: remove obsolete ifdefs net/core: Fix potential memory leak in dev_set_alias() cdc-phonet: Don't leak in usbpn_open batman-adv: Fix mem leak in the batadv_tt_local_event() function ...
2 parents f82202b + f57b07c commit 1c212c6

File tree

36 files changed

+233
-156
lines changed

36 files changed

+233
-156
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ struct bnx2x {
12781278
#define BNX2X_FW_RX_ALIGN_START (1UL << BNX2X_RX_ALIGN_SHIFT)
12791279

12801280
#define BNX2X_FW_RX_ALIGN_END \
1281-
max(1UL << BNX2X_RX_ALIGN_SHIFT, \
1281+
max_t(u64, 1UL << BNX2X_RX_ALIGN_SHIFT, \
12821282
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
12831283

12841284
#define BNX2X_PXP_DRAM_ALIGN (BNX2X_RX_ALIGN_SHIFT - 5)

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

Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4041,20 +4041,6 @@ static bool bnx2x_get_load_status(struct bnx2x *bp, int engine)
40414041
return val != 0;
40424042
}
40434043

4044-
/*
4045-
* Reset the load status for the current engine.
4046-
*/
4047-
static void bnx2x_clear_load_status(struct bnx2x *bp)
4048-
{
4049-
u32 val;
4050-
u32 mask = (BP_PATH(bp) ? BNX2X_PATH1_LOAD_CNT_MASK :
4051-
BNX2X_PATH0_LOAD_CNT_MASK);
4052-
bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_RECOVERY_REG);
4053-
val = REG_RD(bp, BNX2X_RECOVERY_GLOB_REG);
4054-
REG_WR(bp, BNX2X_RECOVERY_GLOB_REG, val & (~mask));
4055-
bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RECOVERY_REG);
4056-
}
4057-
40584044
static void _print_next_block(int idx, const char *blk)
40594045
{
40604046
pr_cont("%s%s", idx ? ", " : "", blk);
@@ -9384,32 +9370,24 @@ static int __devinit bnx2x_prev_mark_path(struct bnx2x *bp)
93849370
return rc;
93859371
}
93869372

9387-
static bool __devinit bnx2x_can_flr(struct bnx2x *bp)
9388-
{
9389-
int pos;
9390-
u32 cap;
9391-
struct pci_dev *dev = bp->pdev;
9392-
9393-
pos = pci_pcie_cap(dev);
9394-
if (!pos)
9395-
return false;
9396-
9397-
pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP, &cap);
9398-
if (!(cap & PCI_EXP_DEVCAP_FLR))
9399-
return false;
9400-
9401-
return true;
9402-
}
9403-
94049373
static int __devinit bnx2x_do_flr(struct bnx2x *bp)
94059374
{
94069375
int i, pos;
94079376
u16 status;
94089377
struct pci_dev *dev = bp->pdev;
94099378

9410-
/* probe the capability first */
9411-
if (bnx2x_can_flr(bp))
9412-
return -ENOTTY;
9379+
9380+
if (CHIP_IS_E1x(bp)) {
9381+
BNX2X_DEV_INFO("FLR not supported in E1/E1H\n");
9382+
return -EINVAL;
9383+
}
9384+
9385+
/* only bootcode REQ_BC_VER_4_INITIATE_FLR and onwards support flr */
9386+
if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) {
9387+
BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n",
9388+
bp->common.bc_ver);
9389+
return -EINVAL;
9390+
}
94139391

94149392
pos = pci_pcie_cap(dev);
94159393
if (!pos)
@@ -9429,12 +9407,8 @@ static int __devinit bnx2x_do_flr(struct bnx2x *bp)
94299407
"transaction is not cleared; proceeding with reset anyway\n");
94309408

94319409
clear:
9432-
if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) {
9433-
BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n",
9434-
bp->common.bc_ver);
9435-
return -EINVAL;
9436-
}
94379410

9411+
BNX2X_DEV_INFO("Initiating FLR\n");
94389412
bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0);
94399413

94409414
return 0;
@@ -9454,8 +9428,21 @@ static int __devinit bnx2x_prev_unload_uncommon(struct bnx2x *bp)
94549428
* the one required, then FLR will be sufficient to clean any residue
94559429
* left by previous driver
94569430
*/
9457-
if (bnx2x_test_firmware_version(bp, false) && bnx2x_can_flr(bp))
9458-
return bnx2x_do_flr(bp);
9431+
rc = bnx2x_test_firmware_version(bp, false);
9432+
9433+
if (!rc) {
9434+
/* fw version is good */
9435+
BNX2X_DEV_INFO("FW version matches our own. Attempting FLR\n");
9436+
rc = bnx2x_do_flr(bp);
9437+
}
9438+
9439+
if (!rc) {
9440+
/* FLR was performed */
9441+
BNX2X_DEV_INFO("FLR successful\n");
9442+
return 0;
9443+
}
9444+
9445+
BNX2X_DEV_INFO("Could not FLR\n");
94599446

94609447
/* Close the MCP request, return failure*/
94619448
rc = bnx2x_prev_mcp_done(bp);
@@ -11427,9 +11414,6 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
1142711414
if (!chip_is_e1x)
1142811415
REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ, 1);
1142911416

11430-
/* Reset the load counter */
11431-
bnx2x_clear_load_status(bp);
11432-
1143311417
dev->watchdog_timeo = TX_TIMEOUT;
1143411418

1143511419
dev->netdev_ops = &bnx2x_netdev_ops;

drivers/net/ethernet/intel/e1000e/82571.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active)
999999
**/
10001000
static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
10011001
{
1002-
u32 ctrl, ctrl_ext, eecd;
1002+
u32 ctrl, ctrl_ext, eecd, tctl;
10031003
s32 ret_val;
10041004

10051005
/*
@@ -1014,7 +1014,9 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
10141014
ew32(IMC, 0xffffffff);
10151015

10161016
ew32(RCTL, 0);
1017-
ew32(TCTL, E1000_TCTL_PSP);
1017+
tctl = er32(TCTL);
1018+
tctl &= ~E1000_TCTL_EN;
1019+
ew32(TCTL, tctl);
10181020
e1e_flush();
10191021

10201022
usleep_range(10000, 20000);
@@ -1601,10 +1603,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
16011603
* auto-negotiation in the TXCW register and disable
16021604
* forced link in the Device Control register in an
16031605
* attempt to auto-negotiate with our link partner.
1604-
* If the partner code word is null, stop forcing
1605-
* and restart auto negotiation.
16061606
*/
1607-
if ((rxcw & E1000_RXCW_C) || !(rxcw & E1000_RXCW_CW)) {
1607+
if (rxcw & E1000_RXCW_C) {
16081608
/* Enable autoneg, and unforce link up */
16091609
ew32(TXCW, mac->txcw);
16101610
ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));

drivers/net/ethernet/intel/e1000e/netdev.c

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,24 @@ static void e1000_regdump(struct e1000_hw *hw, struct e1000_reg_info *reginfo)
178178
pr_info("%-15s %08x %08x\n", rname, regs[0], regs[1]);
179179
}
180180

181+
static void e1000e_dump_ps_pages(struct e1000_adapter *adapter,
182+
struct e1000_buffer *bi)
183+
{
184+
int i;
185+
struct e1000_ps_page *ps_page;
186+
187+
for (i = 0; i < adapter->rx_ps_pages; i++) {
188+
ps_page = &bi->ps_pages[i];
189+
190+
if (ps_page->page) {
191+
pr_info("packet dump for ps_page %d:\n", i);
192+
print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
193+
16, 1, page_address(ps_page->page),
194+
PAGE_SIZE, true);
195+
}
196+
}
197+
}
198+
181199
/*
182200
* e1000e_dump - Print registers, Tx-ring and Rx-ring
183201
*/
@@ -299,10 +317,10 @@ static void e1000e_dump(struct e1000_adapter *adapter)
299317
(unsigned long long)buffer_info->time_stamp,
300318
buffer_info->skb, next_desc);
301319

302-
if (netif_msg_pktdata(adapter) && buffer_info->dma != 0)
320+
if (netif_msg_pktdata(adapter) && buffer_info->skb)
303321
print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
304-
16, 1, phys_to_virt(buffer_info->dma),
305-
buffer_info->length, true);
322+
16, 1, buffer_info->skb->data,
323+
buffer_info->skb->len, true);
306324
}
307325

308326
/* Print Rx Ring Summary */
@@ -381,10 +399,8 @@ static void e1000e_dump(struct e1000_adapter *adapter)
381399
buffer_info->skb, next_desc);
382400

383401
if (netif_msg_pktdata(adapter))
384-
print_hex_dump(KERN_INFO, "",
385-
DUMP_PREFIX_ADDRESS, 16, 1,
386-
phys_to_virt(buffer_info->dma),
387-
adapter->rx_ps_bsize0, true);
402+
e1000e_dump_ps_pages(adapter,
403+
buffer_info);
388404
}
389405
}
390406
break;
@@ -444,12 +460,12 @@ static void e1000e_dump(struct e1000_adapter *adapter)
444460
(unsigned long long)buffer_info->dma,
445461
buffer_info->skb, next_desc);
446462

447-
if (netif_msg_pktdata(adapter))
463+
if (netif_msg_pktdata(adapter) &&
464+
buffer_info->skb)
448465
print_hex_dump(KERN_INFO, "",
449466
DUMP_PREFIX_ADDRESS, 16,
450467
1,
451-
phys_to_virt
452-
(buffer_info->dma),
468+
buffer_info->skb->data,
453469
adapter->rx_buffer_len,
454470
true);
455471
}

drivers/net/ethernet/intel/igb/e1000_regs.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,12 @@
156156
: (0x0E018 + ((_n) * 0x40)))
157157
#define E1000_TXDCTL(_n) ((_n) < 4 ? (0x03828 + ((_n) * 0x100)) \
158158
: (0x0E028 + ((_n) * 0x40)))
159-
#define E1000_DCA_TXCTRL(_n) (0x03814 + (_n << 8))
160-
#define E1000_DCA_RXCTRL(_n) (0x02814 + (_n << 8))
159+
#define E1000_RXCTL(_n) ((_n) < 4 ? (0x02814 + ((_n) * 0x100)) : \
160+
(0x0C014 + ((_n) * 0x40)))
161+
#define E1000_DCA_RXCTRL(_n) E1000_RXCTL(_n)
162+
#define E1000_TXCTL(_n) ((_n) < 4 ? (0x03814 + ((_n) * 0x100)) : \
163+
(0x0E014 + ((_n) * 0x40)))
164+
#define E1000_DCA_TXCTRL(_n) E1000_TXCTL(_n)
161165
#define E1000_TDWBAL(_n) ((_n) < 4 ? (0x03838 + ((_n) * 0x100)) \
162166
: (0x0E038 + ((_n) * 0x40)))
163167
#define E1000_TDWBAH(_n) ((_n) < 4 ? (0x0383C + ((_n) * 0x100)) \

drivers/net/ethernet/intel/igb/igb_ethtool.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,9 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter)
14981498
break;
14991499
}
15001500

1501+
/* add small delay to avoid loopback test failure */
1502+
msleep(50);
1503+
15011504
/* force 1000, set loopback */
15021505
igb_write_phy_reg(hw, PHY_CONTROL, 0x4140);
15031506

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,10 @@ static void igb_dump(struct igb_adapter *adapter)
462462
(u64)buffer_info->time_stamp,
463463
buffer_info->skb, next_desc);
464464

465-
if (netif_msg_pktdata(adapter) && buffer_info->dma != 0)
465+
if (netif_msg_pktdata(adapter) && buffer_info->skb)
466466
print_hex_dump(KERN_INFO, "",
467467
DUMP_PREFIX_ADDRESS,
468-
16, 1, phys_to_virt(buffer_info->dma),
468+
16, 1, buffer_info->skb->data,
469469
buffer_info->length, true);
470470
}
471471
}
@@ -547,18 +547,17 @@ static void igb_dump(struct igb_adapter *adapter)
547547
(u64)buffer_info->dma,
548548
buffer_info->skb, next_desc);
549549

550-
if (netif_msg_pktdata(adapter)) {
550+
if (netif_msg_pktdata(adapter) &&
551+
buffer_info->dma && buffer_info->skb) {
551552
print_hex_dump(KERN_INFO, "",
552-
DUMP_PREFIX_ADDRESS,
553-
16, 1,
554-
phys_to_virt(buffer_info->dma),
555-
IGB_RX_HDR_LEN, true);
553+
DUMP_PREFIX_ADDRESS,
554+
16, 1, buffer_info->skb->data,
555+
IGB_RX_HDR_LEN, true);
556556
print_hex_dump(KERN_INFO, "",
557557
DUMP_PREFIX_ADDRESS,
558558
16, 1,
559-
phys_to_virt(
560-
buffer_info->page_dma +
561-
buffer_info->page_offset),
559+
page_address(buffer_info->page) +
560+
buffer_info->page_offset,
562561
PAGE_SIZE/2, true);
563562
}
564563
}

drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,12 +804,13 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
804804
link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
805805
/* Set KX4/KX/KR support according to speed requested */
806806
autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP);
807-
if (speed & IXGBE_LINK_SPEED_10GB_FULL)
807+
if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
808808
if (orig_autoc & IXGBE_AUTOC_KX4_SUPP)
809809
autoc |= IXGBE_AUTOC_KX4_SUPP;
810810
if ((orig_autoc & IXGBE_AUTOC_KR_SUPP) &&
811811
(hw->phy.smart_speed_active == false))
812812
autoc |= IXGBE_AUTOC_KR_SUPP;
813+
}
813814
if (speed & IXGBE_LINK_SPEED_1GB_FULL)
814815
autoc |= IXGBE_AUTOC_KX_SUPP;
815816
} else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) &&

drivers/net/ethernet/nxp/lpc_eth.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -346,28 +346,15 @@ static phy_interface_t lpc_phy_interface_mode(struct device *dev)
346346
"phy-mode", NULL);
347347
if (mode && !strcmp(mode, "mii"))
348348
return PHY_INTERFACE_MODE_MII;
349-
return PHY_INTERFACE_MODE_RMII;
350349
}
351-
352-
/* non-DT */
353-
#ifdef CONFIG_ARCH_LPC32XX_MII_SUPPORT
354-
return PHY_INTERFACE_MODE_MII;
355-
#else
356350
return PHY_INTERFACE_MODE_RMII;
357-
#endif
358351
}
359352

360353
static bool use_iram_for_net(struct device *dev)
361354
{
362355
if (dev && dev->of_node)
363356
return of_property_read_bool(dev->of_node, "use-iram");
364-
365-
/* non-DT */
366-
#ifdef CONFIG_ARCH_LPC32XX_IRAM_FOR_NET
367-
return true;
368-
#else
369357
return false;
370-
#endif
371358
}
372359

373360
/* Receive Status information word */

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static int __devinit stmmac_probe_config_dt(struct platform_device *pdev,
7474
* the necessary resources and invokes the main to init
7575
* the net device, register the mdio bus etc.
7676
*/
77-
static int stmmac_pltfr_probe(struct platform_device *pdev)
77+
static int __devinit stmmac_pltfr_probe(struct platform_device *pdev)
7878
{
7979
int ret = 0;
8080
struct resource *res;

0 commit comments

Comments
 (0)