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

Merge branch 'enetc-mac-merge-prep'



Vladimir Oltean says:

====================
ENETC MAC Merge cleanup

This is a preparatory patch set for MAC Merge layer support in enetc via
ethtool. It does the following:

- consolidates a software lockstep register write procedure for the pMAC
- detects per-port frame preemption capability and only writes pMAC
  registers if a pMAC exists
- stops enabling the pMAC by default

Additionally, I noticed some build warnings in the driver which are new
in this kernel version, so patch 1/6 fixes those.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents f3c6e128 086cc080
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
config FSL_ENETC_CORE
	tristate
	help
	  This module supports common functionality between the PF and VF
	  drivers for the NXP ENETC controller.

	  If compiled as module (M), the module name is fsl-enetc-core.

config FSL_ENETC
	tristate "ENETC PF driver"
	depends on PCI_MSI
	select FSL_ENETC_CORE
	select FSL_ENETC_IERB
	select FSL_ENETC_MDIO
	select PHYLINK
@@ -17,6 +26,7 @@ config FSL_ENETC
config FSL_ENETC_VF
	tristate "ENETC VF driver"
	depends on PCI_MSI
	select FSL_ENETC_CORE
	select FSL_ENETC_MDIO
	select PHYLINK
	select DIMLIB
+4 −3
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0

common-objs := enetc.o enetc_cbdr.o enetc_ethtool.o
obj-$(CONFIG_FSL_ENETC_CORE) += fsl-enetc-core.o
fsl-enetc-core-y := enetc.o enetc_cbdr.o enetc_ethtool.o

obj-$(CONFIG_FSL_ENETC) += fsl-enetc.o
fsl-enetc-y := enetc_pf.o $(common-objs)
fsl-enetc-y := enetc_pf.o
fsl-enetc-$(CONFIG_PCI_IOV) += enetc_msg.o
fsl-enetc-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o

obj-$(CONFIG_FSL_ENETC_VF) += fsl-enetc-vf.o
fsl-enetc-vf-y := enetc_vf.o $(common-objs)
fsl-enetc-vf-y := enetc_vf.o

obj-$(CONFIG_FSL_ENETC_IERB) += fsl-enetc-ierb.o
fsl-enetc-ierb-y := enetc_ierb.o
+41 −2
Original line number Diff line number Diff line
@@ -11,6 +11,20 @@
#include <net/pkt_sched.h>
#include <net/tso.h>

u32 enetc_port_mac_rd(struct enetc_si *si, u32 reg)
{
	return enetc_port_rd(&si->hw, reg);
}
EXPORT_SYMBOL_GPL(enetc_port_mac_rd);

void enetc_port_mac_wr(struct enetc_si *si, u32 reg, u32 val)
{
	enetc_port_wr(&si->hw, reg, val);
	if (si->hw_features & ENETC_SI_F_QBU)
		enetc_port_wr(&si->hw, reg + ENETC_PMAC_OFFSET, val);
}
EXPORT_SYMBOL_GPL(enetc_port_mac_wr);

static int enetc_num_stack_tx_queues(struct enetc_ndev_priv *priv)
{
	int num_tx_rings = priv->num_tx_rings;
@@ -243,8 +257,8 @@ static int enetc_map_tx_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb)
			if (udp)
				val |= ENETC_PM0_SINGLE_STEP_CH;

			enetc_port_wr(hw, ENETC_PM0_SINGLE_STEP, val);
			enetc_port_wr(hw, ENETC_PM1_SINGLE_STEP, val);
			enetc_port_mac_wr(priv->si, ENETC_PM0_SINGLE_STEP,
					  val);
		} else if (do_twostep_tstamp) {
			skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
			e_flags |= ENETC_TXBD_E_FLAGS_TWO_STEP_PTP;
@@ -651,6 +665,7 @@ netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev)

	return enetc_start_xmit(skb, ndev);
}
EXPORT_SYMBOL_GPL(enetc_xmit);

static irqreturn_t enetc_msix(int irq, void *data)
{
@@ -1388,6 +1403,7 @@ int enetc_xdp_xmit(struct net_device *ndev, int num_frames,

	return xdp_tx_frm_cnt;
}
EXPORT_SYMBOL_GPL(enetc_xdp_xmit);

static void enetc_map_rx_buff_to_xdp(struct enetc_bdr *rx_ring, int i,
				     struct xdp_buff *xdp_buff, u16 size)
@@ -1711,9 +1727,13 @@ void enetc_get_si_caps(struct enetc_si *si)
	if (val & ENETC_SIPCAPR0_QBV)
		si->hw_features |= ENETC_SI_F_QBV;

	if (val & ENETC_SIPCAPR0_QBU)
		si->hw_features |= ENETC_SI_F_QBU;

	if (val & ENETC_SIPCAPR0_PSFP)
		si->hw_features |= ENETC_SI_F_PSFP;
}
EXPORT_SYMBOL_GPL(enetc_get_si_caps);

