Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Browse files Browse the repository at this point in the history
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
  ...
  • Loading branch information
Linus Torvalds committed Aug 13, 2012
2 parents f82202b + f57b07c commit 1c212c6
Show file tree
Hide file tree
Showing 36 changed files with 233 additions and 156 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ struct bnx2x {
#define BNX2X_FW_RX_ALIGN_START (1UL << BNX2X_RX_ALIGN_SHIFT)

#define BNX2X_FW_RX_ALIGN_END \
max(1UL << BNX2X_RX_ALIGN_SHIFT, \
max_t(u64, 1UL << BNX2X_RX_ALIGN_SHIFT, \
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))

#define BNX2X_PXP_DRAM_ALIGN (BNX2X_RX_ALIGN_SHIFT - 5)
Expand Down
72 changes: 28 additions & 44 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4041,20 +4041,6 @@ static bool bnx2x_get_load_status(struct bnx2x *bp, int engine)
return val != 0;
}

/*
* Reset the load status for the current engine.
*/
static void bnx2x_clear_load_status(struct bnx2x *bp)
{
u32 val;
u32 mask = (BP_PATH(bp) ? BNX2X_PATH1_LOAD_CNT_MASK :
BNX2X_PATH0_LOAD_CNT_MASK);
bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_RECOVERY_REG);
val = REG_RD(bp, BNX2X_RECOVERY_GLOB_REG);
REG_WR(bp, BNX2X_RECOVERY_GLOB_REG, val & (~mask));
bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RECOVERY_REG);
}

static void _print_next_block(int idx, const char *blk)
{
pr_cont("%s%s", idx ? ", " : "", blk);
Expand Down Expand Up @@ -9384,32 +9370,24 @@ static int __devinit bnx2x_prev_mark_path(struct bnx2x *bp)
return rc;
}

static bool __devinit bnx2x_can_flr(struct bnx2x *bp)
{
int pos;
u32 cap;
struct pci_dev *dev = bp->pdev;

pos = pci_pcie_cap(dev);
if (!pos)
return false;

pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP, &cap);
if (!(cap & PCI_EXP_DEVCAP_FLR))
return false;

return true;
}

static int __devinit bnx2x_do_flr(struct bnx2x *bp)
{
int i, pos;
u16 status;
struct pci_dev *dev = bp->pdev;

/* probe the capability first */
if (bnx2x_can_flr(bp))
return -ENOTTY;

if (CHIP_IS_E1x(bp)) {
BNX2X_DEV_INFO("FLR not supported in E1/E1H\n");
return -EINVAL;
}

/* only bootcode REQ_BC_VER_4_INITIATE_FLR and onwards support flr */
if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) {
BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n",
bp->common.bc_ver);
return -EINVAL;
}

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

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

BNX2X_DEV_INFO("Initiating FLR\n");
bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0);

return 0;
Expand All @@ -9454,8 +9428,21 @@ static int __devinit bnx2x_prev_unload_uncommon(struct bnx2x *bp)
* the one required, then FLR will be sufficient to clean any residue
* left by previous driver
*/
if (bnx2x_test_firmware_version(bp, false) && bnx2x_can_flr(bp))
return bnx2x_do_flr(bp);
rc = bnx2x_test_firmware_version(bp, false);

if (!rc) {
/* fw version is good */
BNX2X_DEV_INFO("FW version matches our own. Attempting FLR\n");
rc = bnx2x_do_flr(bp);
}

if (!rc) {
/* FLR was performed */
BNX2X_DEV_INFO("FLR successful\n");
return 0;
}

BNX2X_DEV_INFO("Could not FLR\n");

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

/* Reset the load counter */
bnx2x_clear_load_status(bp);

dev->watchdog_timeo = TX_TIMEOUT;

dev->netdev_ops = &bnx2x_netdev_ops;
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/intel/e1000e/82571.c
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active)
**/
static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
{
u32 ctrl, ctrl_ext, eecd;
u32 ctrl, ctrl_ext, eecd, tctl;
s32 ret_val;

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

ew32(RCTL, 0);
ew32(TCTL, E1000_TCTL_PSP);
tctl = er32(TCTL);
tctl &= ~E1000_TCTL_EN;
ew32(TCTL, tctl);
e1e_flush();

usleep_range(10000, 20000);
Expand Down Expand Up @@ -1601,10 +1603,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
* auto-negotiation in the TXCW register and disable
* forced link in the Device Control register in an
* attempt to auto-negotiate with our link partner.
* If the partner code word is null, stop forcing
* and restart auto negotiation.
*/
if ((rxcw & E1000_RXCW_C) || !(rxcw & E1000_RXCW_CW)) {
if (rxcw & E1000_RXCW_C) {
/* Enable autoneg, and unforce link up */
ew32(TXCW, mac->txcw);
ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
Expand Down
36 changes: 26 additions & 10 deletions drivers/net/ethernet/intel/e1000e/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,24 @@ static void e1000_regdump(struct e1000_hw *hw, struct e1000_reg_info *reginfo)
pr_info("%-15s %08x %08x\n", rname, regs[0], regs[1]);
}

static void e1000e_dump_ps_pages(struct e1000_adapter *adapter,
struct e1000_buffer *bi)
{
int i;
struct e1000_ps_page *ps_page;

for (i = 0; i < adapter->rx_ps_pages; i++) {
ps_page = &bi->ps_pages[i];

if (ps_page->page) {
pr_info("packet dump for ps_page %d:\n", i);
print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
16, 1, page_address(ps_page->page),
PAGE_SIZE, true);
}
}
}

/*
* e1000e_dump - Print registers, Tx-ring and Rx-ring
*/
Expand Down Expand Up @@ -299,10 +317,10 @@ static void e1000e_dump(struct e1000_adapter *adapter)
(unsigned long long)buffer_info->time_stamp,
buffer_info->skb, next_desc);

