Subject: linux-next: manual merge of the net-next tree with the net tree

From: Stephen Rothwell <[email-masked]>
Date: Wed, 6 Dec 2023 11:03:06 +1100

Hi all,

Today's linux-next merge of the net-next tree got conflicts in:

  drivers/net/ethernet/stmicro/stmmac/dwmac5.c
  drivers/net/ethernet/stmicro/stmmac/dwmac5.h
  drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
  drivers/net/ethernet/stmicro/stmmac/hwif.h

between commit:

  37e4b8df27bc ("net: stmmac: fix FPE events losing")

from the net tree and commit:

  c3f3b97238f6 ("net: stmmac: Refactor EST implementation")

from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/net/ethernet/stmicro/stmmac/dwmac5.c
index 8fd167501fa0,ea92650f5c97..000000000000
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
@@@ -573,145 -573,7 +573,8 @@@ int dwmac5_flex_pps_config(void __iome
  	return 0;
  }
  
- static int dwmac5_est_write(void __iomem *ioaddr, u32 reg, u32 val, bool gcl)
- {
- 	u32 ctrl;
- 
- 	writel(val, ioaddr + MTL_EST_GCL_DATA);
- 
- 	ctrl = (reg << ADDR_SHIFT);
- 	ctrl |= gcl ? 0 : GCRR;
- 
- 	writel(ctrl, ioaddr + MTL_EST_GCL_CONTROL);
- 
- 	ctrl |= SRWO;
- 	writel(ctrl, ioaddr + MTL_EST_GCL_CONTROL);
- 
- 	return readl_poll_timeout(ioaddr + MTL_EST_GCL_CONTROL,
- 				  ctrl, !(ctrl & SRWO), 100, 5000);
- }
- 
- int dwmac5_est_configure(void __iomem *ioaddr, struct stmmac_est *cfg,
- 			 unsigned int ptp_rate)
- {
- 	int i, ret = 0x0;
- 	u32 ctrl;
- 
- 	ret |= dwmac5_est_write(ioaddr, BTR_LOW, cfg->btr[0], false);
- 	ret |= dwmac5_est_write(ioaddr, BTR_HIGH, cfg->btr[1], false);
- 	ret |= dwmac5_est_write(ioaddr, TER, cfg->ter, false);
- 	ret |= dwmac5_est_write(ioaddr, LLR, cfg->gcl_size, false);
- 	ret |= dwmac5_est_write(ioaddr, CTR_LOW, cfg->ctr[0], false);
- 	ret |= dwmac5_est_write(ioaddr, CTR_HIGH, cfg->ctr[1], false);
- 	if (ret)
- 		return ret;
- 
- 	for (i = 0; i < cfg->gcl_size; i++) {
- 		ret = dwmac5_est_write(ioaddr, i, cfg->gcl[i], true);
- 		if (ret)
- 			return ret;
- 	}
- 
- 	ctrl = readl(ioaddr + MTL_EST_CONTROL);
- 	ctrl &= ~PTOV;
- 	ctrl |= ((1000000000 / ptp_rate) * 6) << PTOV_SHIFT;
- 	if (cfg->enable)
- 		ctrl |= EEST | SSWL;
- 	else
- 		ctrl &= ~EEST;
- 
- 	writel(ctrl, ioaddr + MTL_EST_CONTROL);
- 
- 	/* Configure EST interrupt */
- 	if (cfg->enable)
- 		ctrl = (IECGCE | IEHS | IEHF | IEBE | IECC);
- 	else
- 		ctrl = 0;
- 
- 	writel(ctrl, ioaddr + MTL_EST_INT_EN);
- 
- 	return 0;
- }
- 
- void dwmac5_est_irq_status(void __iomem *ioaddr, struct net_device *dev,
- 			  struct stmmac_extra_stats *x, u32 txqcnt)
- {
- 	u32 status, value, feqn, hbfq, hbfs, btrl;
- 	u32 txqcnt_mask = (1 << txqcnt) - 1;
- 
- 	status = readl(ioaddr + MTL_EST_STATUS);
- 
- 	value = (CGCE | HLBS | HLBF | BTRE | SWLC);
- 
- 	/* Return if there is no error */
- 	if (!(status & value))
- 		return;
- 
- 	if (status & CGCE) {
- 		/* Clear Interrupt */
- 		writel(CGCE, ioaddr + MTL_EST_STATUS);
- 
- 		x->mtl_est_cgce++;
- 	}
- 
- 	if (status & HLBS) {
- 		value = readl(ioaddr + MTL_EST_SCH_ERR);
- 		value &= txqcnt_mask;
- 
- 		x->mtl_est_hlbs++;
- 
- 		/* Clear Interrupt */
- 		writel(value, ioaddr + MTL_EST_SCH_ERR);
- 
- 		/* Collecting info to shows all the queues that has HLBS
- 		 * issue. The only way to clear this is to clear the
- 		 * statistic
- 		 */
- 		if (net_ratelimit())
- 			netdev_err(dev, "EST: HLB(sched) Queue 0x%x\n", value);
- 	}
- 
- 	if (status & HLBF) {
- 		value = readl(ioaddr + MTL_EST_FRM_SZ_ERR);
- 		feqn = value & txqcnt_mask;
- 
- 		value = readl(ioaddr + MTL_EST_FRM_SZ_CAP);
- 		hbfq = (value & SZ_CAP_HBFQ_MASK(txqcnt)) >> SZ_CAP_HBFQ_SHIFT;
- 		hbfs = value & SZ_CAP_HBFS_MASK;
- 
- 		x->mtl_est_hlbf++;
- 
- 		/* Clear Interrupt */
- 		writel(feqn, ioaddr + MTL_EST_FRM_SZ_ERR);
- 
- 		if (net_ratelimit())
- 			netdev_err(dev, "EST: HLB(size) Queue %u Size %u\n",
- 				   hbfq, hbfs);
- 	}
- 
- 	if (status & BTRE) {
- 		if ((status & BTRL) == BTRL_MAX)
- 			x->mtl_est_btrlm++;
- 		else
- 			x->mtl_est_btre++;
- 
- 		btrl = (status & BTRL) >> BTRL_SHIFT;
- 
- 		if (net_ratelimit())
- 			netdev_info(dev, "EST: BTR Error Loop Count %u\n",
- 				    btrl);
- 
- 		writel(BTRE, ioaddr + MTL_EST_STATUS);
- 	}
- 
- 	if (status & SWLC) {
- 		writel(SWLC, ioaddr + MTL_EST_STATUS);
- 		netdev_info(dev, "EST: SWOL has been switched\n");
- 	}
- }
- 
 -void dwmac5_fpe_configure(void __iomem *ioaddr, u32 num_txq, u32 num_rxq,
 +void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
 +			  u32 num_txq, u32 num_rxq,
  			  bool enable)
  {
  	u32 value;
diff --cc drivers/net/ethernet/stmicro/stmmac/dwmac5.h
index 34e620790eb3,8b0f2c90faef..000000000000
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h
@@@ -149,15 -102,9 +102,11 @@@ int dwmac5_rxp_config(void __iomem *ioa
  int dwmac5_flex_pps_config(void __iomem *ioaddr, int index,
  			   struct stmmac_pps_cfg *cfg, bool enable,
  			   u32 sub_second_inc, u32 systime_flags);
- int dwmac5_est_configure(void __iomem *ioaddr, struct stmmac_est *cfg,
- 			 unsigned int ptp_rate);
- void dwmac5_est_irq_status(void __iomem *ioaddr, struct net_device *dev,
- 			   struct stmmac_extra_stats *x, u32 txqcnt);
 -void dwmac5_fpe_configure(void __iomem *ioaddr, u32 num_txq, u32 num_rxq,
 +void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
 +			  u32 num_txq, u32 num_rxq,
  			  bool enable);
  void dwmac5_fpe_send_mpacket(void __iomem *ioaddr,
 +			     struct stmmac_fpe_cfg *cfg,
  			     enum stmmac_mpacket_type type);
  int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev);
  
diff --cc drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index a74e71db79f9,f33f73de5cfe..000000000000
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@@ -1433,59 -1433,7 +1433,8 @@@ static void dwxgmac2_set_arp_offload(st
  	writel(value, ioaddr + XGMAC_RX_CONFIG);
  }
  
- static int dwxgmac3_est_write(void __iomem *ioaddr, u32 reg, u32 val, bool gcl)
- {
- 	u32 ctrl;
- 
- 	writel(val, ioaddr + XGMAC_MTL_EST_GCL_DATA);
- 
- 	ctrl = (reg << XGMAC_ADDR_SHIFT);
- 	ctrl |= gcl ? 0 : XGMAC_GCRR;
- 
- 	writel(ctrl, ioaddr + XGMAC_MTL_EST_GCL_CONTROL);
- 
- 	ctrl |= XGMAC_SRWO;
- 	writel(ctrl, ioaddr + XGMAC_MTL_EST_GCL_CONTROL);
- 
- 	return readl_poll_timeout_atomic(ioaddr + XGMAC_MTL_EST_GCL_CONTROL,
- 					 ctrl, !(ctrl & XGMAC_SRWO), 100, 5000);
- }
- 
- static int dwxgmac3_est_configure(void __iomem *ioaddr, struct stmmac_est *cfg,
- 				  unsigned int ptp_rate)
- {
- 	int i, ret = 0x0;
- 	u32 ctrl;
- 
- 	ret |= dwxgmac3_est_write(ioaddr, XGMAC_BTR_LOW, cfg->btr[0], false);
- 	ret |= dwxgmac3_est_write(ioaddr, XGMAC_BTR_HIGH, cfg->btr[1], false);
- 	ret |= dwxgmac3_est_write(ioaddr, XGMAC_TER, cfg->ter, false);
- 	ret |= dwxgmac3_est_write(ioaddr, XGMAC_LLR, cfg->gcl_size, false);
- 	ret |= dwxgmac3_est_write(ioaddr, XGMAC_CTR_LOW, cfg->ctr[0], false);
- 	ret |= dwxgmac3_est_write(ioaddr, XGMAC_CTR_HIGH, cfg->ctr[1], false);
- 	if (ret)
- 		return ret;
- 
- 	for (i = 0; i < cfg->gcl_size; i++) {
- 		ret = dwxgmac3_est_write(ioaddr, i, cfg->gcl[i], true);
- 		if (ret)
- 			return ret;
- 	}
- 
- 	ctrl = readl(ioaddr + XGMAC_MTL_EST_CONTROL);
- 	ctrl &= ~XGMAC_PTOV;
- 	ctrl |= ((1000000000 / ptp_rate) * 9) << XGMAC_PTOV_SHIFT;
- 	if (cfg->enable)
- 		ctrl |= XGMAC_EEST | XGMAC_SSWL;
- 	else
- 		ctrl &= ~XGMAC_EEST;
- 
- 	writel(ctrl, ioaddr + XGMAC_MTL_EST_CONTROL);
- 	return 0;
- }
- 
 -static void dwxgmac3_fpe_configure(void __iomem *ioaddr, u32 num_txq,
 +static void dwxgmac3_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
 +				   u32 num_txq,
  				   u32 num_rxq, bool enable)
  {
  	u32 value;
diff --cc drivers/net/ethernet/stmicro/stmmac/hwif.h
index 68aa2d5ca6e5,72412d733856..000000000000
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
@@@ -408,15 -419,9 +419,11 @@@ struct stmmac_ops 
  				bool en, bool udp, bool sa, bool inv,
  				u32 match);
  	void (*set_arp_offload)(struct mac_device_info *hw, bool en, u32 addr);
- 	int (*est_configure)(void __iomem *ioaddr, struct stmmac_est *cfg,
- 			     unsigned int ptp_rate);
- 	void (*est_irq_status)(void __iomem *ioaddr, struct net_device *dev,
- 			       struct stmmac_extra_stats *x, u32 txqcnt);
 -	void (*fpe_configure)(void __iomem *ioaddr, u32 num_txq, u32 num_rxq,
 +	void (*fpe_configure)(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg,
 +			      u32 num_txq, u32 num_rxq,
  			      bool enable);
  	void (*fpe_send_mpacket)(void __iomem *ioaddr,
 +				 struct stmmac_fpe_cfg *cfg,
  				 enum stmmac_mpacket_type type);
  	int (*fpe_irq_status)(void __iomem *ioaddr, struct net_device *dev);
  };