Loading drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +13 −30 Original line number Diff line number Diff line Loading @@ -1198,6 +1198,17 @@ static int stmmac_init_phy(struct net_device *dev) return ret; } static void stmmac_set_half_duplex(struct stmmac_priv *priv) { /* Half-Duplex can only work with single tx queue */ if (priv->plat->tx_queues_to_use > 1) priv->phylink_config.mac_capabilities &= ~(MAC_10HD | MAC_100HD | MAC_1000HD); else priv->phylink_config.mac_capabilities |= (MAC_10HD | MAC_100HD | MAC_1000HD); } static int stmmac_phy_setup(struct stmmac_priv *priv) { struct stmmac_mdio_bus_data *mdio_bus_data; Loading Loading @@ -1229,10 +1240,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) MAC_10FD | MAC_100FD | MAC_1000FD; /* Half-Duplex can only work with single queue */ if (priv->plat->tx_queues_to_use <= 1) priv->phylink_config.mac_capabilities |= MAC_10HD | MAC_100HD | MAC_1000HD; stmmac_set_half_duplex(priv); /* Get the MAC specific capabilities */ stmmac_mac_phylink_get_caps(priv); Loading Loading @@ -5287,7 +5295,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) unsigned int desc_size; struct sk_buff *skb = NULL; struct stmmac_xdp_buff ctx; unsigned long flags; int xdp_status = 0; int buf_sz; Loading Loading @@ -5944,11 +5951,6 @@ static irqreturn_t stmmac_mac_interrupt(int irq, void *dev_id) struct net_device *dev = (struct net_device *)dev_id; struct stmmac_priv *priv = netdev_priv(dev); if (unlikely(!dev)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; } /* Check if adapter is up */ if (test_bit(STMMAC_DOWN, &priv->state)) return IRQ_HANDLED; Loading @@ -5964,16 +5966,6 @@ static irqreturn_t stmmac_safety_interrupt(int irq, void *dev_id) struct net_device *dev = (struct net_device *)dev_id; struct stmmac_priv *priv = netdev_priv(dev); if (unlikely(!dev)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; } if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; } /* Check if adapter is up */ if (test_bit(STMMAC_DOWN, &priv->state)) return IRQ_HANDLED; Loading @@ -5995,16 +5987,6 @@ static irqreturn_t stmmac_msi_intr_tx(int irq, void *data) dma_conf = container_of(tx_q, struct stmmac_dma_conf, tx_queue[chan]); priv = container_of(dma_conf, struct stmmac_priv, dma_conf); if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; } if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; } /* Check if adapter is up */ if (test_bit(STMMAC_DOWN, &priv->state)) return IRQ_HANDLED; Loading Loading @@ -7213,6 +7195,7 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt) priv->rss.table[i] = ethtool_rxfh_indir_default(i, rx_cnt); stmmac_set_half_duplex(priv); stmmac_napi_add(dev); if (netif_running(dev)) Loading drivers/net/hyperv/netvsc_drv.c +39 −30 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only ´// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2009, Microsoft Corporation. * Loading Loading @@ -42,6 +42,10 @@ #define LINKCHANGE_INT (2 * HZ) #define VF_TAKEOVER_INT (HZ / 10) /* Macros to define the context of vf registration */ #define VF_REG_IN_PROBE 1 #define VF_REG_IN_NOTIFIER 2 static unsigned int ring_size __ro_after_init = 128; module_param(ring_size, uint, 0444); MODULE_PARM_DESC(ring_size, "Ring buffer size (# of 4K pages)"); Loading Loading @@ -2206,6 +2210,10 @@ static int netvsc_vf_join(struct net_device *vf_netdev, goto upper_link_failed; } /* If this registration is called from probe context vf_takeover * is taken care of later in probe itself. */ if (context == VF_REG_IN_NOTIFIER) schedule_delayed_work(&ndev_ctx->vf_takeover, VF_TAKEOVER_INT); call_netdevice_notifiers(NETDEV_JOIN, vf_netdev); Loading Loading @@ -2344,19 +2352,6 @@ static int netvsc_prepare_bonding(struct net_device *vf_netdev) return NOTIFY_DONE; } static int netvsc_prepare_bonding(struct net_device *vf_netdev) { struct net_device *ndev; ndev = get_netvsc_byslot(vf_netdev); if (!ndev) return NOTIFY_DONE; /* set slave flag before open to prevent IPv6 addrconf */ vf_netdev->flags |= IFF_SLAVE; return NOTIFY_DONE; } static int netvsc_register_vf(struct net_device *vf_netdev, int context) { struct net_device_context *net_device_ctx; Loading Loading @@ -2631,6 +2626,30 @@ static int netvsc_probe(struct hv_device *dev, } list_add(&net_device_ctx->list, &netvsc_dev_list); /* When the hv_netvsc driver is unloaded and reloaded, the * NET_DEVICE_REGISTER for the vf device is replayed before probe * is complete. This is because register_netdevice_notifier() gets * registered before vmbus_driver_register() so that callback func * is set before probe and we don't miss events like NETDEV_POST_INIT * So, in this section we try to register the matching vf device that * is present as a netdevice, knowing that its register call is not * processed in the netvsc_netdev_notifier(as probing is progress and * get_netvsc_byslot fails). */ for_each_netdev(dev_net(net), vf_netdev) { ret = check_dev_is_matching_vf(vf_netdev); if (ret != 0) continue; if (net != get_netvsc_byslot(vf_netdev)) continue; netvsc_prepare_bonding(vf_netdev); netvsc_register_vf(vf_netdev, VF_REG_IN_PROBE); __netvsc_vf_setup(net, vf_netdev); break; } rtnl_unlock(); netvsc_devinfo_put(device_info); Loading Loading @@ -2786,28 +2805,17 @@ static int netvsc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); int ret = 0; /* Skip our own events */ if (event_dev->netdev_ops == &device_ops) return NOTIFY_DONE; /* Avoid non-Ethernet type devices */ if (event_dev->type != ARPHRD_ETHER) return NOTIFY_DONE; /* Avoid Vlan dev with same MAC registering as VF */ if (is_vlan_dev(event_dev)) return NOTIFY_DONE; /* Avoid Bonding master dev with same MAC registering as VF */ if (netif_is_bond_master(event_dev)) ret = check_dev_is_matching_vf(event_dev); if (ret != 0) return NOTIFY_DONE; switch (event) { case NETDEV_POST_INIT: return netvsc_prepare_bonding(event_dev); case NETDEV_REGISTER: return netvsc_register_vf(event_dev); return netvsc_register_vf(event_dev, VF_REG_IN_NOTIFIER); case NETDEV_UNREGISTER: return netvsc_unregister_vf(event_dev); case NETDEV_UP: Loading Loading @@ -2859,3 +2867,4 @@ MODULE_DESCRIPTION("Microsoft Hyper-V network driver"); module_init(netvsc_drv_init); module_exit(netvsc_drv_exit); drivers/net/xen-netback/netback.c +0 −11 Original line number Diff line number Diff line Loading @@ -460,12 +460,7 @@ static void xenvif_get_requests(struct xenvif_queue *queue, for (shinfo->nr_frags = 0; nr_slots > 0 && shinfo->nr_frags < MAX_SKB_FRAGS; nr_slots--) { if (unlikely(!txp->size)) { unsigned long flags; spin_lock_irqsave(&queue->response_lock, flags); make_tx_response(queue, txp, 0, XEN_NETIF_RSP_OKAY); push_tx_responses(queue); spin_unlock_irqrestore(&queue->response_lock, flags); ++txp; continue; } Loading @@ -491,14 +486,8 @@ static void xenvif_get_requests(struct xenvif_queue *queue, for (shinfo->nr_frags = 0; shinfo->nr_frags < nr_slots; ++txp) { if (unlikely(!txp->size)) { unsigned long flags; spin_lock_irqsave(&queue->response_lock, flags); make_tx_response(queue, txp, 0, XEN_NETIF_RSP_OKAY); push_tx_responses(queue); spin_unlock_irqrestore(&queue->response_lock, flags); continue; } Loading Loading
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +13 −30 Original line number Diff line number Diff line Loading @@ -1198,6 +1198,17 @@ static int stmmac_init_phy(struct net_device *dev) return ret; } static void stmmac_set_half_duplex(struct stmmac_priv *priv) { /* Half-Duplex can only work with single tx queue */ if (priv->plat->tx_queues_to_use > 1) priv->phylink_config.mac_capabilities &= ~(MAC_10HD | MAC_100HD | MAC_1000HD); else priv->phylink_config.mac_capabilities |= (MAC_10HD | MAC_100HD | MAC_1000HD); } static int stmmac_phy_setup(struct stmmac_priv *priv) { struct stmmac_mdio_bus_data *mdio_bus_data; Loading Loading @@ -1229,10 +1240,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) MAC_10FD | MAC_100FD | MAC_1000FD; /* Half-Duplex can only work with single queue */ if (priv->plat->tx_queues_to_use <= 1) priv->phylink_config.mac_capabilities |= MAC_10HD | MAC_100HD | MAC_1000HD; stmmac_set_half_duplex(priv); /* Get the MAC specific capabilities */ stmmac_mac_phylink_get_caps(priv); Loading Loading @@ -5287,7 +5295,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) unsigned int desc_size; struct sk_buff *skb = NULL; struct stmmac_xdp_buff ctx; unsigned long flags; int xdp_status = 0; int buf_sz; Loading Loading @@ -5944,11 +5951,6 @@ static irqreturn_t stmmac_mac_interrupt(int irq, void *dev_id) struct net_device *dev = (struct net_device *)dev_id; struct stmmac_priv *priv = netdev_priv(dev); if (unlikely(!dev)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; } /* Check if adapter is up */ if (test_bit(STMMAC_DOWN, &priv->state)) return IRQ_HANDLED; Loading @@ -5964,16 +5966,6 @@ static irqreturn_t stmmac_safety_interrupt(int irq, void *dev_id) struct net_device *dev = (struct net_device *)dev_id; struct stmmac_priv *priv = netdev_priv(dev); if (unlikely(!dev)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; } if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; } /* Check if adapter is up */ if (test_bit(STMMAC_DOWN, &priv->state)) return IRQ_HANDLED; Loading @@ -5995,16 +5987,6 @@ static irqreturn_t stmmac_msi_intr_tx(int irq, void *data) dma_conf = container_of(tx_q, struct stmmac_dma_conf, tx_queue[chan]); priv = container_of(dma_conf, struct stmmac_priv, dma_conf); if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; } if (unlikely(!data)) { netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__); return IRQ_NONE; } /* Check if adapter is up */ if (test_bit(STMMAC_DOWN, &priv->state)) return IRQ_HANDLED; Loading Loading @@ -7213,6 +7195,7 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt) priv->rss.table[i] = ethtool_rxfh_indir_default(i, rx_cnt); stmmac_set_half_duplex(priv); stmmac_napi_add(dev); if (netif_running(dev)) Loading
drivers/net/hyperv/netvsc_drv.c +39 −30 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only ´// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2009, Microsoft Corporation. * Loading Loading @@ -42,6 +42,10 @@ #define LINKCHANGE_INT (2 * HZ) #define VF_TAKEOVER_INT (HZ / 10) /* Macros to define the context of vf registration */ #define VF_REG_IN_PROBE 1 #define VF_REG_IN_NOTIFIER 2 static unsigned int ring_size __ro_after_init = 128; module_param(ring_size, uint, 0444); MODULE_PARM_DESC(ring_size, "Ring buffer size (# of 4K pages)"); Loading Loading @@ -2206,6 +2210,10 @@ static int netvsc_vf_join(struct net_device *vf_netdev, goto upper_link_failed; } /* If this registration is called from probe context vf_takeover * is taken care of later in probe itself. */ if (context == VF_REG_IN_NOTIFIER) schedule_delayed_work(&ndev_ctx->vf_takeover, VF_TAKEOVER_INT); call_netdevice_notifiers(NETDEV_JOIN, vf_netdev); Loading Loading @@ -2344,19 +2352,6 @@ static int netvsc_prepare_bonding(struct net_device *vf_netdev) return NOTIFY_DONE; } static int netvsc_prepare_bonding(struct net_device *vf_netdev) { struct net_device *ndev; ndev = get_netvsc_byslot(vf_netdev); if (!ndev) return NOTIFY_DONE; /* set slave flag before open to prevent IPv6 addrconf */ vf_netdev->flags |= IFF_SLAVE; return NOTIFY_DONE; } static int netvsc_register_vf(struct net_device *vf_netdev, int context) { struct net_device_context *net_device_ctx; Loading Loading @@ -2631,6 +2626,30 @@ static int netvsc_probe(struct hv_device *dev, } list_add(&net_device_ctx->list, &netvsc_dev_list); /* When the hv_netvsc driver is unloaded and reloaded, the * NET_DEVICE_REGISTER for the vf device is replayed before probe * is complete. This is because register_netdevice_notifier() gets * registered before vmbus_driver_register() so that callback func * is set before probe and we don't miss events like NETDEV_POST_INIT * So, in this section we try to register the matching vf device that * is present as a netdevice, knowing that its register call is not * processed in the netvsc_netdev_notifier(as probing is progress and * get_netvsc_byslot fails). */ for_each_netdev(dev_net(net), vf_netdev) { ret = check_dev_is_matching_vf(vf_netdev); if (ret != 0) continue; if (net != get_netvsc_byslot(vf_netdev)) continue; netvsc_prepare_bonding(vf_netdev); netvsc_register_vf(vf_netdev, VF_REG_IN_PROBE); __netvsc_vf_setup(net, vf_netdev); break; } rtnl_unlock(); netvsc_devinfo_put(device_info); Loading Loading @@ -2786,28 +2805,17 @@ static int netvsc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); int ret = 0; /* Skip our own events */ if (event_dev->netdev_ops == &device_ops) return NOTIFY_DONE; /* Avoid non-Ethernet type devices */ if (event_dev->type != ARPHRD_ETHER) return NOTIFY_DONE; /* Avoid Vlan dev with same MAC registering as VF */ if (is_vlan_dev(event_dev)) return NOTIFY_DONE; /* Avoid Bonding master dev with same MAC registering as VF */ if (netif_is_bond_master(event_dev)) ret = check_dev_is_matching_vf(event_dev); if (ret != 0) return NOTIFY_DONE; switch (event) { case NETDEV_POST_INIT: return netvsc_prepare_bonding(event_dev); case NETDEV_REGISTER: return netvsc_register_vf(event_dev); return netvsc_register_vf(event_dev, VF_REG_IN_NOTIFIER); case NETDEV_UNREGISTER: return netvsc_unregister_vf(event_dev); case NETDEV_UP: Loading Loading @@ -2859,3 +2867,4 @@ MODULE_DESCRIPTION("Microsoft Hyper-V network driver"); module_init(netvsc_drv_init); module_exit(netvsc_drv_exit);
drivers/net/xen-netback/netback.c +0 −11 Original line number Diff line number Diff line Loading @@ -460,12 +460,7 @@ static void xenvif_get_requests(struct xenvif_queue *queue, for (shinfo->nr_frags = 0; nr_slots > 0 && shinfo->nr_frags < MAX_SKB_FRAGS; nr_slots--) { if (unlikely(!txp->size)) { unsigned long flags; spin_lock_irqsave(&queue->response_lock, flags); make_tx_response(queue, txp, 0, XEN_NETIF_RSP_OKAY); push_tx_responses(queue); spin_unlock_irqrestore(&queue->response_lock, flags); ++txp; continue; } Loading @@ -491,14 +486,8 @@ static void xenvif_get_requests(struct xenvif_queue *queue, for (shinfo->nr_frags = 0; shinfo->nr_frags < nr_slots; ++txp) { if (unlikely(!txp->size)) { unsigned long flags; spin_lock_irqsave(&queue->response_lock, flags); make_tx_response(queue, txp, 0, XEN_NETIF_RSP_OKAY); push_tx_responses(queue); spin_unlock_irqrestore(&queue->response_lock, flags); continue; } Loading