if (netif_msg_pktdata(adapter) && buffer_info->dma != 0)
if (netif_msg_pktdata(adapter) && buffer_info->skb)
print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
16, 1, phys_to_virt(buffer_info->dma),
buffer_info->length, true);
16, 1, buffer_info->skb->data,
buffer_info->skb->len, true);
}

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

if (netif_msg_pktdata(adapter))
print_hex_dump(KERN_INFO, "",
DUMP_PREFIX_ADDRESS, 16, 1,
phys_to_virt(buffer_info->dma),
adapter->rx_ps_bsize0, true);
e1000e_dump_ps_pages(adapter,
buffer_info);
}
}
break;
Expand Down Expand Up @@ -444,12 +460,12 @@ static void e1000e_dump(struct e1000_adapter *adapter)
(unsigned long long)buffer_info->dma,
buffer_info->skb, next_desc);

if (netif_msg_pktdata(adapter))
if (netif_msg_pktdata(adapter) &&
buffer_info->skb)
print_hex_dump(KERN_INFO, "",
DUMP_PREFIX_ADDRESS, 16,
1,
phys_to_virt
(buffer_info->dma),
buffer_info->skb->data,
adapter->rx_buffer_len,
true);
}
Expand Down
8 changes: 6 additions & 2 deletions drivers/net/ethernet/intel/igb/e1000_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,12 @@
: (0x0E018 + ((_n) * 0x40)))
#define E1000_TXDCTL(_n) ((_n) < 4 ? (0x03828 + ((_n) * 0x100)) \
: (0x0E028 + ((_n) * 0x40)))
#define E1000_DCA_TXCTRL(_n) (0x03814 + (_n << 8))
#define E1000_DCA_RXCTRL(_n) (0x02814 + (_n << 8))
#define E1000_RXCTL(_n) ((_n) < 4 ? (0x02814 + ((_n) * 0x100)) : \
(0x0C014 + ((_n) * 0x40)))
#define E1000_DCA_RXCTRL(_n) E1000_RXCTL(_n)
#define E1000_TXCTL(_n) ((_n) < 4 ? (0x03814 + ((_n) * 0x100)) : \
(0x0E014 + ((_n) * 0x40)))
#define E1000_DCA_TXCTRL(_n) E1000_TXCTL(_n)
#define E1000_TDWBAL(_n) ((_n) < 4 ? (0x03838 + ((_n) * 0x100)) \
: (0x0E038 + ((_n) * 0x40)))
#define E1000_TDWBAH(_n) ((_n) < 4 ? (0x0383C + ((_n) * 0x100)) \
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/intel/igb/igb_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,9 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter)
break;
}

/* add small delay to avoid loopback test failure */
msleep(50);

/* force 1000, set loopback */
igb_write_phy_reg(hw, PHY_CONTROL, 0x4140);

Expand Down
19 changes: 9 additions & 10 deletions drivers/net/ethernet/intel/igb/igb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,10 @@ static void igb_dump(struct igb_adapter *adapter)
(u64)buffer_info->time_stamp,
buffer_info->skb, next_desc);

if (netif_msg_pktdata(adapter) && buffer_info->dma != 0)
if (netif_msg_pktdata(adapter) && buffer_info->skb)
print_hex_dump(KERN_INFO, "",
DUMP_PREFIX_ADDRESS,
16, 1, phys_to_virt(buffer_info->dma),
16, 1, buffer_info->skb->data,
buffer_info->length, true);
}
}
Expand Down Expand Up @@ -547,18 +547,17 @@ static void igb_dump(struct igb_adapter *adapter)
(u64)buffer_info->dma,
buffer_info->skb, next_desc);

