u8 extend_lb_time;
u8 phys_port_id[ETH_ALEN];
u8 lb_mode;
- u8 vxlan_port_count;
- u16 vxlan_port;
struct device *hwmon_dev;
u32 post_mode;
bool run_post;
#define QLCNIC_HAS_PHYS_PORT_ID 0x40000
#define QLCNIC_TSS_RSS 0x80000
-#define QLCNIC_ADD_VXLAN_PORT 0x100000
-#define QLCNIC_DEL_VXLAN_PORT 0x200000
-
#define QLCNIC_VLAN_FILTERING 0x800000
#define QLCNIC_IS_MSI_FAMILY(adapter) \
int qlcnic_set_default_offload_settings(struct qlcnic_adapter *);
int qlcnic_reset_npar_config(struct qlcnic_adapter *);
int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *);
+int qlcnic_set_vxlan_port(struct qlcnic_adapter *adapter, u16 port);
+int qlcnic_set_vxlan_parsing(struct qlcnic_adapter *adapter, u16 port);
int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter);
int qlcnic_read_mac_addr(struct qlcnic_adapter *);
int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int);
#define QLCNIC_ENABLE_INGRESS_ENCAP_PARSING 1
#define QLCNIC_DISABLE_INGRESS_ENCAP_PARSING 0
-static int qlcnic_set_vxlan_port(struct qlcnic_adapter *adapter)
+int qlcnic_set_vxlan_port(struct qlcnic_adapter *adapter, u16 port)
{
- u16 port = adapter->ahw->vxlan_port;
struct qlcnic_cmd_args cmd;
int ret = 0;
return ret;
}
-static int qlcnic_set_vxlan_parsing(struct qlcnic_adapter *adapter,
- bool state)
+int qlcnic_set_vxlan_parsing(struct qlcnic_adapter *adapter, u16 port)
{
- u16 vxlan_port = adapter->ahw->vxlan_port;
struct qlcnic_cmd_args cmd;
int ret = 0;
if (ret)
return ret;
- cmd.req.arg[1] = state ? QLCNIC_ENABLE_INGRESS_ENCAP_PARSING :
- QLCNIC_DISABLE_INGRESS_ENCAP_PARSING;
+ cmd.req.arg[1] = port ? QLCNIC_ENABLE_INGRESS_ENCAP_PARSING :
+ QLCNIC_DISABLE_INGRESS_ENCAP_PARSING;
ret = qlcnic_issue_cmd(adapter, &cmd);
if (ret)
netdev_err(adapter->netdev,
"Failed to %s VXLAN parsing for port %d\n",
- state ? "enable" : "disable", vxlan_port);
+ port ? "enable" : "disable", port);
else
netdev_info(adapter->netdev,
"%s VXLAN parsing for port %d\n",
- state ? "Enabled" : "Disabled", vxlan_port);
+ port ? "Enabled" : "Disabled", port);
qlcnic_free_mbx_args(&cmd);
{
if (adapter->fhash.fnum)
qlcnic_prune_lb_filters(adapter);
-
- if (adapter->flags & QLCNIC_ADD_VXLAN_PORT) {
- if (qlcnic_set_vxlan_port(adapter))
- return;
-
- if (qlcnic_set_vxlan_parsing(adapter, true))
- return;
-
- adapter->flags &= ~QLCNIC_ADD_VXLAN_PORT;
- } else if (adapter->flags & QLCNIC_DEL_VXLAN_PORT) {
- if (qlcnic_set_vxlan_parsing(adapter, false))
- return;
-
- adapter->ahw->vxlan_port = 0;
- adapter->flags &= ~QLCNIC_DEL_VXLAN_PORT;
- }
}
/**
return 0;
}
-static void qlcnic_add_vxlan_port(struct net_device *netdev,
- struct udp_tunnel_info *ti)
+static int qlcnic_udp_tunnel_sync(struct net_device *dev, unsigned int table)
{
- struct qlcnic_adapter *adapter = netdev_priv(netdev);
- struct qlcnic_hardware_context *ahw = adapter->ahw;
-
- if (ti->type != UDP_TUNNEL_TYPE_VXLAN)
- return;
+ struct qlcnic_adapter *adapter = netdev_priv(dev);
+ struct udp_tunnel_info ti;
+ int err;
- /* Adapter supports only one VXLAN port. Use very first port
- * for enabling offload
- */
- if (!qlcnic_encap_rx_offload(adapter))
- return;
- if (!ahw->vxlan_port_count) {
- ahw->vxlan_port_count = 1;
- ahw->vxlan_port = ntohs(ti->port);
- adapter->flags |= QLCNIC_ADD_VXLAN_PORT;
- return;
+ udp_tunnel_nic_get_port(dev, table, 0, &ti);
+ if (ti.port) {
+ err = qlcnic_set_vxlan_port(adapter, ntohs(ti.port));
+ if (err)
+ return err;
}
- if (ahw->vxlan_port == ntohs(ti->port))
- ahw->vxlan_port_count++;
+ return qlcnic_set_vxlan_parsing(adapter, ntohs(ti.port));
}
-static void qlcnic_del_vxlan_port(struct net_device *netdev,
- struct udp_tunnel_info *ti)
-{
- struct qlcnic_adapter *adapter = netdev_priv(netdev);
- struct qlcnic_hardware_context *ahw = adapter->ahw;
-
- if (ti->type != UDP_TUNNEL_TYPE_VXLAN)
- return;
-
- if (!qlcnic_encap_rx_offload(adapter) || !ahw->vxlan_port_count ||
- (ahw->vxlan_port != ntohs(ti->port)))
- return;
-
- ahw->vxlan_port_count--;
- if (!ahw->vxlan_port_count)
- adapter->flags |= QLCNIC_DEL_VXLAN_PORT;
-}
+static const struct udp_tunnel_nic_info qlcnic_udp_tunnels = {
+ .sync_table = qlcnic_udp_tunnel_sync,
+ .flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP,
+ .tables = {
+ { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
+ },
+};
static netdev_features_t qlcnic_features_check(struct sk_buff *skb,
struct net_device *dev,
.ndo_fdb_del = qlcnic_fdb_del,
.ndo_fdb_dump = qlcnic_fdb_dump,
.ndo_get_phys_port_id = qlcnic_get_phys_port_id,
- .ndo_udp_tunnel_add = qlcnic_add_vxlan_port,
- .ndo_udp_tunnel_del = qlcnic_del_vxlan_port,
+ .ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
+ .ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
.ndo_features_check = qlcnic_features_check,
#ifdef CONFIG_QLCNIC_SRIOV
.ndo_set_vf_mac = qlcnic_sriov_set_vf_mac,
qlcnic_create_sysfs_entries(adapter);
if (qlcnic_encap_rx_offload(adapter))
- udp_tunnel_get_rx_info(netdev);
+ udp_tunnel_nic_reset_ntf(netdev);
adapter->is_up = QLCNIC_ADAPTER_UP_MAGIC;
return 0;
NETIF_F_TSO6;
}
- if (qlcnic_encap_rx_offload(adapter))
+ if (qlcnic_encap_rx_offload(adapter)) {
netdev->hw_enc_features |= NETIF_F_RXCSUM;
+ netdev->udp_tunnel_nic_info = &qlcnic_udp_tunnels;
+ }
+
netdev->hw_features = netdev->features;
netdev->priv_flags |= IFF_UNICAST_FLT;
netdev->irq = adapter->msix_entries[0].vector;