static int enetc_dma_alloc_bdr(struct enetc_bdr_resource *res)
{
@@ -2029,6 +2049,7 @@ int enetc_configure_si(struct enetc_ndev_priv *priv)

	return 0;
}
EXPORT_SYMBOL_GPL(enetc_configure_si);

void enetc_init_si_rings_params(struct enetc_ndev_priv *priv)
{
@@ -2048,6 +2069,7 @@ void enetc_init_si_rings_params(struct enetc_ndev_priv *priv)
	priv->ic_mode = ENETC_IC_RX_ADAPTIVE | ENETC_IC_TX_MANUAL;
	priv->tx_ictt = ENETC_TXIC_TIMETHR;
}
EXPORT_SYMBOL_GPL(enetc_init_si_rings_params);

int enetc_alloc_si_resources(struct enetc_ndev_priv *priv)
{
@@ -2060,11 +2082,13 @@ int enetc_alloc_si_resources(struct enetc_ndev_priv *priv)

	return 0;
}
EXPORT_SYMBOL_GPL(enetc_alloc_si_resources);

void enetc_free_si_resources(struct enetc_ndev_priv *priv)
{
	kfree(priv->cls_rules);
}
EXPORT_SYMBOL_GPL(enetc_free_si_resources);

static void enetc_setup_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring)
{
@@ -2426,6 +2450,7 @@ void enetc_start(struct net_device *ndev)

	netif_tx_start_all_queues(ndev);
}
EXPORT_SYMBOL_GPL(enetc_start);

int enetc_open(struct net_device *ndev)
{
@@ -2487,6 +2512,7 @@ int enetc_open(struct net_device *ndev)

	return err;
}
EXPORT_SYMBOL_GPL(enetc_open);

void enetc_stop(struct net_device *ndev)
{
@@ -2510,6 +2536,7 @@ void enetc_stop(struct net_device *ndev)

	enetc_clear_interrupts(priv);
}
EXPORT_SYMBOL_GPL(enetc_stop);

int enetc_close(struct net_device *ndev)
{
@@ -2534,6 +2561,7 @@ int enetc_close(struct net_device *ndev)

	return 0;
}
EXPORT_SYMBOL_GPL(enetc_close);

static int enetc_reconfigure(struct enetc_ndev_priv *priv, bool extended,
			     int (*cb)(struct enetc_ndev_priv *priv, void *ctx),
@@ -2642,6 +2670,7 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)

	return 0;
}
EXPORT_SYMBOL_GPL(enetc_setup_tc_mqprio);

static int enetc_reconfigure_xdp_cb(struct enetc_ndev_priv *priv, void *ctx)
{
@@ -2691,6 +2720,7 @@ int enetc_setup_bpf(struct net_device *ndev, struct netdev_bpf *bpf)

	return 0;
}
EXPORT_SYMBOL_GPL(enetc_setup_bpf);

struct net_device_stats *enetc_get_stats(struct net_device *ndev)
{
@@ -2722,6 +2752,7 @@ struct net_device_stats *enetc_get_stats(struct net_device *ndev)

	return stats;
}
EXPORT_SYMBOL_GPL(enetc_get_stats);

static int enetc_set_rss(struct net_device *ndev, int en)
{
@@ -2774,6 +2805,7 @@ void enetc_set_features(struct net_device *ndev, netdev_features_t features)
		enetc_enable_txvlan(ndev,
				    !!(features & NETIF_F_HW_VLAN_CTAG_TX));
}
EXPORT_SYMBOL_GPL(enetc_set_features);

#ifdef CONFIG_FSL_ENETC_PTP_CLOCK
static int enetc_hwtstamp_set(struct net_device *ndev, struct ifreq *ifr)
@@ -2861,6 +2893,7 @@ int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)

	return phylink_mii_ioctl(priv->phylink, rq, cmd);
}
EXPORT_SYMBOL_GPL(enetc_ioctl);

int enetc_alloc_msix(struct enetc_ndev_priv *priv)
{
@@ -2962,6 +2995,7 @@ int enetc_alloc_msix(struct enetc_ndev_priv *priv)

	return err;
}
EXPORT_SYMBOL_GPL(enetc_alloc_msix);

void enetc_free_msix(struct enetc_ndev_priv *priv)
{
@@ -2991,6 +3025,7 @@ void enetc_free_msix(struct enetc_ndev_priv *priv)
	/* disable all MSIX for this device */
	pci_free_irq_vectors(priv->si->pdev);
}
EXPORT_SYMBOL_GPL(enetc_free_msix);

static void enetc_kfree_si(struct enetc_si *si)
{
@@ -3080,6 +3115,7 @@ int enetc_pci_probe(struct pci_dev *pdev, const char *name, int sizeof_priv)

	return err;
}
EXPORT_SYMBOL_GPL(enetc_pci_probe);

void enetc_pci_remove(struct pci_dev *pdev)
{
@@ -3091,3 +3127,6 @@ void enetc_pci_remove(struct pci_dev *pdev)
	pci_release_mem_regions(pdev);
	pci_disable_device(pdev);
}
EXPORT_SYMBOL_GPL(enetc_pci_remove);

MODULE_LICENSE("Dual BSD/GPL");
+5 −2
Original line number Diff line number Diff line
@@ -229,8 +229,9 @@ enum enetc_errata {
	ENETC_ERR_UCMCSWP	= BIT(1),
};

#define ENETC_SI_F_QBV BIT(0)
#define ENETC_SI_F_PSFP BIT(1)
#define ENETC_SI_F_PSFP BIT(0)
#define ENETC_SI_F_QBV  BIT(1)
#define ENETC_SI_F_QBU  BIT(2)

/* PCI IEP device data */
struct enetc_si {
@@ -396,6 +397,8 @@ struct enetc_msg_cmd_set_primary_mac {
extern int enetc_phc_index;

/* SI common */
u32 enetc_port_mac_rd(struct enetc_si *si, u32 reg);
void enetc_port_mac_wr(struct enetc_si *si, u32 reg, u32 val);
int enetc_pci_probe(struct pci_dev *pdev, const char *name, int sizeof_priv);
void enetc_pci_remove(struct pci_dev *pdev);
int enetc_alloc_msix(struct enetc_ndev_priv *priv);
+8 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ int enetc_setup_cbdr(struct device *dev, struct enetc_hw *hw, int bd_count,

	return 0;
}
EXPORT_SYMBOL_GPL(enetc_setup_cbdr);

void enetc_teardown_cbdr(struct enetc_cbdr *cbdr)
{
@@ -57,6 +58,7 @@ void enetc_teardown_cbdr(struct enetc_cbdr *cbdr)
	cbdr->bd_base = NULL;
	cbdr->dma_dev = NULL;
}
EXPORT_SYMBOL_GPL(enetc_teardown_cbdr);

static void enetc_clean_cbdr(struct enetc_cbdr *ring)
{
@@ -127,6 +129,7 @@ int enetc_send_cmd(struct enetc_si *si, struct enetc_cbd *cbd)

	return 0;
}
EXPORT_SYMBOL_GPL(enetc_send_cmd);

int enetc_clear_mac_flt_entry(struct enetc_si *si, int index)
{
@@ -140,6 +143,7 @@ int enetc_clear_mac_flt_entry(struct enetc_si *si, int index)

	return enetc_send_cmd(si, &cbd);
}
EXPORT_SYMBOL_GPL(enetc_clear_mac_flt_entry);

int enetc_set_mac_flt_entry(struct enetc_si *si, int index,
			    char *mac_addr, int si_map)
@@ -165,6 +169,7 @@ int enetc_set_mac_flt_entry(struct enetc_si *si, int index,

	return enetc_send_cmd(si, &cbd);
}
EXPORT_SYMBOL_GPL(enetc_set_mac_flt_entry);

/* Set entry in RFS table */
int enetc_set_fs_entry(struct enetc_si *si, struct enetc_cmd_rfse *rfse,
@@ -197,6 +202,7 @@ int enetc_set_fs_entry(struct enetc_si *si, struct enetc_cmd_rfse *rfse,

	return err;
}
EXPORT_SYMBOL_GPL(enetc_set_fs_entry);

static int enetc_cmd_rss_table(struct enetc_si *si, u32 *table, int count,
			       bool read)
@@ -242,9 +248,11 @@ int enetc_get_rss_table(struct enetc_si *si, u32 *table, int count)
{
	return enetc_cmd_rss_table(si, table, count, true);
}
EXPORT_SYMBOL_GPL(enetc_get_rss_table);

/* Set RSS table */
int enetc_set_rss_table(struct enetc_si *si, const u32 *table, int count)
{
	return enetc_cmd_rss_table(si, (u32 *)table, count, false);
}
EXPORT_SYMBOL_GPL(enetc_set_rss_table);
Loading