Commit ed245fe9 authored by Paolo Abeni's avatar Paolo Abeni
Browse files

Merge branch 'net-phy-add-support-for-fbnic-phy-w-25g-50g-and-100g-support'

Alexander Duyck says:

====================
net: phy: Add support for fbnic PHY w/ 25G, 50G, and 100G support

To transition the fbnic driver to using the XPCS driver we need to address
the fact that we need a representation for the FW managed PMD that is
actually a SerDes PHY to handle link bouncing during link training.

This patch set introduces the necessary bits to the XPCS driver code to
enable it to read 25G, 50G, and 100G speeds from the PCS ctrl1 register,
and adds support for the approriate interfaces.

The rest of this patch set enables the changes to fbnic to make use of
these interfaces and expose a PMD that can provide a necessary link delay
to avoid link flapping in the event that a cable is disconnected and
reconnected, and to correctly expose the count for the link down events.

With this we have the basic groundwork laid as with this all the bits and
pieces are in place in terms of reading the configuration. The general plan
for follow-on patch sets is to start looking at enabling changing the
configuration in environments where that is supported.
====================

Link: https://patch.msgid.link/176374310349.959489.838154632023183753.stgit@ahduyck-xeon-server.home.arpa


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents f93505f3 d0fe7104
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ config FBNIC
	depends on PTP_1588_CLOCK_OPTIONAL
	select NET_DEVLINK
	select PAGE_POOL
	select PCS_XPCS
	select PHYLINK
	select PLDMFW
	help
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ fbnic-y := fbnic_csr.o \
	   fbnic_pci.o \
	   fbnic_phylink.o \
	   fbnic_rpc.o \
	   fbnic_mdio.o \
	   fbnic_time.o \
	   fbnic_tlv.o \
	   fbnic_txrx.o \
+12 −3
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ struct fbnic_dev {
	u32 __iomem *uc_addr4;
	const struct fbnic_mac *mac;
	unsigned int fw_msix_vector;
	unsigned int pcs_msix_vector;
	unsigned int mac_msix_vector;
	unsigned short num_irqs;

	struct {
@@ -83,6 +83,10 @@ struct fbnic_dev {
	/* Last @time_high refresh time in jiffies (to catch stalls) */
	unsigned long last_read;

	/* PMD specific data */
	unsigned long end_of_pmd_training;
	u8 pmd_state;

	/* Local copy of hardware statistics */
	struct fbnic_hw_stats hw_stats;

@@ -91,6 +95,9 @@ struct fbnic_dev {
	u64 prev_firmware_time;

	struct fbnic_fw_log fw_log;

	/* MDIO bus for PHYs */
	struct mii_bus *mdio_bus;
};

/* Reserve entry 0 in the MSI-X "others" array until we have filled all
@@ -175,8 +182,8 @@ void fbnic_fw_free_mbx(struct fbnic_dev *fbd);
void fbnic_hwmon_register(struct fbnic_dev *fbd);
void fbnic_hwmon_unregister(struct fbnic_dev *fbd);

int fbnic_pcs_request_irq(struct fbnic_dev *fbd);
void fbnic_pcs_free_irq(struct fbnic_dev *fbd);
int fbnic_mac_request_irq(struct fbnic_dev *fbd);
void fbnic_mac_free_irq(struct fbnic_dev *fbd);

void fbnic_napi_name_irqs(struct fbnic_dev *fbd);
int fbnic_napi_request_irq(struct fbnic_dev *fbd,
@@ -200,6 +207,8 @@ void fbnic_dbg_exit(void);

void fbnic_rpc_reset_valid_entries(struct fbnic_dev *fbd);

int fbnic_mdiobus_create(struct fbnic_dev *fbd);

void fbnic_csr_get_regs(struct fbnic_dev *fbd, u32 *data, u32 *regs_version);
int fbnic_csr_regs_len(struct fbnic_dev *fbd);

+2 −0
Original line number Diff line number Diff line
@@ -787,6 +787,8 @@ enum {

/* MAC PCS registers */
#define FBNIC_CSR_START_PCS		0x10000 /* CSR section delimiter */
#define FBNIC_PCS_PAGE(n)	(0x10000 + 0x400 * (n))	/* 0x40000 + 1024*n */
#define FBNIC_PCS(reg, n)	((reg) + FBNIC_PCS_PAGE(n))
#define FBNIC_CSR_END_PCS		0x10668 /* CSR section delimiter */

#define FBNIC_CSR_START_RSFEC		0x10800 /* CSR section delimiter */
+9 −0
Original line number Diff line number Diff line
@@ -1863,6 +1863,14 @@ fbnic_get_rmon_stats(struct net_device *netdev,
	*ranges = fbnic_rmon_ranges;
}

static void fbnic_get_link_ext_stats(struct net_device *netdev,
				     struct ethtool_link_ext_stats *stats)
{
	struct fbnic_net *fbn = netdev_priv(netdev);

	stats->link_down_events = fbn->link_down_events;
}

static const struct ethtool_ops fbnic_ethtool_ops = {
	.cap_link_lanes_supported	= true,
	.supported_coalesce_params	= ETHTOOL_COALESCE_USECS |
@@ -1874,6 +1882,7 @@ static const struct ethtool_ops fbnic_ethtool_ops = {
	.get_regs_len			= fbnic_get_regs_len,
	.get_regs			= fbnic_get_regs,
	.get_link			= ethtool_op_get_link,
	.get_link_ext_stats		= fbnic_get_link_ext_stats,
	.get_coalesce			= fbnic_get_coalesce,
	.set_coalesce			= fbnic_set_coalesce,
	.get_ringparam			= fbnic_get_ringparam,
Loading