Compare commits
4 commits
991ddf05f2
...
d701c1f0c7
Author | SHA1 | Date | |
---|---|---|---|
DataHoarder | d701c1f0c7 | ||
279ad02edf | |||
9221eea3b0 | |||
397b5258ed |
|
@ -236,11 +236,13 @@ struct fm10k_iov_data {
|
|||
struct fm10k_vf_info vf_info[0];
|
||||
};
|
||||
|
||||
#ifndef HAVE_UDP_TUNNEL_NIC
|
||||
struct fm10k_udp_port {
|
||||
struct list_head list;
|
||||
sa_family_t sa_family;
|
||||
__be16 port;
|
||||
};
|
||||
#endif
|
||||
|
||||
enum fm10k_macvlan_request_type {
|
||||
FM10K_UC_MAC_REQUEST,
|
||||
|
@ -397,9 +399,13 @@ struct fm10k_intfc {
|
|||
u32 rssrk[FM10K_RSSRK_SIZE];
|
||||
|
||||
/* UDP encapsulation port tracking information */
|
||||
#ifdef HAVE_UDP_TUNNEL_NIC
|
||||
__be16 vxlan_port;
|
||||
__be16 geneve_port;
|
||||
#else
|
||||
struct list_head vxlan_port;
|
||||
struct list_head geneve_port;
|
||||
|
||||
#endif
|
||||
/* MAC/VLAN update queue */
|
||||
struct list_head macvlan_requests;
|
||||
struct delayed_work macvlan_task;
|
||||
|
|
|
@ -692,6 +692,9 @@ static int fm10k_clean_rx_irq(struct fm10k_q_vector *q_vector,
|
|||
static struct ethhdr *fm10k_port_is_vxlan(struct sk_buff *skb)
|
||||
{
|
||||
struct fm10k_intfc *interface = netdev_priv(skb->dev);
|
||||
#ifdef HAVE_UDP_TUNNEL_NIC
|
||||
if (interface->vxlan_port != udp_hdr(skb)->dest)
|
||||
#else
|
||||
struct fm10k_udp_port *vxlan_port;
|
||||
|
||||
/* we can only offload a vxlan if we recognize it as such */
|
||||
|
@ -701,6 +704,7 @@ static struct ethhdr *fm10k_port_is_vxlan(struct sk_buff *skb)
|
|||
if (!vxlan_port)
|
||||
return NULL;
|
||||
if (vxlan_port->port != udp_hdr(skb)->dest)
|
||||
#endif
|
||||
return NULL;
|
||||
|
||||
/* return offset of udp_hdr plus 8 bytes for VXLAN header */
|
||||
|
|
|
@ -1039,6 +1039,7 @@ static s32 fm10k_mbx_create_reply(struct fm10k_hw *hw,
|
|||
case FM10K_STATE_CLOSED:
|
||||
/* generate new header based on data */
|
||||
fm10k_mbx_create_disconnect_hdr(mbx);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2017,6 +2018,7 @@ static s32 fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
|
|||
case FM10K_STATE_CONNECT:
|
||||
/* Update remote value to match local value */
|
||||
mbx->remote = mbx->local;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -376,6 +376,7 @@ static void fm10k_request_glort_range(struct fm10k_intfc *interface)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef HAVE_UDP_TUNNEL_NIC
|
||||
/**
|
||||
* fm10k_free_udp_port_info
|
||||
* @interface: board private structure
|
||||
|
@ -408,6 +409,7 @@ static void fm10k_free_udp_port_info(struct fm10k_intfc *interface)
|
|||
list);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* fm10k_restore_udp_port_info
|
||||
|
@ -418,12 +420,24 @@ static void fm10k_free_udp_port_info(struct fm10k_intfc *interface)
|
|||
static void fm10k_restore_udp_port_info(struct fm10k_intfc *interface)
|
||||
{
|
||||
struct fm10k_hw *hw = &interface->hw;
|
||||
#ifndef HAVE_UDP_TUNNEL_NIC
|
||||
struct fm10k_udp_port *port;
|
||||
#endif
|
||||
|
||||
/* only the PF supports configuring tunnels */
|
||||
if (hw->mac.type != fm10k_mac_pf)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_UDP_TUNNEL_NIC
|
||||
/* restore tunnel configuration register */
|
||||
fm10k_write_reg(hw, FM10K_TUNNEL_CFG,
|
||||
ntohs(interface->vxlan_port) |
|
||||
(ETH_P_TEB << FM10K_TUNNEL_CFG_NVGRE_SHIFT));
|
||||
|
||||
/* restore Geneve tunnel configuration register */
|
||||
fm10k_write_reg(hw, FM10K_TUNNEL_CFG_GENEVE,
|
||||
ntohs(interface->geneve_port));
|
||||
#else
|
||||
port = list_first_entry_or_null(&interface->vxlan_port,
|
||||
struct fm10k_udp_port, list);
|
||||
|
||||
|
@ -438,8 +452,42 @@ static void fm10k_restore_udp_port_info(struct fm10k_intfc *interface)
|
|||
/* restore Geneve tunnel configuration register */
|
||||
fm10k_write_reg(hw, FM10K_TUNNEL_CFG_GENEVE,
|
||||
(port ? ntohs(port->port) : 0));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_UDP_TUNNEL_NIC
|
||||
/**
|
||||
* fm10k_udp_tunnel_sync - Called when UDP tunnel ports change
|
||||
* @dev: network interface device structure
|
||||
* @table: Tunnel table (according to tables of @fm10k_udp_tunnels)
|
||||
*
|
||||
* This function is called when a new UDP tunnel port is added or deleted.
|
||||
* Due to hardware restrictions, only one port per type can be offloaded at
|
||||
* once. Core will send to the driver a port of its choice.
|
||||
**/
|
||||
static int fm10k_udp_tunnel_sync(struct net_device *dev, unsigned int table)
|
||||
{
|
||||
struct fm10k_intfc *interface = netdev_priv(dev);
|
||||
struct udp_tunnel_info ti;
|
||||
|
||||
udp_tunnel_nic_get_port(dev, table, 0, &ti);
|
||||
if (!table)
|
||||
interface->vxlan_port = ti.port;
|
||||
else
|
||||
interface->geneve_port = ti.port;
|
||||
|
||||
fm10k_restore_udp_port_info(interface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct udp_tunnel_nic_info fm10k_udp_tunnels = {
|
||||
.sync_table = fm10k_udp_tunnel_sync,
|
||||
.tables = {
|
||||
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
|
||||
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, },
|
||||
},
|
||||
};
|
||||
#else
|
||||
static struct fm10k_udp_port *
|
||||
fm10k_remove_tunnel_port(struct list_head *ports,
|
||||
struct udp_tunnel_info *ti)
|
||||
|
@ -545,6 +593,7 @@ static void fm10k_udp_tunnel_del(struct net_device *dev,
|
|||
|
||||
fm10k_restore_udp_port_info(interface);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VXLAN_RX_OFFLOAD
|
||||
/**
|
||||
|
@ -679,7 +728,7 @@ int fm10k_open(struct net_device *netdev)
|
|||
#if defined(HAVE_GENEVE_RX_OFFLOAD) && !defined(HAVE_UDP_ENC_RX_OFFLOAD)
|
||||
geneve_get_rx_port(netdev);
|
||||
#endif
|
||||
#ifdef HAVE_UDP_ENC_RX_OFFLOAD
|
||||
#if defined(HAVE_UDP_ENC_RX_OFFLOAD) && !defined(HAVE_UDP_TUNNEL_NIC)
|
||||
udp_tunnel_get_rx_info(netdev);
|
||||
#endif
|
||||
|
||||
|
@ -716,7 +765,9 @@ int fm10k_close(struct net_device *netdev)
|
|||
|
||||
fm10k_qv_free_irq(interface);
|
||||
|
||||
#ifndef HAVE_UDP_TUNNEL_NIC
|
||||
fm10k_free_udp_port_info(interface);
|
||||
#endif
|
||||
|
||||
fm10k_free_all_tx_resources(interface);
|
||||
fm10k_free_all_rx_resources(interface);
|
||||
|
@ -1994,7 +2045,7 @@ static const struct net_device_ops fm10k_netdev_ops = {
|
|||
#ifdef HAVE_RHEL7_NETDEV_OPS_EXT_NDO_SET_VF_VLAN
|
||||
.ndo_set_vf_vlan = fm10k_ndo_set_vf_vlan,
|
||||
#endif /* HAVE_RHEL7_NETDEV_OPS_EXT_NDO_SET_VF_VLAN */
|
||||
#ifdef HAVE_UDP_ENC_RX_OFFLOAD
|
||||
#if defined(HAVE_UDP_ENC_RX_OFFLOAD) && defined(HAVE_UDP_TUNNEL_)
|
||||
.ndo_udp_tunnel_add = fm10k_udp_tunnel_add,
|
||||
.ndo_udp_tunnel_del = fm10k_udp_tunnel_del,
|
||||
#endif
|
||||
|
@ -2067,6 +2118,9 @@ struct net_device *fm10k_alloc_netdev(void)
|
|||
|
||||
#ifdef HAVE_ENCAP_TSO_OFFLOAD
|
||||
dev->features |= NETIF_F_GSO_UDP_TUNNEL;
|
||||
#endif
|
||||
#ifdef HAVE_UDP_TUNNEL_NIC
|
||||
dev->udp_tunnel_nic_info = &fm10k_udp_tunnels;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1396,7 +1396,6 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused irq, void *data)
|
|||
struct fm10k_hw *hw = &interface->hw;
|
||||
struct fm10k_mbx_info *mbx = &hw->mbx;
|
||||
u32 eicr;
|
||||
s32 err = 0;
|
||||
|
||||
/* unmask any set bits related to this interrupt */
|
||||
eicr = fm10k_read_reg(hw, FM10K_EICR);
|
||||
|
@ -1412,15 +1411,16 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused irq, void *data)
|
|||
|
||||
/* service mailboxes */
|
||||
if (fm10k_mbx_trylock(interface)) {
|
||||
err = mbx->ops.process(hw, mbx);
|
||||
s32 err = mbx->ops.process(hw, mbx);
|
||||
|
||||
if (err == FM10K_ERR_RESET_REQUESTED)
|
||||
set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags);
|
||||
|
||||
/* handle VFLRE events */
|
||||
fm10k_iov_event(interface);
|
||||
fm10k_mbx_unlock(interface);
|
||||
}
|
||||
|
||||
if (err == FM10K_ERR_RESET_REQUESTED)
|
||||
set_bit(FM10K_FLAG_RESET_REQUESTED, interface->flags);
|
||||
|
||||
/* if switch toggled state we should reset GLORTs */
|
||||
if (eicr & FM10K_EICR_SWITCHNOTREADY) {
|
||||
/* force link down for at least 4 seconds */
|
||||
|
@ -2115,9 +2115,11 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
|
|||
interface->tx_itr = FM10K_TX_ITR_DEFAULT;
|
||||
interface->rx_itr = FM10K_ITR_ADAPTIVE | FM10K_RX_ITR_DEFAULT;
|
||||
|
||||
#ifndef HAVE_UDP_TUNNEL_NIC
|
||||
/* initialize udp port lists */
|
||||
INIT_LIST_HEAD(&interface->vxlan_port);
|
||||
INIT_LIST_HEAD(&interface->geneve_port);
|
||||
#endif
|
||||
|
||||
/* Initialize the MAC/VLAN queue */
|
||||
INIT_LIST_HEAD(&interface->macvlan_requests);
|
||||
|
@ -2296,6 +2298,7 @@ err_sw_init:
|
|||
err_ioremap:
|
||||
free_netdev(netdev);
|
||||
err_alloc_netdev:
|
||||
pci_disable_pcie_error_reporting(pdev);
|
||||
pci_release_mem_regions(pdev);
|
||||
err_pci_reg:
|
||||
err_dma:
|
||||
|
|
|
@ -5263,6 +5263,10 @@ pci_release_mem_regions(struct pci_dev *pdev)
|
|||
#define HAVE_ETHTOOL_NEW_50G_BITS
|
||||
#endif /* 4.8.0 */
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0))
|
||||
#define HAVE_UDP_TUNNEL_NIC
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0))
|
||||
#ifdef HAVE_TC_SETUP_CLSFLOWER
|
||||
|
|
Loading…
Reference in a new issue