diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2018-04-03 17:16:03 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2018-04-25 08:26:19 -0700 |
commit | 7d775f63470c3b6ddf34c770c973293ab925a7bb (patch) | |
tree | 1e679c12ceda9a6418ba081068537d16ed899477 /drivers/net/macvlan.c | |
parent | b056b83c06e1b01b7091ba81c5883038a0fc2f46 (diff) |
macvlan: Rename fwd_priv to accel_priv and add accessor function
This change renames the fwd_priv member to accel_priv as this more
accurately reflects the actual purpose of this value. In addition I am
adding an accessor which will allow us to further abstract this in the
future if needed.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r-- | drivers/net/macvlan.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 725f4b4afc6d..7ddc94ff4109 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -559,9 +559,9 @@ static netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, if (unlikely(netpoll_tx_running(dev))) return macvlan_netpoll_send_skb(vlan, skb); - if (vlan->fwd_priv) { + if (vlan->accel_priv) { skb->dev = vlan->lowerdev; - ret = dev_queue_xmit_accel(skb, vlan->fwd_priv); + ret = dev_queue_xmit_accel(skb, vlan->accel_priv); } else { ret = macvlan_queue_xmit(skb, dev); } @@ -613,16 +613,23 @@ static int macvlan_open(struct net_device *dev) goto hash_add; } + err = -EBUSY; + if (macvlan_addr_busy(vlan->port, dev->dev_addr)) + goto out; + + /* Attempt to populate accel_priv which is used to offload the L2 + * forwarding requests for unicast packets. + */ if (lowerdev->features & NETIF_F_HW_L2FW_DOFFLOAD) { - vlan->fwd_priv = + vlan->accel_priv = lowerdev->netdev_ops->ndo_dfwd_add_station(lowerdev, dev); /* If we get a NULL pointer back, or if we get an error * then we should just fall through to the non accelerated path */ - if (IS_ERR_OR_NULL(vlan->fwd_priv)) { - vlan->fwd_priv = NULL; - } else + if (IS_ERR_OR_NULL(vlan->accel_priv)) + vlan->accel_priv = NULL; + else return 0; } @@ -655,10 +662,10 @@ clear_multi: del_unicast: dev_uc_del(lowerdev, dev->dev_addr); out: - if (vlan->fwd_priv) { + if (vlan->accel_priv) { lowerdev->netdev_ops->ndo_dfwd_del_station(lowerdev, - vlan->fwd_priv); - vlan->fwd_priv = NULL; + vlan->accel_priv); + vlan->accel_priv = NULL; } return err; } @@ -668,10 +675,10 @@ static int macvlan_stop(struct net_device *dev) struct macvlan_dev *vlan = netdev_priv(dev); struct net_device *lowerdev = vlan->lowerdev; - if (vlan->fwd_priv) { + if (vlan->accel_priv) { lowerdev->netdev_ops->ndo_dfwd_del_station(lowerdev, - vlan->fwd_priv); - vlan->fwd_priv = NULL; + vlan->accel_priv); + vlan->accel_priv = NULL; return 0; } |