Compare commits

...

7 commits

Author SHA1 Message Date
DataHoarder bf148b5d8a
Merge pull request 'Upstream fixes, added support for Linux kernel >= 5.12, build on Debian bullseye too' (#2) from test-debian-bullseye into master
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone Build is passing
Reviewed-on: #2
2021-08-04 04:18:39 +00:00
DataHoarder bcbbdc162b Change DRV_VERSION to 0.27.1-gs-patched to indicate driver is not vanilla
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-08-04 04:40:17 +02:00
DataHoarder d701c1f0c7 fm10k: convert to new udp_tunnel_nic infra (support kernel >= 5.12.0)
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
Straightforward conversion to new infra. Driver restores info
after close/open cycle by calling its internal restore function
so just use that, no need for udp_tunnel_nic_reset_ntf() here.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

Based off linux commit f7529b4ba3c98470b0e367ba447ad0da84dc308c
2021-08-04 04:16:43 +02:00
Christophe JAILLET 279ad02edf fm10k: Fix an error handling path in 'fm10k_probe()'
If an error occurs after a 'pci_enable_pcie_error_reporting()' call, it
must be undone by a corresponding 'pci_disable_pcie_error_reporting()'
call, as already done in the remove function.

Fixes: 19ae1b3fb99c ("fm10k: Add support for PCI power management and error handling")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-08-04 03:58:20 +02:00
Jesse Brandeburg 9221eea3b0 fm10k: move error check
The error check and set_bit are placed in such a way that sparse (C=2)
warns:
.../fm10k_pci.c:1395:9: warning: context imbalance in 'fm10k_msix_mbx_pf' - different lock contexts for basic block

Which seems a little odd, but the code can obviously be moved
to where the variable is being set without changing functionality
at all, and it even seems to make a bit more sense with the check
closer to the set.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-08-04 03:57:36 +02:00
Gustavo A. R. Silva 397b5258ed fm10k: Fix fall-through warnings for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
warnings by explicitly adding a couple of break statements instead of
just letting the code fall through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-08-04 03:56:10 +02:00
DataHoarder 991ddf05f2 Add debian bullseye to build targets
Some checks failed
continuous-integration/drone/push Build is failing
2021-08-04 03:49:00 +02:00
7 changed files with 84 additions and 9 deletions

View file

@ -36,6 +36,8 @@ local XbpsPipeline(image, version, arch, extra, buildKernel) = Pipeline(image, v
AptPipeline("ubuntu", "18.04", "amd64", "linux-headers-generic", "ls --sort time /lib/modules/ | head -n 1"),
AptPipeline("ubuntu", "16.04", "amd64", "linux-headers-generic", "ls --sort time /lib/modules/ | head -n 1"),
AptPipeline("debian", "bullseye", "amd64", "linux-headers-amd64", "ls --sort time /lib/modules/ | head -n 1"),
AptPipeline("debian", "bullseye", "arm64", "linux-headers-arm64", "ls --sort time /lib/modules/ | head -n 1"),
AptPipeline("debian", "buster", "amd64", "linux-headers-amd64", "ls --sort time /lib/modules/ | head -n 1"),
AptPipeline("debian", "buster", "arm64", "linux-headers-arm64", "ls --sort time /lib/modules/ | head -n 1"),
AptPipeline("debian", "stretch", "amd64", "linux-headers-amd64", "ls --sort time /lib/modules/ | head -n 1"),

View file

@ -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;

View file

@ -13,7 +13,7 @@
#include "fm10k.h"
#define DRV_VERSION "0.27.1"
#define DRV_VERSION "0.27.1-gs-patched"
#define DRV_SUMMARY "Intel(R) Ethernet Switch Host Interface Driver"
const char fm10k_driver_version[] = DRV_VERSION;
char fm10k_driver_name[] = "fm10k";
@ -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 */

View file

@ -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;
}

View file

@ -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

View file

@ -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:

View file

@ -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