提交 bde6b7cd 编写于 作者: A Alexander Duyck 提交者: David S. Miller

benet: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port

This change replaces the network device operations for adding or removing a
VXLAN port with operations that are more generically defined to be used for
any UDP offload port but provide a type.  As such by just adding a line to
verify that the offload type if VXLAN we can maintain the same
functionality.

I have also gone though and removed the BE2NET_VXLAN config option since it
no longer relies on the VXLAN code anyway.
Signed-off-by: NAlexander Duyck <aduyck@mirantis.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7cdd5fc3
...@@ -13,11 +13,3 @@ config BE2NET_HWMON ...@@ -13,11 +13,3 @@ config BE2NET_HWMON
---help--- ---help---
Say Y here if you want to expose thermal sensor data on Say Y here if you want to expose thermal sensor data on
be2net network adapter. be2net network adapter.
config BE2NET_VXLAN
bool "VXLAN offload support on be2net driver"
default y
depends on BE2NET && VXLAN && !(BE2NET=y && VXLAN=m)
---help---
Say Y here if you want to enable VXLAN offload support on
be2net driver.
...@@ -3625,10 +3625,8 @@ static int be_open(struct net_device *netdev) ...@@ -3625,10 +3625,8 @@ static int be_open(struct net_device *netdev)
be_link_status_update(adapter, link_status); be_link_status_update(adapter, link_status);
netif_tx_start_all_queues(netdev); netif_tx_start_all_queues(netdev);
#ifdef CONFIG_BE2NET_VXLAN
if (skyhawk_chip(adapter)) if (skyhawk_chip(adapter))
vxlan_get_rx_port(netdev); udp_tunnel_get_rx_info(netdev);
#endif
return 0; return 0;
err: err:
...@@ -3755,7 +3753,6 @@ static void be_cancel_err_detection(struct be_adapter *adapter) ...@@ -3755,7 +3753,6 @@ static void be_cancel_err_detection(struct be_adapter *adapter)
} }
} }
#ifdef CONFIG_BE2NET_VXLAN
static void be_disable_vxlan_offloads(struct be_adapter *adapter) static void be_disable_vxlan_offloads(struct be_adapter *adapter)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
...@@ -3774,7 +3771,6 @@ static void be_disable_vxlan_offloads(struct be_adapter *adapter) ...@@ -3774,7 +3771,6 @@ static void be_disable_vxlan_offloads(struct be_adapter *adapter)
netdev->hw_features &= ~(NETIF_F_GSO_UDP_TUNNEL); netdev->hw_features &= ~(NETIF_F_GSO_UDP_TUNNEL);
netdev->features &= ~(NETIF_F_GSO_UDP_TUNNEL); netdev->features &= ~(NETIF_F_GSO_UDP_TUNNEL);
} }
#endif
static void be_calculate_vf_res(struct be_adapter *adapter, u16 num_vfs, static void be_calculate_vf_res(struct be_adapter *adapter, u16 num_vfs,
struct be_resources *vft_res) struct be_resources *vft_res)
...@@ -3875,9 +3871,7 @@ static int be_clear(struct be_adapter *adapter) ...@@ -3875,9 +3871,7 @@ static int be_clear(struct be_adapter *adapter)
&vft_res); &vft_res);
} }
#ifdef CONFIG_BE2NET_VXLAN
be_disable_vxlan_offloads(adapter); be_disable_vxlan_offloads(adapter);
#endif
kfree(adapter->pmac_id); kfree(adapter->pmac_id);
adapter->pmac_id = NULL; adapter->pmac_id = NULL;
...@@ -4705,7 +4699,6 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -4705,7 +4699,6 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
0, 0, nlflags, filter_mask, NULL); 0, 0, nlflags, filter_mask, NULL);
} }
#ifdef CONFIG_BE2NET_VXLAN
/* VxLAN offload Notes: /* VxLAN offload Notes:
* *
* The stack defines tunnel offload flags (hw_enc_features) for IP and doesn't * The stack defines tunnel offload flags (hw_enc_features) for IP and doesn't
...@@ -4720,13 +4713,17 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -4720,13 +4713,17 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
* adds more than one port, disable offloads and don't re-enable them again * adds more than one port, disable offloads and don't re-enable them again
* until after all the tunnels are removed. * until after all the tunnels are removed.
*/ */
static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family, static void be_add_vxlan_port(struct net_device *netdev,
__be16 port) struct udp_tunnel_info *ti)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
struct device *dev = &adapter->pdev->dev; struct device *dev = &adapter->pdev->dev;
__be16 port = ti->port;
int status; int status;
if (ti->type != UDP_TUNNEL_TYPE_VXLAN)
return;
if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter)) if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter))
return; return;
...@@ -4774,10 +4771,14 @@ static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family, ...@@ -4774,10 +4771,14 @@ static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family,
be_disable_vxlan_offloads(adapter); be_disable_vxlan_offloads(adapter);
} }
static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family, static void be_del_vxlan_port(struct net_device *netdev,
__be16 port) struct udp_tunnel_info *ti)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
__be16 port = ti->port;
if (ti->type != UDP_TUNNEL_TYPE_VXLAN)
return;
if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter)) if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter))
return; return;
...@@ -4839,7 +4840,6 @@ static netdev_features_t be_features_check(struct sk_buff *skb, ...@@ -4839,7 +4840,6 @@ static netdev_features_t be_features_check(struct sk_buff *skb,
return features; return features;
} }
#endif
static int be_get_phys_port_id(struct net_device *dev, static int be_get_phys_port_id(struct net_device *dev,
struct netdev_phys_item_id *ppid) struct netdev_phys_item_id *ppid)
...@@ -4887,11 +4887,9 @@ static const struct net_device_ops be_netdev_ops = { ...@@ -4887,11 +4887,9 @@ static const struct net_device_ops be_netdev_ops = {
#ifdef CONFIG_NET_RX_BUSY_POLL #ifdef CONFIG_NET_RX_BUSY_POLL
.ndo_busy_poll = be_busy_poll, .ndo_busy_poll = be_busy_poll,
#endif #endif
#ifdef CONFIG_BE2NET_VXLAN .ndo_udp_tunnel_add = be_add_vxlan_port,
.ndo_add_vxlan_port = be_add_vxlan_port, .ndo_udp_tunnel_del = be_del_vxlan_port,
.ndo_del_vxlan_port = be_del_vxlan_port,
.ndo_features_check = be_features_check, .ndo_features_check = be_features_check,
#endif
.ndo_get_phys_port_id = be_get_phys_port_id, .ndo_get_phys_port_id = be_get_phys_port_id,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册