Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4b7c07f authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'nfp-ksettings'



Jakub Kicinski says:

====================
nfp: ethtool link settings

This series adds support for getting and setting link settings
via the (moderately) new ethtool ksettings ops.

First patch introduces minimal speed and duplex reporting using
the information directly provided in PCI BAR0 memory.

Next few changes deal with the need to refresh port state read
from the service process and patch 6 finally uses that information
to provide link speed and duplex.  Patches 7 and 8 add auto
negotiation and port type reporting.

Remaining changes provide the set support for speed and auto
negotiation.  An upcoming series will also add port splitting
support via devlink.

Quite a bit of churn in this series is caused by the fact that
currently port speed and split changes will usually require a
reboot to take effect.  Current service process code is not capable
of performing MAC reinitialization after chip has been passing
traffic.  To make sure user is aware of this limitation we refuse
the configuration unless netdev is down, print warning to the logs
and if configuration was performed but did take effect we unregister
the netdev.  Service process has a "reboot needed" sticky bit, so
reloading the driver will not bring the netdev back.

Note that there is a helper in patch 13 which is marked as
__always_inline, because the FIELD_* macros require the parameters
to be known at compilation time.  I hope that is OK.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 18148f09 7c698737
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@
#include "nfpcore/nfp.h"
#include "nfpcore/nfp_cpp.h"
#include "nfpcore/nfp_nffw.h"
#include "nfpcore/nfp_nsp_eth.h"
#include "nfpcore/nfp_nsp.h"

#include "nfpcore/nfp6000_pcie.h"

@@ -385,7 +385,6 @@ static void nfp_pci_remove(struct pci_dev *pdev)
{
	struct nfp_pf *pf = pci_get_drvdata(pdev);

	if (!list_empty(&pf->ports))
	nfp_net_pci_remove(pf);

	nfp_pcie_sriov_disable(pdev);
+10 −1
Original line number Diff line number Diff line
@@ -42,7 +42,9 @@
#include <linux/list.h>
#include <linux/types.h>
#include <linux/msi.h>
#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/workqueue.h>

struct dentry;
struct pci_dev;
@@ -64,8 +66,11 @@ struct nfp_eth_table;
 * @fw_loaded:		Is the firmware loaded?
 * @eth_tbl:		NSP ETH table
 * @ddir:		Per-device debugfs directory
 * @num_ports:		Number of adapter ports
 * @num_ports:		Number of adapter ports app firmware supports
 * @num_netdevs:	Number of netdevs spawned
 * @ports:		Linked list of port structures (struct nfp_net)
 * @port_lock:		Protects @ports, @num_ports, @num_netdevs
 * @port_refresh_work:	Work entry for taking netdevs out
 */
struct nfp_pf {
	struct pci_dev *pdev;
@@ -88,7 +93,11 @@ struct nfp_pf {
	struct dentry *ddir;

	unsigned int num_ports;
	unsigned int num_netdevs;

	struct list_head ports;
	struct work_struct port_refresh_work;
	struct mutex port_lock;
};

extern struct pci_driver nfp_netvf_pci_driver;
+6 −1
Original line number Diff line number Diff line
@@ -523,7 +523,8 @@ struct nfp_net_dp {
 * @reconfig_sync_present:  Some thread is performing synchronous reconfig
 * @reconfig_timer:	Timer for async reading of reconfig results
 * @link_up:            Is the link up?
 * @link_status_lock:	Protects @link_up and ensures atomicity with BAR reading
 * @link_changed:	Has link state changes since last port refresh?
 * @link_status_lock:	Protects @link_* and ensures atomicity with BAR reading
 * @rx_coalesce_usecs:      RX interrupt moderation usecs delay parameter
 * @rx_coalesce_max_frames: RX interrupt moderation frame count parameter
 * @tx_coalesce_usecs:      TX interrupt moderation usecs delay parameter
@@ -580,6 +581,7 @@ struct nfp_net {
	u32 me_freq_mhz;

	bool link_up;
	bool link_changed;
	spinlock_t link_status_lock;

	spinlock_t reconfig_lock;
@@ -810,6 +812,9 @@ nfp_net_irqs_assign(struct nfp_net *nn, struct msix_entry *irq_entries,
struct nfp_net_dp *nfp_net_clone_dp(struct nfp_net *nn);
int nfp_net_ring_reconfig(struct nfp_net *nn, struct nfp_net_dp *new);

bool nfp_net_link_changed_read_clear(struct nfp_net *nn);
void nfp_net_refresh_port_config(struct nfp_net *nn);

#ifdef CONFIG_NFP_DEBUG
void nfp_net_debugfs_create(void);
void nfp_net_debugfs_destroy(void);
+15 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@
#include <net/pkt_cls.h>
#include <net/vxlan.h>

#include "nfpcore/nfp_nsp_eth.h"
#include "nfpcore/nfp_nsp.h"
#include "nfp_net_ctrl.h"
#include "nfp_net.h"

@@ -376,6 +376,19 @@ static irqreturn_t nfp_net_irq_rxtx(int irq, void *data)
	return IRQ_HANDLED;
}

bool nfp_net_link_changed_read_clear(struct nfp_net *nn)
{
	unsigned long flags;
	bool ret;

	spin_lock_irqsave(&nn->link_status_lock, flags);
	ret = nn->link_changed;
	nn->link_changed = false;
	spin_unlock_irqrestore(&nn->link_status_lock, flags);

	return ret;
}

/**
 * nfp_net_read_link_status() - Reread link status from control BAR
 * @nn:       NFP Network structure
@@ -395,6 +408,7 @@ static void nfp_net_read_link_status(struct nfp_net *nn)
		goto out;

	nn->link_up = link_up;
	nn->link_changed = true;

	if (nn->link_up) {
		netif_carrier_on(nn->dp.netdev);
+13 −0
Original line number Diff line number Diff line
@@ -177,6 +177,19 @@
#define   NFP_NET_CFG_VERSION_MINOR(x)    (((x) & 0xff) <<  0)
#define NFP_NET_CFG_STS                 0x0034
#define   NFP_NET_CFG_STS_LINK            (0x1 << 0) /* Link up or down */
/* Link rate */
#define   NFP_NET_CFG_STS_LINK_RATE_SHIFT 1
#define   NFP_NET_CFG_STS_LINK_RATE_MASK  0xF
#define   NFP_NET_CFG_STS_LINK_RATE       \
	(NFP_NET_CFG_STS_LINK_RATE_MASK << NFP_NET_CFG_STS_LINK_RATE_SHIFT)
#define   NFP_NET_CFG_STS_LINK_RATE_UNSUPPORTED   0
#define   NFP_NET_CFG_STS_LINK_RATE_UNKNOWN       1
#define   NFP_NET_CFG_STS_LINK_RATE_1G            2
#define   NFP_NET_CFG_STS_LINK_RATE_10G           3
#define   NFP_NET_CFG_STS_LINK_RATE_25G           4
#define   NFP_NET_CFG_STS_LINK_RATE_40G           5
#define   NFP_NET_CFG_STS_LINK_RATE_50G           6
#define   NFP_NET_CFG_STS_LINK_RATE_100G          7
#define NFP_NET_CFG_CAP                 0x0038
#define NFP_NET_CFG_MAX_TXRINGS         0x003c
#define NFP_NET_CFG_MAX_RXRINGS         0x0040
Loading