Commit 378fddc2 authored by Jiri Benc's avatar Jiri Benc Committed by David S. Miller

qlcnic: track vxlan port count

The callback for adding vxlan port can be called with the same port for
both IPv4 and IPv6. Do not disable the offloading when the same port for
both protocols is added and later one of them removed.
Signed-off-by: default avatarJiri Benc <jbenc@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 057ba29b
......@@ -536,6 +536,7 @@ struct qlcnic_hardware_context {
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;
......
......@@ -483,11 +483,17 @@ static void qlcnic_add_vxlan_port(struct net_device *netdev,
/* Adapter supports only one VXLAN port. Use very first port
* for enabling offload
*/
if (!qlcnic_encap_rx_offload(adapter) || ahw->vxlan_port)
if (!qlcnic_encap_rx_offload(adapter))
return;
if (!ahw->vxlan_port_count) {
ahw->vxlan_port_count = 1;
ahw->vxlan_port = ntohs(port);
adapter->flags |= QLCNIC_ADD_VXLAN_PORT;
return;
}
if (ahw->vxlan_port == ntohs(port))
ahw->vxlan_port_count++;
}
static void qlcnic_del_vxlan_port(struct net_device *netdev,
......@@ -496,10 +502,12 @@ static void qlcnic_del_vxlan_port(struct net_device *netdev,
struct qlcnic_adapter *adapter = netdev_priv(netdev);
struct qlcnic_hardware_context *ahw = adapter->ahw;
if (!qlcnic_encap_rx_offload(adapter) || !ahw->vxlan_port ||
if (!qlcnic_encap_rx_offload(adapter) || !ahw->vxlan_port_count ||
(ahw->vxlan_port != ntohs(port)))
return;
ahw->vxlan_port_count--;
if (!ahw->vxlan_port_count)
adapter->flags |= QLCNIC_DEL_VXLAN_PORT;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment