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

bnxt: Update drivers to support unified UDP encapsulation offload functions

This patch ends up doing several things.  First it updates the driver to
make use of the new unified UDP tunnel offload notifier functions.  In
addition I updated the code so that we can work around the bits that were
checking for if VXLAN was enabled since we are now using a notifier based
setup.
Signed-off-by: NAlexander Duyck <aduyck@mirantis.com>
Acked-by: NMichael Chan <michael.chan@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6b352912
...@@ -166,7 +166,6 @@ config SYSTEMPORT ...@@ -166,7 +166,6 @@ config SYSTEMPORT
config BNXT config BNXT
tristate "Broadcom NetXtreme-C/E support" tristate "Broadcom NetXtreme-C/E support"
depends on PCI depends on PCI
depends on VXLAN || VXLAN=n
select FW_LOADER select FW_LOADER
select LIBCRC32C select LIBCRC32C
---help--- ---help---
......
...@@ -37,9 +37,7 @@ ...@@ -37,9 +37,7 @@
#include <net/udp.h> #include <net/udp.h>
#include <net/checksum.h> #include <net/checksum.h>
#include <net/ip6_checksum.h> #include <net/ip6_checksum.h>
#if defined(CONFIG_VXLAN) || defined(CONFIG_VXLAN_MODULE) #include <net/udp_tunnel.h>
#include <net/vxlan.h>
#endif
#ifdef CONFIG_NET_RX_BUSY_POLL #ifdef CONFIG_NET_RX_BUSY_POLL
#include <net/busy_poll.h> #include <net/busy_poll.h>
#endif #endif
...@@ -5256,9 +5254,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) ...@@ -5256,9 +5254,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
} }
if (irq_re_init) { if (irq_re_init) {
#if defined(CONFIG_VXLAN) || defined(CONFIG_VXLAN_MODULE) udp_tunnel_get_rx_info(bp->dev);
vxlan_get_rx_port(bp->dev);
#endif
if (!bnxt_hwrm_tunnel_dst_port_alloc( if (!bnxt_hwrm_tunnel_dst_port_alloc(
bp, htons(0x17c1), bp, htons(0x17c1),
TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE)) TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE))
...@@ -6250,47 +6246,63 @@ static void bnxt_cfg_ntp_filters(struct bnxt *bp) ...@@ -6250,47 +6246,63 @@ static void bnxt_cfg_ntp_filters(struct bnxt *bp)
#endif /* CONFIG_RFS_ACCEL */ #endif /* CONFIG_RFS_ACCEL */
static void bnxt_add_vxlan_port(struct net_device *dev, sa_family_t sa_family, static void bnxt_udp_tunnel_add(struct net_device *dev,
__be16 port) struct udp_tunnel_info *ti)
{ {
struct bnxt *bp = netdev_priv(dev); struct bnxt *bp = netdev_priv(dev);
if (!netif_running(dev)) if (ti->sa_family != AF_INET6 && ti->sa_family != AF_INET)
return; return;
if (sa_family != AF_INET6 && sa_family != AF_INET) if (!netif_running(dev))
return; return;
if (bp->vxlan_port_cnt && bp->vxlan_port != port) switch (ti->type) {
return; case UDP_TUNNEL_TYPE_VXLAN:
if (bp->vxlan_port_cnt && bp->vxlan_port != ti->port)
return;
bp->vxlan_port_cnt++; bp->vxlan_port_cnt++;
if (bp->vxlan_port_cnt == 1) { if (bp->vxlan_port_cnt == 1) {
bp->vxlan_port = port; bp->vxlan_port = ti->port;
set_bit(BNXT_VXLAN_ADD_PORT_SP_EVENT, &bp->sp_event); set_bit(BNXT_VXLAN_ADD_PORT_SP_EVENT, &bp->sp_event);
schedule_work(&bp->sp_task); schedule_work(&bp->sp_task);
}
break;
default:
return;
} }
schedule_work(&bp->sp_task);
} }
static void bnxt_del_vxlan_port(struct net_device *dev, sa_family_t sa_family, static void bnxt_udp_tunnel_del(struct net_device *dev,
__be16 port) struct udp_tunnel_info *ti)
{ {
struct bnxt *bp = netdev_priv(dev); struct bnxt *bp = netdev_priv(dev);
if (!netif_running(dev)) if (ti->sa_family != AF_INET6 && ti->sa_family != AF_INET)
return; return;
if (sa_family != AF_INET6 && sa_family != AF_INET) if (!netif_running(dev))
return; return;
if (bp->vxlan_port_cnt && bp->vxlan_port == port) { switch (ti->type) {
case UDP_TUNNEL_TYPE_VXLAN:
if (!bp->vxlan_port_cnt || bp->vxlan_port != ti->port)
return;
bp->vxlan_port_cnt--; bp->vxlan_port_cnt--;
if (bp->vxlan_port_cnt == 0) { if (bp->vxlan_port_cnt != 0)
set_bit(BNXT_VXLAN_DEL_PORT_SP_EVENT, &bp->sp_event); return;
schedule_work(&bp->sp_task);
} set_bit(BNXT_VXLAN_DEL_PORT_SP_EVENT, &bp->sp_event);
break;
default:
return;
} }
schedule_work(&bp->sp_task);
} }
static const struct net_device_ops bnxt_netdev_ops = { static const struct net_device_ops bnxt_netdev_ops = {
...@@ -6321,8 +6333,8 @@ static const struct net_device_ops bnxt_netdev_ops = { ...@@ -6321,8 +6333,8 @@ static const struct net_device_ops bnxt_netdev_ops = {
#ifdef CONFIG_RFS_ACCEL #ifdef CONFIG_RFS_ACCEL
.ndo_rx_flow_steer = bnxt_rx_flow_steer, .ndo_rx_flow_steer = bnxt_rx_flow_steer,
#endif #endif
.ndo_add_vxlan_port = bnxt_add_vxlan_port, .ndo_udp_tunnel_add = bnxt_udp_tunnel_add,
.ndo_del_vxlan_port = bnxt_del_vxlan_port, .ndo_udp_tunnel_del = bnxt_udp_tunnel_del,
#ifdef CONFIG_NET_RX_BUSY_POLL #ifdef CONFIG_NET_RX_BUSY_POLL
.ndo_busy_poll = bnxt_busy_poll, .ndo_busy_poll = bnxt_busy_poll,
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册