if (netif_msg_pktdata(adapter)) {
if (netif_msg_pktdata(adapter) &&
buffer_info->dma && buffer_info->skb) {
print_hex_dump(KERN_INFO, "",
DUMP_PREFIX_ADDRESS,
16, 1,
phys_to_virt(buffer_info->dma),
IGB_RX_HDR_LEN, true);
DUMP_PREFIX_ADDRESS,
16, 1, buffer_info->skb->data,
IGB_RX_HDR_LEN, true);
print_hex_dump(KERN_INFO, "",
DUMP_PREFIX_ADDRESS,
16, 1,
phys_to_virt(
buffer_info->page_dma +
buffer_info->page_offset),
page_address(buffer_info->page) +
buffer_info->page_offset,
PAGE_SIZE/2, true);
}
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,12 +804,13 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
/* Set KX4/KX/KR support according to speed requested */
autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP);
if (speed & IXGBE_LINK_SPEED_10GB_FULL)
if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
if (orig_autoc & IXGBE_AUTOC_KX4_SUPP)
autoc |= IXGBE_AUTOC_KX4_SUPP;
if ((orig_autoc & IXGBE_AUTOC_KR_SUPP) &&
(hw->phy.smart_speed_active == false))
autoc |= IXGBE_AUTOC_KR_SUPP;
}
if (speed & IXGBE_LINK_SPEED_1GB_FULL)
autoc |= IXGBE_AUTOC_KX_SUPP;
} else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) &&
Expand Down
13 changes: 0 additions & 13 deletions drivers/net/ethernet/nxp/lpc_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,28 +346,15 @@ static phy_interface_t lpc_phy_interface_mode(struct device *dev)
"phy-mode", NULL);
if (mode && !strcmp(mode, "mii"))
return PHY_INTERFACE_MODE_MII;
return PHY_INTERFACE_MODE_RMII;
}

/* non-DT */
#ifdef CONFIG_ARCH_LPC32XX_MII_SUPPORT
return PHY_INTERFACE_MODE_MII;
#else
return PHY_INTERFACE_MODE_RMII;
#endif
}

static bool use_iram_for_net(struct device *dev)
{
if (dev && dev->of_node)
return of_property_read_bool(dev->of_node, "use-iram");

/* non-DT */
#ifdef CONFIG_ARCH_LPC32XX_IRAM_FOR_NET
return true;
#else
return false;
#endif
}

/* Receive Status information word */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static int __devinit stmmac_probe_config_dt(struct platform_device *pdev,
* the necessary resources and invokes the main to init
* the net device, register the mdio bus etc.
*/
static int stmmac_pltfr_probe(struct platform_device *pdev)
static int __devinit stmmac_pltfr_probe(struct platform_device *pdev)
{
int ret = 0;
struct resource *res;
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/irda/bfin_sir.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static int bfin_sir_set_speed(struct bfin_sir_port *port, int speed)
/* If not add the 'RPOLC', we can't catch the receive interrupt.
* It's related with the HW layout and the IR transiver.
*/
val |= IREN | RPOLC;
val |= UMOD_IRDA | RPOLC;
UART_PUT_GCTL(port, val);
return ret;
}
Expand Down Expand Up @@ -432,7 +432,7 @@ static void bfin_sir_shutdown(struct bfin_sir_port *port, struct net_device *dev
bfin_sir_stop_rx(port);

val = UART_GET_GCTL(port);
val &= ~(UCEN | IREN | RPOLC);
val &= ~(UCEN | UMOD_MASK | RPOLC);
UART_PUT_GCTL(port, val);

#ifdef CONFIG_SIR_BFIN_DMA
Expand Down Expand Up @@ -518,10 +518,10 @@ static void bfin_sir_send_work(struct work_struct *work)
* reset all the UART.
*/
val = UART_GET_GCTL(port);
val &= ~(IREN | RPOLC);
val &= ~(UMOD_MASK | RPOLC);
UART_PUT_GCTL(port, val);
SSYNC();
val |= IREN | RPOLC;
val |= UMOD_IRDA | RPOLC;
UART_PUT_GCTL(port, val);
SSYNC();
/* bfin_sir_set_speed(port, self->speed); */
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/macvtap.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ static int get_slot(struct macvlan_dev *vlan, struct macvtap_queue *q)
int i;

for (i = 0; i < MAX_MACVTAP_QUEUES; i++) {
if (rcu_dereference(vlan->taps[i]) == q)
if (rcu_dereference_protected(vlan->taps[i],
lockdep_is_held(&macvtap_lock)) == q)
return i;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ppp/pptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
if (sk_pppox(po)->sk_state & PPPOX_DEAD)
goto tx_error;

rt = ip_route_output_ports(&init_net, &fl4, NULL,
rt = ip_route_output_ports(sock_net(sk), &fl4, NULL,
opt->dst_addr.sin_addr.s_addr,
opt->src_addr.sin_addr.s_addr,
0, 0, IPPROTO_GRE,
Expand Down Expand Up @@ -468,7 +468,7 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr,
po->chan.private = sk;
po->chan.ops = &pptp_chan_ops;

rt = ip_route_output_ports(&init_net, &fl4, sk,
rt = ip_route_output_ports(sock_net(sk), &fl4, sk,
opt->dst_addr.sin_addr.s_addr,
opt->src_addr.sin_addr.s_addr,
0, 0,
Expand Down
Loading

0 comments on commit 1c212c6

Please sign in to comment.