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

From: Stephen Rothwell <[email-masked]>
Date: Mon, 23 May 2022 11:10:21 +1000

Hi all,

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

  drivers/net/ethernet/cadence/macb_main.c

between commit:

  5cebb40bc955 ("net: macb: Fix PTP one step sync support")

from the net tree and commit:

  138badbc21a0 ("net: macb: use NAPI for TX completion path")

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/cadence/macb_main.c
index 3a1b5ac48ca5,d6cdb97bfb38..000000000000
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@@ -1123,57 -1119,20 +1120,50 @@@ static void macb_tx_error_task(struct w
  	macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
  
  	spin_unlock_irqrestore(&bp->lock, flags);
+ 	napi_enable(&queue->napi_tx);
  }
  
 +static bool ptp_one_step_sync(struct sk_buff *skb)
 +{
 +	struct ptp_header *hdr;
 +	unsigned int ptp_class;
 +	u8 msgtype;
 +
 +	/* No need to parse packet if PTP TS is not involved */
 +	if (likely(!(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)))
 +		goto not_oss;
 +
 +	/* Identify and return whether PTP one step sync is being processed */
 +	ptp_class = ptp_classify_raw(skb);
 +	if (ptp_class == PTP_CLASS_NONE)
 +		goto not_oss;
 +
 +	hdr = ptp_parse_header(skb, ptp_class);
 +	if (!hdr)
 +		goto not_oss;
 +
 +	if (hdr->flag_field[0] & PTP_FLAG_TWOSTEP)
 +		goto not_oss;
 +
 +	msgtype = ptp_get_msgtype(hdr, ptp_class);
 +	if (msgtype == PTP_MSGTYPE_SYNC)
 +		return true;
 +
 +not_oss:
 +	return false;
 +}
 +
- static void macb_tx_interrupt(struct macb_queue *queue)
+ static int macb_tx_complete(struct macb_queue *queue, int budget)
  {
- 	unsigned int tail;
- 	unsigned int head;
- 	u32 status;
  	struct macb *bp = queue->bp;
  	u16 queue_index = queue - bp->queues;
+ 	unsigned int tail;
+ 	unsigned int head;
+ 	int packets = 0;
  
- 	status = macb_readl(bp, TSR);
- 	macb_writel(bp, TSR, status);
- 
- 	if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
- 		queue_writel(queue, ISR, MACB_BIT(TCOMP));
- 
- 	netdev_vdbg(bp->dev, "macb_tx_interrupt status = 0x%03lx\n",
- 		    (unsigned long)status);
- 
+ 	spin_lock(&queue->tx_ptr_lock);
  	head = queue->tx_head;
- 	for (tail = queue->tx_tail; tail != head; tail++) {
+ 	for (tail = queue->tx_tail; tail != head && packets < budget; tail++) {
  		struct macb_tx_skb	*tx_skb;
  		struct sk_buff		*skb;
  		struct macb_dma_desc	*desc;