From b3bac37b379e344be4196b699b65f85c144e028e Mon Sep 17 00:00:00 2001 From: Yan Burman Date: Thu, 7 Feb 2013 02:25:19 +0000 Subject: [PATCH] --- yaml --- r: 352118 b: refs/heads/master c: 79aeaccd915c527a75f2cb01682eab160bed4f48 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/net/ethernet/broadcom/bgmac.c | 56 +++------ trunk/drivers/net/ethernet/broadcom/bgmac.h | 2 +- .../net/ethernet/mellanox/mlx4/en_main.c | 22 ++++ .../net/ethernet/mellanox/mlx4/en_netdev.c | 4 + .../net/ethernet/mellanox/mlx4/en_rx.c | 39 +++--- .../net/ethernet/mellanox/mlx4/en_selftest.c | 3 + .../net/ethernet/mellanox/mlx4/en_tx.c | 2 +- .../net/ethernet/mellanox/mlx4/mlx4_en.h | 16 ++- .../ethernet/qlogic/netxen/netxen_nic_init.c | 1 + trunk/drivers/net/ethernet/ti/cpsw.c | 114 +----------------- trunk/drivers/net/ethernet/ti/cpsw_ale.c | 107 ++-------------- trunk/drivers/net/ethernet/ti/cpsw_ale.h | 24 +--- trunk/drivers/net/macvlan.c | 23 ---- trunk/drivers/net/team/team.c | 8 -- trunk/drivers/net/wimax/i2400m/rx.c | 1 + trunk/include/linux/if_macvlan.h | 6 - trunk/include/linux/if_team.h | 1 - trunk/include/linux/netdevice.h | 11 +- trunk/include/linux/netpoll.h | 11 +- trunk/include/linux/platform_data/cpsw.h | 1 - trunk/net/core/dev.c | 64 +++------- trunk/net/core/netpoll.c | 40 ------ trunk/net/core/netprio_cgroup.c | 4 +- trunk/net/ieee802154/6lowpan.c | 15 ++- trunk/net/ipv6/ip6_output.c | 3 +- trunk/net/mac802154/wpan.c | 9 +- trunk/net/openvswitch/datapath.c | 2 +- 28 files changed, 148 insertions(+), 443 deletions(-) diff --git a/[refs] b/[refs] index e5f73ff28a7b..33b6509f6367 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c6edfe103b9aacadcd4bb9e8e25cafaefa70a80e +refs/heads/master: 79aeaccd915c527a75f2cb01682eab160bed4f48 diff --git a/trunk/drivers/net/ethernet/broadcom/bgmac.c b/trunk/drivers/net/ethernet/broadcom/bgmac.c index 23c8d4a21ccf..9bd33db7fddd 100644 --- a/trunk/drivers/net/ethernet/broadcom/bgmac.c +++ b/trunk/drivers/net/ethernet/broadcom/bgmac.c @@ -761,26 +761,6 @@ static void bgmac_cmdcfg_maskset(struct bgmac *bgmac, u32 mask, u32 set, udelay(2); } -static void bgmac_write_mac_address(struct bgmac *bgmac, u8 *addr) -{ - u32 tmp; - - tmp = (addr[0] << 24) | (addr[1] << 16) | (addr[2] << 8) | addr[3]; - bgmac_write(bgmac, BGMAC_MACADDR_HIGH, tmp); - tmp = (addr[4] << 8) | addr[5]; - bgmac_write(bgmac, BGMAC_MACADDR_LOW, tmp); -} - -static void bgmac_set_rx_mode(struct net_device *net_dev) -{ - struct bgmac *bgmac = netdev_priv(net_dev); - - if (net_dev->flags & IFF_PROMISC) - bgmac_cmdcfg_maskset(bgmac, ~0, BGMAC_CMDCFG_PROM, false); - else - bgmac_cmdcfg_maskset(bgmac, ~BGMAC_CMDCFG_PROM, 0, false); -} - #if 0 /* We don't use that regs yet */ static void bgmac_chip_stats_update(struct bgmac *bgmac) { @@ -909,10 +889,8 @@ static void bgmac_chip_reset(struct bgmac *bgmac) sw_type = et_swtype; } else if (ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == 9) { sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII; - } else if ((ci->id != BCMA_CHIP_ID_BCM53572 && ci->pkg == 10) || - (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == 9)) { - sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII | - BGMAC_CHIPCTL_1_SW_TYPE_RGMII; + } else if (0) { + /* TODO */ } bcma_chipco_chipctl_maskset(cc, 1, ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK | @@ -1026,6 +1004,8 @@ static void bgmac_enable(struct bgmac *bgmac) static void bgmac_chip_init(struct bgmac *bgmac, bool full_init) { struct bgmac_dma_ring *ring; + u8 *mac = bgmac->net_dev->dev_addr; + u32 tmp; int i; /* 1 interrupt per received frame */ @@ -1034,9 +1014,16 @@ static void bgmac_chip_init(struct bgmac *bgmac, bool full_init) /* Enable 802.3x tx flow control (honor received PAUSE frames) */ bgmac_cmdcfg_maskset(bgmac, ~BGMAC_CMDCFG_RPI, 0, true); - bgmac_set_rx_mode(bgmac->net_dev); + if (bgmac->net_dev->flags & IFF_PROMISC) + bgmac_cmdcfg_maskset(bgmac, ~0, BGMAC_CMDCFG_PROM, false); + else + bgmac_cmdcfg_maskset(bgmac, ~BGMAC_CMDCFG_PROM, 0, false); - bgmac_write_mac_address(bgmac, bgmac->net_dev->dev_addr); + /* Set MAC addr */ + tmp = (mac[0] << 24) | (mac[1] << 16) | (mac[2] << 8) | mac[3]; + bgmac_write(bgmac, BGMAC_MACADDR_HIGH, tmp); + tmp = (mac[4] << 8) | mac[5]; + bgmac_write(bgmac, BGMAC_MACADDR_LOW, tmp); if (bgmac->loopback) bgmac_cmdcfg_maskset(bgmac, ~0, BGMAC_CMDCFG_ML, true); @@ -1173,19 +1160,6 @@ static netdev_tx_t bgmac_start_xmit(struct sk_buff *skb, return bgmac_dma_tx_add(bgmac, ring, skb); } -static int bgmac_set_mac_address(struct net_device *net_dev, void *addr) -{ - struct bgmac *bgmac = netdev_priv(net_dev); - int ret; - - ret = eth_prepare_mac_addr_change(net_dev, addr); - if (ret < 0) - return ret; - bgmac_write_mac_address(bgmac, (u8 *)addr); - eth_commit_mac_addr_change(net_dev, addr); - return 0; -} - static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd) { struct bgmac *bgmac = netdev_priv(net_dev); @@ -1216,9 +1190,7 @@ static const struct net_device_ops bgmac_netdev_ops = { .ndo_open = bgmac_open, .ndo_stop = bgmac_stop, .ndo_start_xmit = bgmac_start_xmit, - .ndo_set_rx_mode = bgmac_set_rx_mode, - .ndo_set_mac_address = bgmac_set_mac_address, - .ndo_validate_addr = eth_validate_addr, + .ndo_set_mac_address = eth_mac_addr, /* generic, sets dev_addr */ .ndo_do_ioctl = bgmac_ioctl, }; diff --git a/trunk/drivers/net/ethernet/broadcom/bgmac.h b/trunk/drivers/net/ethernet/broadcom/bgmac.h index 3dd6f6f7a098..129947017041 100644 --- a/trunk/drivers/net/ethernet/broadcom/bgmac.h +++ b/trunk/drivers/net/ethernet/broadcom/bgmac.h @@ -339,7 +339,7 @@ #define BGMAC_CHIPCTL_1_SW_TYPE_EPHY 0x00000000 #define BGMAC_CHIPCTL_1_SW_TYPE_EPHYMII 0x00000040 #define BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII 0x00000080 -#define BGMAC_CHIPCTL_1_SW_TYPE_RGMII 0x000000C0 +#define BGMAC_CHIPCTL_1_SW_TYPE_RGMI 0x000000C0 #define BGMAC_CHIPCTL_1_RXC_DLL_BYPASS 0x00010000 #define BGMAC_SPEED_10 0x0001 diff --git a/trunk/drivers/net/ethernet/mellanox/mlx4/en_main.c b/trunk/drivers/net/ethernet/mellanox/mlx4/en_main.c index f3c7961a271f..e3c3d122979e 100644 --- a/trunk/drivers/net/ethernet/mellanox/mlx4/en_main.c +++ b/trunk/drivers/net/ethernet/mellanox/mlx4/en_main.c @@ -95,6 +95,28 @@ int en_print(const char *level, const struct mlx4_en_priv *priv, return i; } +void mlx4_en_update_loopback_state(struct net_device *dev, + netdev_features_t features) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + + priv->flags &= ~(MLX4_EN_FLAG_RX_FILTER_NEEDED| + MLX4_EN_FLAG_ENABLE_HW_LOOPBACK); + + /* Drop the packet if SRIOV is not enabled + * and not performing the selftest or flb disabled + */ + if (mlx4_is_mfunc(priv->mdev->dev) && + !(features & NETIF_F_LOOPBACK) && !priv->validate_loopback) + priv->flags |= MLX4_EN_FLAG_RX_FILTER_NEEDED; + + /* Set dmac in Tx WQE if we are in SRIOV mode or if loopback selftest + * is requested + */ + if (mlx4_is_mfunc(priv->mdev->dev) || priv->validate_loopback) + priv->flags |= MLX4_EN_FLAG_ENABLE_HW_LOOPBACK; +} + static int mlx4_en_get_profile(struct mlx4_en_dev *mdev) { struct mlx4_en_profile *params = &mdev->profile; diff --git a/trunk/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/trunk/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index ac1c14f7424a..551ef688a8df 100644 --- a/trunk/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/trunk/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -1563,6 +1563,8 @@ static int mlx4_en_set_features(struct net_device *netdev, priv->ctrl_flags &= cpu_to_be32(~MLX4_WQE_CTRL_FORCE_LOOPBACK); + mlx4_en_update_loopback_state(netdev, features); + return 0; } @@ -1731,6 +1733,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num); en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); + mlx4_en_update_loopback_state(priv->dev, priv->dev->features); + /* Configure port */ mlx4_en_calc_rx_buf(dev); err = mlx4_SET_PORT_general(mdev->dev, priv->port, diff --git a/trunk/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/trunk/drivers/net/ethernet/mellanox/mlx4/en_rx.c index fed26d867f4e..ed214d05dd71 100644 --- a/trunk/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/trunk/drivers/net/ethernet/mellanox/mlx4/en_rx.c @@ -563,9 +563,6 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud unsigned int length; int polled = 0; int ip_summed; - struct ethhdr *ethh; - dma_addr_t dma; - u64 s_mac; int factor = priv->cqe_factor; if (!priv->port_up) @@ -603,21 +600,27 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud goto next; } - /* Get pointer to first fragment since we haven't skb yet and - * cast it to ethhdr struct */ - dma = be64_to_cpu(rx_desc->data[0].addr); - dma_sync_single_for_cpu(priv->ddev, dma, sizeof(*ethh), - DMA_FROM_DEVICE); - ethh = (struct ethhdr *)(page_address(frags[0].page) + - frags[0].offset); - s_mac = mlx4_en_mac_to_u64(ethh->h_source); - - /* If source MAC is equal to our own MAC and not performing - * the selftest or flb disabled - drop the packet */ - if (s_mac == priv->mac && - !((dev->features & NETIF_F_LOOPBACK) || - priv->validate_loopback)) - goto next; + /* Check if we need to drop the packet if SRIOV is not enabled + * and not performing the selftest or flb disabled + */ + if (priv->flags & MLX4_EN_FLAG_RX_FILTER_NEEDED) { + struct ethhdr *ethh; + dma_addr_t dma; + u64 s_mac; + /* Get pointer to first fragment since we haven't + * skb yet and cast it to ethhdr struct + */ + dma = be64_to_cpu(rx_desc->data[0].addr); + dma_sync_single_for_cpu(priv->ddev, dma, sizeof(*ethh), + DMA_FROM_DEVICE); + ethh = (struct ethhdr *)(page_address(frags[0].page) + + frags[0].offset); + + /* Drop the packet, since HW loopback-ed it */ + s_mac = mlx4_en_mac_to_u64(ethh->h_source); + if (s_mac == priv->mac) + goto next; + } /* * Packet is OK - process it. diff --git a/trunk/drivers/net/ethernet/mellanox/mlx4/en_selftest.c b/trunk/drivers/net/ethernet/mellanox/mlx4/en_selftest.c index bf2e5d3f177c..3488c6d9e6b5 100644 --- a/trunk/drivers/net/ethernet/mellanox/mlx4/en_selftest.c +++ b/trunk/drivers/net/ethernet/mellanox/mlx4/en_selftest.c @@ -87,6 +87,8 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv) priv->loopback_ok = 0; priv->validate_loopback = 1; + mlx4_en_update_loopback_state(priv->dev, priv->dev->features); + /* xmit */ if (mlx4_en_test_loopback_xmit(priv)) { en_err(priv, "Transmitting loopback packet failed\n"); @@ -107,6 +109,7 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv) mlx4_en_test_loopback_exit: priv->validate_loopback = 0; + mlx4_en_update_loopback_state(priv->dev, priv->dev->features); return !loopback_ok; } diff --git a/trunk/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/trunk/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 30724d811115..3b28e167b05b 100644 --- a/trunk/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/trunk/drivers/net/ethernet/mellanox/mlx4/en_tx.c @@ -640,7 +640,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) ring->tx_csum++; } - if (mlx4_is_mfunc(mdev->dev) || priv->validate_loopback) { + if (priv->flags & MLX4_EN_FLAG_ENABLE_HW_LOOPBACK) { /* Copy dst mac address to wqe. This allows loopback in eSwitch, * so that VFs and PF can communicate with each other */ diff --git a/trunk/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/trunk/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 43f01650e585..696dcf33619f 100644 --- a/trunk/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/trunk/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h @@ -432,6 +432,17 @@ struct ethtool_flow_id { u64 id; }; +enum { + MLX4_EN_FLAG_PROMISC = (1 << 0), + MLX4_EN_FLAG_MC_PROMISC = (1 << 1), + /* whether we need to enable hardware loopback by putting dmac + * in Tx WQE + */ + MLX4_EN_FLAG_ENABLE_HW_LOOPBACK = (1 << 2), + /* whether we need to drop packets that hardware loopback-ed */ + MLX4_EN_FLAG_RX_FILTER_NEEDED = (1 << 3) +}; + struct mlx4_en_priv { struct mlx4_en_dev *mdev; struct mlx4_en_port_profile *prof; @@ -481,8 +492,6 @@ struct mlx4_en_priv { struct mlx4_en_rss_map rss_map; __be32 ctrl_flags; u32 flags; -#define MLX4_EN_FLAG_PROMISC 0x1 -#define MLX4_EN_FLAG_MC_PROMISC 0x2 u8 num_tx_rings_p_up; u32 tx_ring_num; u32 rx_ring_num; @@ -534,6 +543,9 @@ enum mlx4_en_wol { #define MLX4_EN_WOL_DO_MODIFY (1ULL << 63) +void mlx4_en_update_loopback_state(struct net_device *dev, + netdev_features_t features); + void mlx4_en_destroy_netdev(struct net_device *dev); int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, struct mlx4_en_port_profile *prof); diff --git a/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c index 4782dcfde736..db50598006ef 100644 --- a/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +++ b/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c @@ -201,6 +201,7 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter) struct netxen_cmd_buffer *cmd_buf_arr; struct net_device *netdev = adapter->netdev; + struct pci_dev *pdev = adapter->pdev; tx_ring = kzalloc(sizeof(struct nx_host_tx_ring), GFP_KERNEL); if (tx_ring == NULL) diff --git a/trunk/drivers/net/ethernet/ti/cpsw.c b/trunk/drivers/net/ethernet/ti/cpsw.c index 888708ceb13c..9e63bff124fe 100644 --- a/trunk/drivers/net/ethernet/ti/cpsw.c +++ b/trunk/drivers/net/ethernet/ti/cpsw.c @@ -32,7 +32,6 @@ #include #include #include -#include #include @@ -119,9 +118,6 @@ do { \ #define TX_PRIORITY_MAPPING 0x33221100 #define CPDMA_TX_PRIORITY_MAP 0x76543210 -#define CPSW_VLAN_AWARE BIT(1) -#define CPSW_ALE_VLAN_AWARE 1 - #define cpsw_enable_irq(priv) \ do { \ u32 i; \ @@ -349,7 +345,7 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev) /* program multicast address list into ALE register */ netdev_for_each_mc_addr(ha, ndev) { cpsw_ale_add_mcast(priv->ale, (u8 *)ha->addr, - ALE_ALL_PORTS << priv->host_port, 0, 0, 0); + ALE_ALL_PORTS << priv->host_port, 0, 0); } } } @@ -596,7 +592,7 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) slave_port = cpsw_get_slave_port(priv, slave->slave_num); cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, - 1 << slave_port, 0, 0, ALE_MCAST_FWD_2); + 1 << slave_port, 0, ALE_MCAST_FWD_2); slave->phy = phy_connect(priv->ndev, slave->data->phy_id, &cpsw_adjust_link, slave->data->phy_if); @@ -611,40 +607,14 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) } } -static inline void cpsw_add_default_vlan(struct cpsw_priv *priv) -{ - const int vlan = priv->data.default_vlan; - const int port = priv->host_port; - u32 reg; - int i; - - reg = (priv->version == CPSW_VERSION_1) ? CPSW1_PORT_VLAN : - CPSW2_PORT_VLAN; - - writel(vlan, &priv->host_port_regs->port_vlan); - - for (i = 0; i < 2; i++) - slave_write(priv->slaves + i, vlan, reg); - - cpsw_ale_add_vlan(priv->ale, vlan, ALE_ALL_PORTS << port, - ALE_ALL_PORTS << port, ALE_ALL_PORTS << port, - (ALE_PORT_1 | ALE_PORT_2) << port); -} - static void cpsw_init_host_port(struct cpsw_priv *priv) { - u32 control_reg; - /* soft reset the controller and initialize ale */ soft_reset("cpsw", &priv->regs->soft_reset); cpsw_ale_start(priv->ale); /* switch to vlan unaware mode */ - cpsw_ale_control_set(priv->ale, priv->host_port, ALE_VLAN_AWARE, - CPSW_ALE_VLAN_AWARE); - control_reg = readl(&priv->regs->control); - control_reg |= CPSW_VLAN_AWARE; - writel(control_reg, &priv->regs->control); + cpsw_ale_control_set(priv->ale, 0, ALE_VLAN_AWARE, 0); /* setup host port priority mapping */ __raw_writel(CPDMA_TX_PRIORITY_MAP, @@ -654,9 +624,9 @@ static void cpsw_init_host_port(struct cpsw_priv *priv) cpsw_ale_control_set(priv->ale, priv->host_port, ALE_PORT_STATE, ALE_PORT_STATE_FORWARD); - cpsw_ale_add_ucast(priv->ale, priv->mac_addr, priv->host_port, 0, 0); + cpsw_ale_add_ucast(priv->ale, priv->mac_addr, priv->host_port, 0); cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, - 1 << priv->host_port, 0, 0, ALE_MCAST_FWD_2); + 1 << priv->host_port, 0, ALE_MCAST_FWD_2); } static int cpsw_ndo_open(struct net_device *ndev) @@ -680,9 +650,6 @@ static int cpsw_ndo_open(struct net_device *ndev) cpsw_init_host_port(priv); for_each_slave(priv, cpsw_slave_open, priv); - /* Add default VLAN */ - cpsw_add_default_vlan(priv); - /* setup tx dma to fixed prio and zero offset */ cpdma_control_set(priv->dma, CPDMA_TX_PRIO_FIXED, 1); cpdma_control_set(priv->dma, CPDMA_RX_BUFFER_OFFSET, 0); @@ -966,73 +933,6 @@ static void cpsw_ndo_poll_controller(struct net_device *ndev) } #endif -static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv, - unsigned short vid) -{ - int ret; - - ret = cpsw_ale_add_vlan(priv->ale, vid, - ALE_ALL_PORTS << priv->host_port, - 0, ALE_ALL_PORTS << priv->host_port, - (ALE_PORT_1 | ALE_PORT_2) << priv->host_port); - if (ret != 0) - return ret; - - ret = cpsw_ale_add_ucast(priv->ale, priv->mac_addr, - priv->host_port, ALE_VLAN, vid); - if (ret != 0) - goto clean_vid; - - ret = cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, - ALE_ALL_PORTS << priv->host_port, - ALE_VLAN, vid, 0); - if (ret != 0) - goto clean_vlan_ucast; - return 0; - -clean_vlan_ucast: - cpsw_ale_del_ucast(priv->ale, priv->mac_addr, - priv->host_port, ALE_VLAN, vid); -clean_vid: - cpsw_ale_del_vlan(priv->ale, vid, 0); - return ret; -} - -static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, - unsigned short vid) -{ - struct cpsw_priv *priv = netdev_priv(ndev); - - if (vid == priv->data.default_vlan) - return 0; - - dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid); - return cpsw_add_vlan_ale_entry(priv, vid); -} - -static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, - unsigned short vid) -{ - struct cpsw_priv *priv = netdev_priv(ndev); - int ret; - - if (vid == priv->data.default_vlan) - return 0; - - dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid); - ret = cpsw_ale_del_vlan(priv->ale, vid, 0); - if (ret != 0) - return ret; - - ret = cpsw_ale_del_ucast(priv->ale, priv->mac_addr, - priv->host_port, ALE_VLAN, vid); - if (ret != 0) - return ret; - - return cpsw_ale_del_mcast(priv->ale, priv->ndev->broadcast, - 0, ALE_VLAN, vid); -} - static const struct net_device_ops cpsw_netdev_ops = { .ndo_open = cpsw_ndo_open, .ndo_stop = cpsw_ndo_stop, @@ -1047,8 +947,6 @@ static const struct net_device_ops cpsw_netdev_ops = { #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = cpsw_ndo_poll_controller, #endif - .ndo_vlan_rx_add_vid = cpsw_ndo_vlan_rx_add_vid, - .ndo_vlan_rx_kill_vid = cpsw_ndo_vlan_rx_kill_vid, }; static void cpsw_get_drvinfo(struct net_device *ndev, @@ -1456,7 +1354,7 @@ static int cpsw_probe(struct platform_device *pdev) k++; } - ndev->features |= NETIF_F_HW_VLAN_FILTER; + ndev->flags |= IFF_ALLMULTI; /* see cpsw_ndo_change_rx_flags() */ ndev->netdev_ops = &cpsw_netdev_ops; SET_ETHTOOL_OPS(ndev, &cpsw_ethtool_ops); diff --git a/trunk/drivers/net/ethernet/ti/cpsw_ale.c b/trunk/drivers/net/ethernet/ti/cpsw_ale.c index 7fa60d6092ed..0e9ccc2cf91f 100644 --- a/trunk/drivers/net/ethernet/ti/cpsw_ale.c +++ b/trunk/drivers/net/ethernet/ti/cpsw_ale.c @@ -148,7 +148,7 @@ static int cpsw_ale_write(struct cpsw_ale *ale, int idx, u32 *ale_entry) return idx; } -int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid) +static int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr) { u32 ale_entry[ALE_ENTRY_WORDS]; int type, idx; @@ -160,8 +160,6 @@ int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid) type = cpsw_ale_get_entry_type(ale_entry); if (type != ALE_TYPE_ADDR && type != ALE_TYPE_VLAN_ADDR) continue; - if (cpsw_ale_get_vlan_id(ale_entry) != vid) - continue; cpsw_ale_get_addr(ale_entry, entry_addr); if (memcmp(entry_addr, addr, 6) == 0) return idx; @@ -169,22 +167,6 @@ int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid) return -ENOENT; } -int cpsw_ale_match_vlan(struct cpsw_ale *ale, u16 vid) -{ - u32 ale_entry[ALE_ENTRY_WORDS]; - int type, idx; - - for (idx = 0; idx < ale->params.ale_entries; idx++) { - cpsw_ale_read(ale, idx, ale_entry); - type = cpsw_ale_get_entry_type(ale_entry); - if (type != ALE_TYPE_VLAN) - continue; - if (cpsw_ale_get_vlan_id(ale_entry) == vid) - return idx; - } - return -ENOENT; -} - static int cpsw_ale_match_free(struct cpsw_ale *ale) { u32 ale_entry[ALE_ENTRY_WORDS]; @@ -292,32 +274,19 @@ int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask) return 0; } -static inline void cpsw_ale_set_vlan_entry_type(u32 *ale_entry, - int flags, u16 vid) -{ - if (flags & ALE_VLAN) { - cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_VLAN_ADDR); - cpsw_ale_set_vlan_id(ale_entry, vid); - } else { - cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_ADDR); - } -} - -int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port, - int flags, u16 vid) +int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port, int flags) { u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; int idx; - cpsw_ale_set_vlan_entry_type(ale_entry, flags, vid); - + cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_ADDR); cpsw_ale_set_addr(ale_entry, addr); cpsw_ale_set_ucast_type(ale_entry, ALE_UCAST_PERSISTANT); cpsw_ale_set_secure(ale_entry, (flags & ALE_SECURE) ? 1 : 0); cpsw_ale_set_blocked(ale_entry, (flags & ALE_BLOCKED) ? 1 : 0); cpsw_ale_set_port_num(ale_entry, port); - idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); + idx = cpsw_ale_match_addr(ale, addr); if (idx < 0) idx = cpsw_ale_match_free(ale); if (idx < 0) @@ -329,13 +298,12 @@ int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port, return 0; } -int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port, - int flags, u16 vid) +int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port) { u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; int idx; - idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); + idx = cpsw_ale_match_addr(ale, addr); if (idx < 0) return -ENOENT; @@ -345,19 +313,18 @@ int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port, } int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask, - int flags, u16 vid, int mcast_state) + int super, int mcast_state) { u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; int idx, mask; - idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); + idx = cpsw_ale_match_addr(ale, addr); if (idx >= 0) cpsw_ale_read(ale, idx, ale_entry); - cpsw_ale_set_vlan_entry_type(ale_entry, flags, vid); - + cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_ADDR); cpsw_ale_set_addr(ale_entry, addr); - cpsw_ale_set_super(ale_entry, (flags & ALE_BLOCKED) ? 1 : 0); + cpsw_ale_set_super(ale_entry, super); cpsw_ale_set_mcast_state(ale_entry, mcast_state); mask = cpsw_ale_get_port_mask(ale_entry); @@ -375,13 +342,12 @@ int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask, return 0; } -int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask, - int flags, u16 vid) +int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask) { u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; int idx; - idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); + idx = cpsw_ale_match_addr(ale, addr); if (idx < 0) return -EINVAL; @@ -396,55 +362,6 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask, return 0; } -int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag, - int reg_mcast, int unreg_mcast) -{ - u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; - int idx; - - idx = cpsw_ale_match_vlan(ale, vid); - if (idx >= 0) - cpsw_ale_read(ale, idx, ale_entry); - - cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_VLAN); - cpsw_ale_set_vlan_id(ale_entry, vid); - - cpsw_ale_set_vlan_untag_force(ale_entry, untag); - cpsw_ale_set_vlan_reg_mcast(ale_entry, reg_mcast); - cpsw_ale_set_vlan_unreg_mcast(ale_entry, unreg_mcast); - cpsw_ale_set_vlan_member_list(ale_entry, port); - - if (idx < 0) - idx = cpsw_ale_match_free(ale); - if (idx < 0) - idx = cpsw_ale_find_ageable(ale); - if (idx < 0) - return -ENOMEM; - - cpsw_ale_write(ale, idx, ale_entry); - return 0; -} - -int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask) -{ - u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; - int idx; - - idx = cpsw_ale_match_vlan(ale, vid); - if (idx < 0) - return -ENOENT; - - cpsw_ale_read(ale, idx, ale_entry); - - if (port_mask) - cpsw_ale_set_vlan_member_list(ale_entry, port_mask); - else - cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); - - cpsw_ale_write(ale, idx, ale_entry); - return 0; -} - struct ale_control_info { const char *name; int offset, port_offset; diff --git a/trunk/drivers/net/ethernet/ti/cpsw_ale.h b/trunk/drivers/net/ethernet/ti/cpsw_ale.h index 30daa1265f0c..2bd09cbce522 100644 --- a/trunk/drivers/net/ethernet/ti/cpsw_ale.h +++ b/trunk/drivers/net/ethernet/ti/cpsw_ale.h @@ -64,14 +64,8 @@ enum cpsw_ale_port_state { }; /* ALE unicast entry flags - passed into cpsw_ale_add_ucast() */ -#define ALE_SECURE BIT(0) -#define ALE_BLOCKED BIT(1) -#define ALE_SUPER BIT(2) -#define ALE_VLAN BIT(3) - -#define ALE_PORT_HOST BIT(0) -#define ALE_PORT_1 BIT(1) -#define ALE_PORT_2 BIT(2) +#define ALE_SECURE 1 +#define ALE_BLOCKED 2 #define ALE_MCAST_FWD 0 #define ALE_MCAST_BLOCK_LEARN_FWD 1 @@ -87,17 +81,11 @@ void cpsw_ale_stop(struct cpsw_ale *ale); int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout); int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask); int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask); -int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port, - int flags, u16 vid); -int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port, - int flags, u16 vid); +int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port, int flags); +int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port); int cpsw_ale_add_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask, - int flags, u16 vid, int mcast_state); -int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask, - int flags, u16 vid); -int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag, - int reg_mcast, int unreg_mcast); -int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port); + int super, int mcast_state); +int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask); int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control); int cpsw_ale_control_set(struct cpsw_ale *ale, int port, diff --git a/trunk/drivers/net/macvlan.c b/trunk/drivers/net/macvlan.c index f494da82c33f..7b44ebd7770e 100644 --- a/trunk/drivers/net/macvlan.c +++ b/trunk/drivers/net/macvlan.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -127,13 +126,6 @@ static int macvlan_broadcast_one(struct sk_buff *skb, return vlan->receive(skb); } -static unsigned int mc_hash(const unsigned char *addr) -{ - u32 val = __get_unaligned_cpu32(addr + 2); - - return hash_32(val, MACVLAN_MC_FILTER_BITS); -} - static void macvlan_broadcast(struct sk_buff *skb, const struct macvlan_port *port, struct net_device *src, @@ -145,7 +137,6 @@ static void macvlan_broadcast(struct sk_buff *skb, struct sk_buff *nskb; unsigned int i; int err; - unsigned int hash = mc_hash(eth->h_dest); if (skb->protocol == htons(ETH_P_PAUSE)) return; @@ -155,8 +146,6 @@ static void macvlan_broadcast(struct sk_buff *skb, if (vlan->dev == src || !(vlan->mode & mode)) continue; - if (!test_bit(hash, vlan->mc_filter)) - continue; nskb = skb_clone(skb, GFP_ATOMIC); err = macvlan_broadcast_one(nskb, vlan, eth, mode == MACVLAN_MODE_BRIDGE); @@ -416,18 +405,6 @@ static void macvlan_set_mac_lists(struct net_device *dev) { struct macvlan_dev *vlan = netdev_priv(dev); - if (dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) { - bitmap_fill(vlan->mc_filter, MACVLAN_MC_FILTER_SZ); - } else { - struct netdev_hw_addr *ha; - DECLARE_BITMAP(filter, MACVLAN_MC_FILTER_SZ); - - bitmap_zero(filter, MACVLAN_MC_FILTER_SZ); - netdev_for_each_mc_addr(ha, dev) { - __set_bit(mc_hash(ha->addr), filter); - } - bitmap_copy(vlan->mc_filter, filter, MACVLAN_MC_FILTER_SZ); - } dev_uc_sync(vlan->lowerdev, dev); dev_mc_sync(vlan->lowerdev, dev); } diff --git a/trunk/drivers/net/team/team.c b/trunk/drivers/net/team/team.c index 05c5efe84591..694ccf6d71a3 100644 --- a/trunk/drivers/net/team/team.c +++ b/trunk/drivers/net/team/team.c @@ -508,7 +508,6 @@ static bool team_is_mode_set(struct team *team) static void team_set_no_mode(struct team *team) { - team->user_carrier_enabled = false; team->mode = &__team_no_mode; } @@ -1711,10 +1710,6 @@ static netdev_features_t team_fix_features(struct net_device *dev, static int team_change_carrier(struct net_device *dev, bool new_carrier) { - struct team *team = netdev_priv(dev); - - team->user_carrier_enabled = true; - if (new_carrier) netif_carrier_on(dev); else @@ -2578,9 +2573,6 @@ static void __team_carrier_check(struct team *team) struct team_port *port; bool team_linkup; - if (team->user_carrier_enabled) - return; - team_linkup = false; list_for_each_entry(port, &team->port_list, list) { if (port->linkup) { diff --git a/trunk/drivers/net/wimax/i2400m/rx.c b/trunk/drivers/net/wimax/i2400m/rx.c index 0b602951ff6b..8077e6e35939 100644 --- a/trunk/drivers/net/wimax/i2400m/rx.c +++ b/trunk/drivers/net/wimax/i2400m/rx.c @@ -1346,6 +1346,7 @@ EXPORT_SYMBOL(i2400m_unknown_barker); int i2400m_rx_setup(struct i2400m *i2400m) { int result = 0; + struct device *dev = i2400m_dev(i2400m); i2400m->rx_reorder = i2400m_rx_reorder_disabled? 0 : 1; if (i2400m->rx_reorder) { diff --git a/trunk/include/linux/if_macvlan.h b/trunk/include/linux/if_macvlan.h index 84dde1dd1da4..f65e8d250f7e 100644 --- a/trunk/include/linux/if_macvlan.h +++ b/trunk/include/linux/if_macvlan.h @@ -52,9 +52,6 @@ struct macvlan_pcpu_stats { */ #define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16) -#define MACVLAN_MC_FILTER_BITS 8 -#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS) - struct macvlan_dev { struct net_device *dev; struct list_head list; @@ -62,9 +59,6 @@ struct macvlan_dev { struct macvlan_port *port; struct net_device *lowerdev; struct macvlan_pcpu_stats __percpu *pcpu_stats; - - DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ); - enum macvlan_mode mode; u16 flags; int (*receive)(struct sk_buff *skb); diff --git a/trunk/include/linux/if_team.h b/trunk/include/linux/if_team.h index 4648d8021244..0245def2aa93 100644 --- a/trunk/include/linux/if_team.h +++ b/trunk/include/linux/if_team.h @@ -186,7 +186,6 @@ struct team { const struct team_mode *mode; struct team_mode_ops ops; - bool user_carrier_enabled; bool queue_override_enabled; struct list_head *qom_lists; /* array of queue override mapping lists */ long mode_priv[TEAM_MODE_PRIV_LONGS]; diff --git a/trunk/include/linux/netdevice.h b/trunk/include/linux/netdevice.h index ab2774eb49e8..85b0949d9946 100644 --- a/trunk/include/linux/netdevice.h +++ b/trunk/include/linux/netdevice.h @@ -2662,15 +2662,8 @@ extern int netdev_master_upper_dev_link(struct net_device *dev, extern void netdev_upper_dev_unlink(struct net_device *dev, struct net_device *upper_dev); extern int skb_checksum_help(struct sk_buff *skb); -extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb, - netdev_features_t features, bool tx_path); - -static inline -struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) -{ - return __skb_gso_segment(skb, features, true); -} - +extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, + netdev_features_t features); #ifdef CONFIG_BUG extern void netdev_rx_csum_fault(struct net_device *dev); #else diff --git a/trunk/include/linux/netpoll.h b/trunk/include/linux/netpoll.h index ab856d507b7e..f54c3bb6a22b 100644 --- a/trunk/include/linux/netpoll.h +++ b/trunk/include/linux/netpoll.h @@ -38,9 +38,8 @@ struct netpoll { struct netpoll_info { atomic_t refcnt; - unsigned long rx_flags; + int rx_flags; spinlock_t rx_lock; - struct mutex dev_lock; struct list_head rx_np; /* netpolls that registered an rx_hook */ struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */ @@ -52,14 +51,6 @@ struct netpoll_info { struct rcu_head rcu; }; -#ifdef CONFIG_NETPOLL -extern int netpoll_rx_disable(struct net_device *dev); -extern void netpoll_rx_enable(struct net_device *dev); -#else -static inline int netpoll_rx_disable(struct net_device *dev) { return 0; } -static inline void netpoll_rx_enable(struct net_device *dev) { return; } -#endif - void netpoll_send_udp(struct netpoll *np, const char *msg, int len); void netpoll_print_options(struct netpoll *np); int netpoll_parse_options(struct netpoll *np, char *opt); diff --git a/trunk/include/linux/platform_data/cpsw.h b/trunk/include/linux/platform_data/cpsw.h index e962cfd552e3..24368a2e8b87 100644 --- a/trunk/include/linux/platform_data/cpsw.h +++ b/trunk/include/linux/platform_data/cpsw.h @@ -35,7 +35,6 @@ struct cpsw_platform_data { u32 bd_ram_size; /*buffer descriptor ram size */ u32 rx_descs; /* Number of Rx Descriptios */ u32 mac_control; /* Mac control register */ - u16 default_vlan; /* Def VLAN for ALE lookup in VLAN aware mode*/ }; #endif /* __CPSW_H__ */ diff --git a/trunk/net/core/dev.c b/trunk/net/core/dev.c index 2f31bf97ba65..a87bc74e9fd0 100644 --- a/trunk/net/core/dev.c +++ b/trunk/net/core/dev.c @@ -1266,14 +1266,6 @@ static int __dev_open(struct net_device *dev) if (!netif_device_present(dev)) return -ENODEV; - /* Block netpoll from trying to do any rx path servicing. - * If we don't do this there is a chance ndo_poll_controller - * or ndo_poll may be running while we open the device - */ - ret = netpoll_rx_disable(dev); - if (ret) - return ret; - ret = call_netdevice_notifiers(NETDEV_PRE_UP, dev); ret = notifier_to_errno(ret); if (ret) @@ -1287,8 +1279,6 @@ static int __dev_open(struct net_device *dev) if (!ret && ops->ndo_open) ret = ops->ndo_open(dev); - netpoll_rx_enable(dev); - if (ret) clear_bit(__LINK_STATE_START, &dev->state); else { @@ -1380,16 +1370,9 @@ static int __dev_close(struct net_device *dev) int retval; LIST_HEAD(single); - /* Temporarily disable netpoll until the interface is down */ - retval = netpoll_rx_disable(dev); - if (retval) - return retval; - list_add(&dev->unreg_list, &single); retval = __dev_close_many(&single); list_del(&single); - - netpoll_rx_enable(dev); return retval; } @@ -1425,22 +1408,14 @@ static int dev_close_many(struct list_head *head) */ int dev_close(struct net_device *dev) { - int ret = 0; if (dev->flags & IFF_UP) { LIST_HEAD(single); - /* Block netpoll rx while the interface is going down */ - ret = netpoll_rx_disable(dev); - if (ret) - return ret; - list_add(&dev->unreg_list, &single); dev_close_many(&single); list_del(&single); - - netpoll_rx_enable(dev); } - return ret; + return 0; } EXPORT_SYMBOL(dev_close); @@ -2327,29 +2302,18 @@ int skb_checksum_help(struct sk_buff *skb) } EXPORT_SYMBOL(skb_checksum_help); -/* openvswitch calls this on rx path, so we need a different check. - */ -static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path) -{ - if (tx_path) - return skb->ip_summed != CHECKSUM_PARTIAL; - else - return skb->ip_summed == CHECKSUM_NONE; -} - /** - * __skb_gso_segment - Perform segmentation on skb. + * skb_gso_segment - Perform segmentation on skb. * @skb: buffer to segment * @features: features for the output path (see dev->features) - * @tx_path: whether it is called in TX path * * This function segments the given skb and returns a list of segments. * * It may return NULL if the skb requires no segmentation. This is * only possible when GSO is used for verifying header integrity. */ -struct sk_buff *__skb_gso_segment(struct sk_buff *skb, - netdev_features_t features, bool tx_path) +struct sk_buff *skb_gso_segment(struct sk_buff *skb, + netdev_features_t features) { struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); struct packet_offload *ptype; @@ -2372,7 +2336,7 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb, skb->mac_len = skb->network_header - skb->mac_header; __skb_pull(skb, skb->mac_len); - if (unlikely(skb_needs_check(skb, tx_path))) { + if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) { skb_warn_bad_offload(skb); if (skb_header_cloned(skb) && @@ -2401,7 +2365,7 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb, return segs; } -EXPORT_SYMBOL(__skb_gso_segment); +EXPORT_SYMBOL(skb_gso_segment); /* Take action when hardware reception checksum errors are detected. */ #ifdef CONFIG_BUG @@ -2835,8 +2799,6 @@ int dev_queue_xmit(struct sk_buff *skb) struct Qdisc *q; int rc = -ENOMEM; - skb_reset_mac_header(skb); - /* Disable soft irqs for various locks below. Also * stops preemption for RCU. */ @@ -5996,9 +5958,10 @@ static int netif_alloc_rx_queues(struct net_device *dev) BUG_ON(count < 1); rx = kcalloc(count, sizeof(struct netdev_rx_queue), GFP_KERNEL); - if (!rx) + if (!rx) { + pr_err("netdev: Unable to allocate %u rx queues\n", count); return -ENOMEM; - + } dev->_rx = rx; for (i = 0; i < count; i++) @@ -6029,9 +5992,10 @@ static int netif_alloc_netdev_queues(struct net_device *dev) BUG_ON(count < 1); tx = kcalloc(count, sizeof(struct netdev_queue), GFP_KERNEL); - if (!tx) + if (!tx) { + pr_err("netdev: Unable to allocate %u tx queues\n", count); return -ENOMEM; - + } dev->_tx = tx; netdev_for_each_tx_queue(dev, netdev_init_one_queue, NULL); @@ -6518,8 +6482,10 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, alloc_size += NETDEV_ALIGN - 1; p = kzalloc(alloc_size, GFP_KERNEL); - if (!p) + if (!p) { + pr_err("alloc_netdev: Unable to allocate device\n"); return NULL; + } dev = PTR_ALIGN(p, NETDEV_ALIGN); dev->padded = (char *)dev - (char *)p; diff --git a/trunk/net/core/netpoll.c b/trunk/net/core/netpoll.c index edcd9ad95304..331ccb90f915 100644 --- a/trunk/net/core/netpoll.c +++ b/trunk/net/core/netpoll.c @@ -47,8 +47,6 @@ static struct sk_buff_head skb_pool; static atomic_t trapped; -static struct srcu_struct netpoll_srcu; - #define USEC_PER_POLL 50 #define NETPOLL_RX_ENABLED 1 #define NETPOLL_RX_DROP 2 @@ -201,13 +199,6 @@ static void netpoll_poll_dev(struct net_device *dev) const struct net_device_ops *ops; struct netpoll_info *ni = rcu_dereference_bh(dev->npinfo); - /* Don't do any rx activity if the dev_lock mutex is held - * the dev_open/close paths use this to block netpoll activity - * while changing device state - */ - if (!mutex_trylock(&dev->npinfo->dev_lock)) - return; - if (!dev || !netif_running(dev)) return; @@ -220,8 +211,6 @@ static void netpoll_poll_dev(struct net_device *dev) poll_napi(dev); - mutex_unlock(&dev->npinfo->dev_lock); - if (dev->flags & IFF_SLAVE) { if (ni) { struct net_device *bond_dev; @@ -242,31 +231,6 @@ static void netpoll_poll_dev(struct net_device *dev) zap_completion_queue(); } -int netpoll_rx_disable(struct net_device *dev) -{ - struct netpoll_info *ni; - int idx; - might_sleep(); - idx = srcu_read_lock(&netpoll_srcu); - ni = srcu_dereference(dev->npinfo, &netpoll_srcu); - if (ni) - mutex_lock(&ni->dev_lock); - srcu_read_unlock(&netpoll_srcu, idx); - return 0; -} -EXPORT_SYMBOL(netpoll_rx_disable); - -void netpoll_rx_enable(struct net_device *dev) -{ - struct netpoll_info *ni; - rcu_read_lock(); - ni = rcu_dereference(dev->npinfo); - if (ni) - mutex_unlock(&ni->dev_lock); - rcu_read_unlock(); -} -EXPORT_SYMBOL(netpoll_rx_enable); - static void refill_skbs(void) { struct sk_buff *skb; @@ -1040,7 +1004,6 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp) INIT_LIST_HEAD(&npinfo->rx_np); spin_lock_init(&npinfo->rx_lock); - mutex_init(&npinfo->dev_lock); skb_queue_head_init(&npinfo->neigh_tx); skb_queue_head_init(&npinfo->txq); INIT_DELAYED_WORK(&npinfo->tx_work, queue_process); @@ -1206,7 +1169,6 @@ EXPORT_SYMBOL(netpoll_setup); static int __init netpoll_init(void) { skb_queue_head_init(&skb_pool); - init_srcu_struct(&netpoll_srcu); return 0; } core_initcall(netpoll_init); @@ -1246,8 +1208,6 @@ void __netpoll_cleanup(struct netpoll *np) spin_unlock_irqrestore(&npinfo->rx_lock, flags); } - synchronize_srcu(&netpoll_srcu); - if (atomic_dec_and_test(&npinfo->refcnt)) { const struct net_device_ops *ops; diff --git a/trunk/net/core/netprio_cgroup.c b/trunk/net/core/netprio_cgroup.c index 0777d0aa18c3..5e67defe2cb0 100644 --- a/trunk/net/core/netprio_cgroup.c +++ b/trunk/net/core/netprio_cgroup.c @@ -69,8 +69,10 @@ static int extend_netdev_table(struct net_device *dev, u32 target_idx) /* allocate & copy */ new = kzalloc(new_sz, GFP_KERNEL); - if (!new) + if (!new) { + pr_warn("Unable to alloc new priomap!\n"); return -ENOMEM; + } if (old) memcpy(new->priomap, old->priomap, diff --git a/trunk/net/ieee802154/6lowpan.c b/trunk/net/ieee802154/6lowpan.c index 43b95ca61114..09cba81d2c4a 100644 --- a/trunk/net/ieee802154/6lowpan.c +++ b/trunk/net/ieee802154/6lowpan.c @@ -377,14 +377,17 @@ static int lowpan_header_create(struct sk_buff *skb, struct ipv6hdr *hdr; const u8 *saddr = _saddr; const u8 *daddr = _daddr; - u8 head[100]; + u8 *head; struct ieee802154_addr sa, da; - /* TODO: - * if this package isn't ipv6 one, where should it be routed? - */ if (type != ETH_P_IPV6) return 0; + /* TODO: + * if this package isn't ipv6 one, where should it be routed? + */ + head = kzalloc(100, GFP_KERNEL); + if (head == NULL) + return -ENOMEM; hdr = ipv6_hdr(skb); hc06_ptr = head + 2; @@ -558,6 +561,8 @@ static int lowpan_header_create(struct sk_buff *skb, skb_pull(skb, sizeof(struct ipv6hdr)); memcpy(skb_push(skb, hc06_ptr - head), head, hc06_ptr - head); + kfree(head); + lowpan_raw_dump_table(__func__, "raw skb data dump", skb->data, skb->len); @@ -1262,7 +1267,7 @@ static inline int __init lowpan_netlink_init(void) return rtnl_link_register(&lowpan_link_ops); } -static inline void lowpan_netlink_fini(void) +static inline void __init lowpan_netlink_fini(void) { rtnl_link_unregister(&lowpan_link_ops); } diff --git a/trunk/net/ipv6/ip6_output.c b/trunk/net/ipv6/ip6_output.c index c953825f9098..906b7e6dd7fb 100644 --- a/trunk/net/ipv6/ip6_output.c +++ b/trunk/net/ipv6/ip6_output.c @@ -242,8 +242,9 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, dst->dev, dst_output); } + net_dbg_ratelimited("IPv6: sending pkt_too_big to self\n"); skb->dev = dst->dev; - ipv6_local_error(sk, EMSGSIZE, fl6, mtu); + icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_FRAGFAILS); kfree_skb(skb); return -EMSGSIZE; diff --git a/trunk/net/mac802154/wpan.c b/trunk/net/mac802154/wpan.c index d20c6d3c247d..199b92261e94 100644 --- a/trunk/net/mac802154/wpan.c +++ b/trunk/net/mac802154/wpan.c @@ -41,7 +41,7 @@ static inline int mac802154_fetch_skb_u8(struct sk_buff *skb, u8 *val) return -EINVAL; *val = skb->data[0]; - skb_pull(skb, 1); + skb_pull(skb, 1); return 0; } @@ -137,12 +137,16 @@ static int mac802154_header_create(struct sk_buff *skb, struct ieee802154_addr dev_addr; struct mac802154_sub_if_data *priv = netdev_priv(dev); int pos = 2; - u8 head[MAC802154_FRAME_HARD_HEADER_LEN]; + u8 *head; u16 fc; if (!daddr) return -EINVAL; + head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_KERNEL); + if (head == NULL) + return -ENOMEM; + head[pos++] = mac_cb(skb)->seq; /* DSN/BSN */ fc = mac_cb_type(skb); @@ -206,6 +210,7 @@ static int mac802154_header_create(struct sk_buff *skb, head[1] = fc >> 8; memcpy(skb_push(skb, pos), head, pos); + kfree(head); return pos; } diff --git a/trunk/net/openvswitch/datapath.c b/trunk/net/openvswitch/datapath.c index 9dc537df46c4..d8c13a965459 100644 --- a/trunk/net/openvswitch/datapath.c +++ b/trunk/net/openvswitch/datapath.c @@ -301,7 +301,7 @@ static int queue_gso_packets(struct net *net, int dp_ifindex, struct sk_buff *segs, *nskb; int err; - segs = __skb_gso_segment(skb, NETIF_F_SG | NETIF_F_HW_CSUM, false); + segs = skb_gso_segment(skb, NETIF_F_SG | NETIF_F_HW_CSUM); if (IS_ERR(segs)) return PTR_ERR(segs);