All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] sfc: complete the next packet when we receive a timestamp
@ 2020-02-19 14:08 Tom Zhao
  2020-02-19 19:06 ` David Miller
  2020-02-22 13:36   ` kbuild test robot
  0 siblings, 2 replies; 6+ messages in thread
From: Tom Zhao @ 2020-02-19 14:08 UTC (permalink / raw)
  To: davem, netdev, linux-net-drivers

We now ignore the "completion" event when using tx queue timestamping, and only
pay attention to the two (high and low) timestamp events. The NIC will send a
pair of timestamp events for every packet transmitted. The current firmware may
merge the completion events, and it is possible that future versions may
reorder the completion and timestamp events. As such the completion event is
not useful.

Without this patch in place a merged completion event on a queue with
timestamping will cause a "spurious TX completion" error. This affects
SFN8000-series adapters.

Signed-off-by: Tom Zhao <tzhao@solarflare.com>
---
 drivers/net/ethernet/sfc/ef10.c       | 36 ++++++++++---------
 drivers/net/ethernet/sfc/efx.h        |  1 +
 drivers/net/ethernet/sfc/net_driver.h |  3 --
 drivers/net/ethernet/sfc/tx.c         | 68 +++++++++++++++++++++++++++++------
 4 files changed, 77 insertions(+), 31 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 4d9bbcc..984de5c 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -3713,11 +3713,24 @@ static u32 efx_ef10_extract_event_ts(efx_qword_t *event)
 	}
 
 	/* Transmit timestamps are only available for 8XXX series. They result
-	 * in three events per packet. These occur in order, and are:
-	 *  - the normal completion event
+	 * in up to three events per packet. These occur in order, and are:
+	 *  - the normal completion event (may be omitted)
 	 *  - the low part of the timestamp
 	 *  - the high part of the timestamp
 	 *
+	 * It's possible for multiple completion events to appear before the
+	 * corresponding timestamps. So we can for example get:
+	 *  COMP N
+	 *  COMP N+1
+	 *  TS_LO N
+	 *  TS_HI N
+	 *  TS_LO N+1
+	 *  TS_HI N+1
+	 *
+	 * In addition it's also possible for the adjacent completions to be
+	 * merged, so we may not see COMP N above. As such, the completion
+	 * events are not very useful here.
+	 *
 	 * Each part of the timestamp is itself split across two 16 bit
 	 * fields in the event.
 	 */
@@ -3725,18 +3738,8 @@ static u32 efx_ef10_extract_event_ts(efx_qword_t *event)
 
 	switch (tx_ev_type) {
 	case TX_TIMESTAMP_EVENT_TX_EV_COMPLETION:
-		/* In case of Queue flush or FLR, we might have received
-		 * the previous TX completion event but not the Timestamp
-		 * events.
-		 */
-		if (tx_queue->completed_desc_ptr != tx_queue->ptr_mask)
-			efx_xmit_done(tx_queue, tx_queue->completed_desc_ptr);
-
-		tx_ev_desc_ptr = EFX_QWORD_FIELD(*event,
-						 ESF_DZ_TX_DESCR_INDX);
-		tx_queue->completed_desc_ptr =
-					tx_ev_desc_ptr & tx_queue->ptr_mask;
-		break;
+		/* Ignore this event - see above. */
+        break;
 
 	case TX_TIMESTAMP_EVENT_TX_EV_TSTAMP_LO:
 		ts_part = efx_ef10_extract_event_ts(event);
@@ -3747,9 +3750,8 @@ static u32 efx_ef10_extract_event_ts(efx_qword_t *event)
 		ts_part = efx_ef10_extract_event_ts(event);
 		tx_queue->completed_timestamp_major = ts_part;
 
-		efx_xmit_done(tx_queue, tx_queue->completed_desc_ptr);
-		tx_queue->completed_desc_ptr = tx_queue->ptr_mask;
-		break;
+		efx_xmit_done_single(tx_queue);
+        break;
 
 	default:
 		netif_err(efx, hw, efx->net_dev,
diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h
index 2dd8d50..dc1c375 100644
--- a/drivers/net/ethernet/sfc/efx.h
+++ b/drivers/net/ethernet/sfc/efx.h
@@ -24,6 +24,7 @@ netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb,
 				struct net_device *net_dev);
 netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb);
 void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index);
+void efx_xmit_done_single(struct efx_tx_queue *tx_queue);
 int efx_setup_tc(struct net_device *net_dev, enum tc_setup_type type,
 		 void *type_data);
 unsigned int efx_tx_max_skb_descs(struct efx_nic *efx);
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index dfd5182..d6e3115 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -207,8 +207,6 @@ struct efx_tx_buffer {
  *	avoid cache-line ping-pong between the xmit path and the
  *	completion path.
  * @merge_events: Number of TX merged completion events
- * @completed_desc_ptr: Most recent completed pointer - only used with
- *      timestamping.
  * @completed_timestamp_major: Top part of the most recent tx timestamp.
  * @completed_timestamp_minor: Low part of the most recent tx timestamp.
  * @insert_count: Current insert pointer
@@ -268,7 +266,6 @@ struct efx_tx_queue {
 	unsigned int merge_events;
 	unsigned int bytes_compl;
 	unsigned int pkts_compl;
-	unsigned int completed_desc_ptr;
 	u32 completed_timestamp_major;
 	u32 completed_timestamp_minor;
 
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 00c1c44..a23a3ca 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -687,6 +687,11 @@ int efx_xdp_tx_buffers(struct efx_nic *efx, int n, struct xdp_frame **xdpfs,
 	return i;
 }
 
+static bool efx_tx_buffer_in_use(struct efx_tx_buffer *buffer)
+{
+	return buffer->len || (buffer->flags & EFX_TX_BUF_OPTION);
+}
+
 /* Remove packets from the TX queue
  *
  * This removes packets from the TX queue, up to and including the
@@ -706,10 +711,9 @@ static void efx_dequeue_buffers(struct efx_tx_queue *tx_queue,
 	while (read_ptr != stop_index) {
 		struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr];
 
-		if (!(buffer->flags & EFX_TX_BUF_OPTION) &&
-		    unlikely(buffer->len == 0)) {
+		if (!efx_tx_buffer_in_use(buffer)) {
 			netif_err(efx, tx_err, efx->net_dev,
-				  "TX queue %d spurious TX completion id %x\n",
+				  "TX queue %d spurious TX completion id %d\n",
 				  tx_queue->queue, read_ptr);
 			efx_schedule_reset(efx, RESET_TYPE_TX_SKIP);
 			return;
@@ -835,6 +839,18 @@ int efx_setup_tc(struct net_device *net_dev, enum tc_setup_type type,
 	return 0;
 }
 
+static void efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue)
+{
+	if ((int)(tx_queue->read_count - tx_queue->old_write_count) >= 0) {
+		tx_queue->old_write_count = ACCESS_ONCE(tx_queue->write_count);
+		if (tx_queue->read_count == tx_queue->old_write_count) {
+			smp_mb();
+			tx_queue->empty_read_count =
+				tx_queue->read_count | EFX_EMPTY_COUNT_VALID;
+		}
+	}
+}
+
 void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
 {
 	unsigned fill_level;
@@ -866,15 +882,46 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
 			netif_tx_wake_queue(tx_queue->core_txq);
 	}
 
-	/* Check whether the hardware queue is now empty */
-	if ((int)(tx_queue->read_count - tx_queue->old_write_count) >= 0) {
-		tx_queue->old_write_count = READ_ONCE(tx_queue->write_count);
-		if (tx_queue->read_count == tx_queue->old_write_count) {
-			smp_mb();
-			tx_queue->empty_read_count =
-				tx_queue->read_count | EFX_EMPTY_COUNT_VALID;
+	efx_xmit_done_check_empty(tx_queue);
+}
+
+void efx_xmit_done_single(struct efx_tx_queue *tx_queue)
+{
+	unsigned int pkts_compl = 0, bytes_compl = 0;
+	unsigned int read_ptr;
+	bool finished = false;
+
+	read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
+
+	while (!finished) {
+		struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr];
+
+		if (!efx_tx_buffer_in_use(buffer)) {
+			struct efx_nic *efx = tx_queue->efx;
+
+			netif_err(efx, hw, efx->net_dev,
+				  "TX queue %d spurious single TX completion\n",
+				  tx_queue->queue);
+			atomic_inc(&efx->errors.spurious_tx);
+			efx_schedule_reset(efx, RESET_TYPE_TX_SKIP);
+			return;
 		}
+
+		/* Need to check the flag before dequeueing. */
+		if (buffer->flags & EFX_TX_BUF_SKB)
+			finished = true;
+		efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl);
+
+		++tx_queue->read_count;
+		read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
 	}
+
+	tx_queue->pkts_compl += pkts_compl;
+	tx_queue->bytes_compl += bytes_compl;
+
+	EFX_WARN_ON_PARANOID(pkts_compl != 1);
+
+	efx_xmit_done_check_empty(tx_queue);
 }
 
 static unsigned int efx_tx_cb_page_count(struct efx_tx_queue *tx_queue)
@@ -943,7 +990,6 @@ void efx_init_tx_queue(struct efx_tx_queue *tx_queue)
 	tx_queue->xmit_more_available = false;
 	tx_queue->timestamping = (efx_ptp_use_mac_tx_timestamps(efx) &&
 				  tx_queue->channel == efx_ptp_channel(efx));
-	tx_queue->completed_desc_ptr = tx_queue->ptr_mask;
 	tx_queue->completed_timestamp_major = 0;
 	tx_queue->completed_timestamp_minor = 0;
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] sfc: complete the next packet when we receive a timestamp
  2020-02-19 14:08 [PATCH net-next] sfc: complete the next packet when we receive a timestamp Tom Zhao
@ 2020-02-19 19:06 ` David Miller
  2020-02-22 13:36   ` kbuild test robot
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2020-02-19 19:06 UTC (permalink / raw)
  To: tzhao; +Cc: netdev, linux-net-drivers

From: Tom Zhao <tzhao@solarflare.com>
Date: Wed, 19 Feb 2020 14:08:37 +0000

> We now ignore the "completion" event when using tx queue timestamping, and only
> pay attention to the two (high and low) timestamp events. The NIC will send a
> pair of timestamp events for every packet transmitted. The current firmware may
> merge the completion events, and it is possible that future versions may
> reorder the completion and timestamp events. As such the completion event is
> not useful.
> 
> Without this patch in place a merged completion event on a queue with
> timestamping will cause a "spurious TX completion" error. This affects
> SFN8000-series adapters.
> 
> Signed-off-by: Tom Zhao <tzhao@solarflare.com>

This does not apply to net-next.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] sfc: complete the next packet when we receive a timestamp
  2020-02-19 14:08 [PATCH net-next] sfc: complete the next packet when we receive a timestamp Tom Zhao
@ 2020-02-22 13:36   ` kbuild test robot
  2020-02-22 13:36   ` kbuild test robot
  1 sibling, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2020-02-22 13:36 UTC (permalink / raw)
  To: Tom Zhao; +Cc: kbuild-all, davem, netdev, linux-net-drivers

[-- Attachment #1: Type: text/plain, Size: 4997 bytes --]

Hi Tom,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.5]
[cannot apply to net-next/master linus/master sparc-next/master ipvs/master v5.6-rc2 v5.6-rc1 next-20200221]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Tom-Zhao/sfc-complete-the-next-packet-when-we-receive-a-timestamp/20200221-083821
base:    d5226fa6dbae0569ee43ecfc08bdcd6770fc4755
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/ethernet/sfc/tx.c: In function 'efx_xmit_done_check_empty':
>> drivers/net/ethernet/sfc/tx.c:845:31: error: implicit declaration of function 'ACCESS_ONCE'; did you mean 'READ_ONCE'? [-Werror=implicit-function-declaration]
      tx_queue->old_write_count = ACCESS_ONCE(tx_queue->write_count);
                                  ^~~~~~~~~~~
                                  READ_ONCE
   drivers/net/ethernet/sfc/tx.c: In function 'efx_xmit_done_single':
>> drivers/net/ethernet/sfc/tx.c:905:19: error: 'struct efx_nic' has no member named 'errors'
       atomic_inc(&efx->errors.spurious_tx);
                      ^~
   cc1: some warnings being treated as errors

vim +845 drivers/net/ethernet/sfc/tx.c

   841	
   842	static void efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue)
   843	{
   844		if ((int)(tx_queue->read_count - tx_queue->old_write_count) >= 0) {
 > 845			tx_queue->old_write_count = ACCESS_ONCE(tx_queue->write_count);
   846			if (tx_queue->read_count == tx_queue->old_write_count) {
   847				smp_mb();
   848				tx_queue->empty_read_count =
   849					tx_queue->read_count | EFX_EMPTY_COUNT_VALID;
   850			}
   851		}
   852	}
   853	
   854	void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
   855	{
   856		unsigned fill_level;
   857		struct efx_nic *efx = tx_queue->efx;
   858		struct efx_tx_queue *txq2;
   859		unsigned int pkts_compl = 0, bytes_compl = 0;
   860	
   861		EFX_WARN_ON_ONCE_PARANOID(index > tx_queue->ptr_mask);
   862	
   863		efx_dequeue_buffers(tx_queue, index, &pkts_compl, &bytes_compl);
   864		tx_queue->pkts_compl += pkts_compl;
   865		tx_queue->bytes_compl += bytes_compl;
   866	
   867		if (pkts_compl > 1)
   868			++tx_queue->merge_events;
   869	
   870		/* See if we need to restart the netif queue.  This memory
   871		 * barrier ensures that we write read_count (inside
   872		 * efx_dequeue_buffers()) before reading the queue status.
   873		 */
   874		smp_mb();
   875		if (unlikely(netif_tx_queue_stopped(tx_queue->core_txq)) &&
   876		    likely(efx->port_enabled) &&
   877		    likely(netif_device_present(efx->net_dev))) {
   878			txq2 = efx_tx_queue_partner(tx_queue);
   879			fill_level = max(tx_queue->insert_count - tx_queue->read_count,
   880					 txq2->insert_count - txq2->read_count);
   881			if (fill_level <= efx->txq_wake_thresh)
   882				netif_tx_wake_queue(tx_queue->core_txq);
   883		}
   884	
   885		efx_xmit_done_check_empty(tx_queue);
   886	}
   887	
   888	void efx_xmit_done_single(struct efx_tx_queue *tx_queue)
   889	{
   890		unsigned int pkts_compl = 0, bytes_compl = 0;
   891		unsigned int read_ptr;
   892		bool finished = false;
   893	
   894		read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
   895	
   896		while (!finished) {
   897			struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr];
   898	
   899			if (!efx_tx_buffer_in_use(buffer)) {
   900				struct efx_nic *efx = tx_queue->efx;
   901	
   902				netif_err(efx, hw, efx->net_dev,
   903					  "TX queue %d spurious single TX completion\n",
   904					  tx_queue->queue);
 > 905				atomic_inc(&efx->errors.spurious_tx);
   906				efx_schedule_reset(efx, RESET_TYPE_TX_SKIP);
   907				return;
   908			}
   909	
   910			/* Need to check the flag before dequeueing. */
   911			if (buffer->flags & EFX_TX_BUF_SKB)
   912				finished = true;
   913			efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl);
   914	
   915			++tx_queue->read_count;
   916			read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
   917		}
   918	
   919		tx_queue->pkts_compl += pkts_compl;
   920		tx_queue->bytes_compl += bytes_compl;
   921	
   922		EFX_WARN_ON_PARANOID(pkts_compl != 1);
   923	
   924		efx_xmit_done_check_empty(tx_queue);
   925	}
   926	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 69423 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] sfc: complete the next packet when we receive a timestamp
@ 2020-02-22 13:36   ` kbuild test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2020-02-22 13:36 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5127 bytes --]

Hi Tom,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.5]
[cannot apply to net-next/master linus/master sparc-next/master ipvs/master v5.6-rc2 v5.6-rc1 next-20200221]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Tom-Zhao/sfc-complete-the-next-packet-when-we-receive-a-timestamp/20200221-083821
base:    d5226fa6dbae0569ee43ecfc08bdcd6770fc4755
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/ethernet/sfc/tx.c: In function 'efx_xmit_done_check_empty':
>> drivers/net/ethernet/sfc/tx.c:845:31: error: implicit declaration of function 'ACCESS_ONCE'; did you mean 'READ_ONCE'? [-Werror=implicit-function-declaration]
      tx_queue->old_write_count = ACCESS_ONCE(tx_queue->write_count);
                                  ^~~~~~~~~~~
                                  READ_ONCE
   drivers/net/ethernet/sfc/tx.c: In function 'efx_xmit_done_single':
>> drivers/net/ethernet/sfc/tx.c:905:19: error: 'struct efx_nic' has no member named 'errors'
       atomic_inc(&efx->errors.spurious_tx);
                      ^~
   cc1: some warnings being treated as errors

vim +845 drivers/net/ethernet/sfc/tx.c

   841	
   842	static void efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue)
   843	{
   844		if ((int)(tx_queue->read_count - tx_queue->old_write_count) >= 0) {
 > 845			tx_queue->old_write_count = ACCESS_ONCE(tx_queue->write_count);
   846			if (tx_queue->read_count == tx_queue->old_write_count) {
   847				smp_mb();
   848				tx_queue->empty_read_count =
   849					tx_queue->read_count | EFX_EMPTY_COUNT_VALID;
   850			}
   851		}
   852	}
   853	
   854	void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
   855	{
   856		unsigned fill_level;
   857		struct efx_nic *efx = tx_queue->efx;
   858		struct efx_tx_queue *txq2;
   859		unsigned int pkts_compl = 0, bytes_compl = 0;
   860	
   861		EFX_WARN_ON_ONCE_PARANOID(index > tx_queue->ptr_mask);
   862	
   863		efx_dequeue_buffers(tx_queue, index, &pkts_compl, &bytes_compl);
   864		tx_queue->pkts_compl += pkts_compl;
   865		tx_queue->bytes_compl += bytes_compl;
   866	
   867		if (pkts_compl > 1)
   868			++tx_queue->merge_events;
   869	
   870		/* See if we need to restart the netif queue.  This memory
   871		 * barrier ensures that we write read_count (inside
   872		 * efx_dequeue_buffers()) before reading the queue status.
   873		 */
   874		smp_mb();
   875		if (unlikely(netif_tx_queue_stopped(tx_queue->core_txq)) &&
   876		    likely(efx->port_enabled) &&
   877		    likely(netif_device_present(efx->net_dev))) {
   878			txq2 = efx_tx_queue_partner(tx_queue);
   879			fill_level = max(tx_queue->insert_count - tx_queue->read_count,
   880					 txq2->insert_count - txq2->read_count);
   881			if (fill_level <= efx->txq_wake_thresh)
   882				netif_tx_wake_queue(tx_queue->core_txq);
   883		}
   884	
   885		efx_xmit_done_check_empty(tx_queue);
   886	}
   887	
   888	void efx_xmit_done_single(struct efx_tx_queue *tx_queue)
   889	{
   890		unsigned int pkts_compl = 0, bytes_compl = 0;
   891		unsigned int read_ptr;
   892		bool finished = false;
   893	
   894		read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
   895	
   896		while (!finished) {
   897			struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr];
   898	
   899			if (!efx_tx_buffer_in_use(buffer)) {
   900				struct efx_nic *efx = tx_queue->efx;
   901	
   902				netif_err(efx, hw, efx->net_dev,
   903					  "TX queue %d spurious single TX completion\n",
   904					  tx_queue->queue);
 > 905				atomic_inc(&efx->errors.spurious_tx);
   906				efx_schedule_reset(efx, RESET_TYPE_TX_SKIP);
   907				return;
   908			}
   909	
   910			/* Need to check the flag before dequeueing. */
   911			if (buffer->flags & EFX_TX_BUF_SKB)
   912				finished = true;
   913			efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl);
   914	
   915			++tx_queue->read_count;
   916			read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
   917		}
   918	
   919		tx_queue->pkts_compl += pkts_compl;
   920		tx_queue->bytes_compl += bytes_compl;
   921	
   922		EFX_WARN_ON_PARANOID(pkts_compl != 1);
   923	
   924		efx_xmit_done_check_empty(tx_queue);
   925	}
   926	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 69423 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] sfc: complete the next packet when we receive a timestamp
  2020-02-22 13:36   ` kbuild test robot
@ 2020-02-24  9:41     ` Tom Zhao
  -1 siblings, 0 replies; 6+ messages in thread
From: Tom Zhao @ 2020-02-24  9:41 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, David Miller, Net Dev, linux-net-drivers

[-- Attachment #1: Type: text/plain, Size: 6287 bytes --]

Hi David,

Sorry I think I applied this to a stale repo. I will respin this when I get time.
________________________________________
From: kbuild test robot <lkp@intel.com>
Sent: 22 February 2020 13:36
To: Tom Zhao
Cc: kbuild-all@lists.01.org; David Miller; Net Dev; linux-net-drivers
Subject: Re: [PATCH net-next] sfc: complete the next packet when we receive a timestamp

Hi Tom,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.5]
[cannot apply to net-next/master linus/master sparc-next/master ipvs/master v5.6-rc2 v5.6-rc1 next-20200221]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Tom-Zhao/sfc-complete-the-next-packet-when-we-receive-a-timestamp/20200221-083821
base:    d5226fa6dbae0569ee43ecfc08bdcd6770fc4755
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/ethernet/sfc/tx.c: In function 'efx_xmit_done_check_empty':
>> drivers/net/ethernet/sfc/tx.c:845:31: error: implicit declaration of function 'ACCESS_ONCE'; did you mean 'READ_ONCE'? [-Werror=implicit-function-declaration]
      tx_queue->old_write_count = ACCESS_ONCE(tx_queue->write_count);
                                  ^~~~~~~~~~~
                                  READ_ONCE
   drivers/net/ethernet/sfc/tx.c: In function 'efx_xmit_done_single':
>> drivers/net/ethernet/sfc/tx.c:905:19: error: 'struct efx_nic' has no member named 'errors'
       atomic_inc(&efx->errors.spurious_tx);
                      ^~
   cc1: some warnings being treated as errors

vim +845 drivers/net/ethernet/sfc/tx.c

   841
   842  static void efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue)
   843  {
   844          if ((int)(tx_queue->read_count - tx_queue->old_write_count) >= 0) {
 > 845                  tx_queue->old_write_count = ACCESS_ONCE(tx_queue->write_count);
   846                  if (tx_queue->read_count == tx_queue->old_write_count) {
   847                          smp_mb();
   848                          tx_queue->empty_read_count =
   849                                  tx_queue->read_count | EFX_EMPTY_COUNT_VALID;
   850                  }
   851          }
   852  }
   853
   854  void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
   855  {
   856          unsigned fill_level;
   857          struct efx_nic *efx = tx_queue->efx;
   858          struct efx_tx_queue *txq2;
   859          unsigned int pkts_compl = 0, bytes_compl = 0;
   860
   861          EFX_WARN_ON_ONCE_PARANOID(index > tx_queue->ptr_mask);
   862
   863          efx_dequeue_buffers(tx_queue, index, &pkts_compl, &bytes_compl);
   864          tx_queue->pkts_compl += pkts_compl;
   865          tx_queue->bytes_compl += bytes_compl;
   866
   867          if (pkts_compl > 1)
   868                  ++tx_queue->merge_events;
   869
   870          /* See if we need to restart the netif queue.  This memory
   871           * barrier ensures that we write read_count (inside
   872           * efx_dequeue_buffers()) before reading the queue status.
   873           */
   874          smp_mb();
   875          if (unlikely(netif_tx_queue_stopped(tx_queue->core_txq)) &&
   876              likely(efx->port_enabled) &&
   877              likely(netif_device_present(efx->net_dev))) {
   878                  txq2 = efx_tx_queue_partner(tx_queue);
   879                  fill_level = max(tx_queue->insert_count - tx_queue->read_count,
   880                                   txq2->insert_count - txq2->read_count);
   881                  if (fill_level <= efx->txq_wake_thresh)
   882                          netif_tx_wake_queue(tx_queue->core_txq);
   883          }
   884
   885          efx_xmit_done_check_empty(tx_queue);
   886  }
   887
   888  void efx_xmit_done_single(struct efx_tx_queue *tx_queue)
   889  {
   890          unsigned int pkts_compl = 0, bytes_compl = 0;
   891          unsigned int read_ptr;
   892          bool finished = false;
   893
   894          read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
   895
   896          while (!finished) {
   897                  struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr];
   898
   899                  if (!efx_tx_buffer_in_use(buffer)) {
   900                          struct efx_nic *efx = tx_queue->efx;
   901
   902                          netif_err(efx, hw, efx->net_dev,
   903                                    "TX queue %d spurious single TX completion\n",
   904                                    tx_queue->queue);
 > 905                          atomic_inc(&efx->errors.spurious_tx);
   906                          efx_schedule_reset(efx, RESET_TYPE_TX_SKIP);
   907                          return;
   908                  }
   909
   910                  /* Need to check the flag before dequeueing. */
   911                  if (buffer->flags & EFX_TX_BUF_SKB)
   912                          finished = true;
   913                  efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl);
   914
   915                  ++tx_queue->read_count;
   916                  read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
   917          }
   918
   919          tx_queue->pkts_compl += pkts_compl;
   920          tx_queue->bytes_compl += bytes_compl;
   921
   922          EFX_WARN_ON_PARANOID(pkts_compl != 1);
   923
   924          efx_xmit_done_check_empty(tx_queue);
   925  }
   926

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 9411 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] sfc: complete the next packet when we receive a timestamp
@ 2020-02-24  9:41     ` Tom Zhao
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Zhao @ 2020-02-24  9:41 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6291 bytes --]

Hi David,

Sorry I think I applied this to a stale repo. I will respin this when I get time.
________________________________________
From: kbuild test robot <lkp@intel.com>
Sent: 22 February 2020 13:36
To: Tom Zhao
Cc: kbuild-all(a)lists.01.org; David Miller; Net Dev; linux-net-drivers
Subject: Re: [PATCH net-next] sfc: complete the next packet when we receive a timestamp

Hi Tom,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.5]
[cannot apply to net-next/master linus/master sparc-next/master ipvs/master v5.6-rc2 v5.6-rc1 next-20200221]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Tom-Zhao/sfc-complete-the-next-packet-when-we-receive-a-timestamp/20200221-083821
base:    d5226fa6dbae0569ee43ecfc08bdcd6770fc4755
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/ethernet/sfc/tx.c: In function 'efx_xmit_done_check_empty':
>> drivers/net/ethernet/sfc/tx.c:845:31: error: implicit declaration of function 'ACCESS_ONCE'; did you mean 'READ_ONCE'? [-Werror=implicit-function-declaration]
      tx_queue->old_write_count = ACCESS_ONCE(tx_queue->write_count);
                                  ^~~~~~~~~~~
                                  READ_ONCE
   drivers/net/ethernet/sfc/tx.c: In function 'efx_xmit_done_single':
>> drivers/net/ethernet/sfc/tx.c:905:19: error: 'struct efx_nic' has no member named 'errors'
       atomic_inc(&efx->errors.spurious_tx);
                      ^~
   cc1: some warnings being treated as errors

vim +845 drivers/net/ethernet/sfc/tx.c

   841
   842  static void efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue)
   843  {
   844          if ((int)(tx_queue->read_count - tx_queue->old_write_count) >= 0) {
 > 845                  tx_queue->old_write_count = ACCESS_ONCE(tx_queue->write_count);
   846                  if (tx_queue->read_count == tx_queue->old_write_count) {
   847                          smp_mb();
   848                          tx_queue->empty_read_count =
   849                                  tx_queue->read_count | EFX_EMPTY_COUNT_VALID;
   850                  }
   851          }
   852  }
   853
   854  void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
   855  {
   856          unsigned fill_level;
   857          struct efx_nic *efx = tx_queue->efx;
   858          struct efx_tx_queue *txq2;
   859          unsigned int pkts_compl = 0, bytes_compl = 0;
   860
   861          EFX_WARN_ON_ONCE_PARANOID(index > tx_queue->ptr_mask);
   862
   863          efx_dequeue_buffers(tx_queue, index, &pkts_compl, &bytes_compl);
   864          tx_queue->pkts_compl += pkts_compl;
   865          tx_queue->bytes_compl += bytes_compl;
   866
   867          if (pkts_compl > 1)
   868                  ++tx_queue->merge_events;
   869
   870          /* See if we need to restart the netif queue.  This memory
   871           * barrier ensures that we write read_count (inside
   872           * efx_dequeue_buffers()) before reading the queue status.
   873           */
   874          smp_mb();
   875          if (unlikely(netif_tx_queue_stopped(tx_queue->core_txq)) &&
   876              likely(efx->port_enabled) &&
   877              likely(netif_device_present(efx->net_dev))) {
   878                  txq2 = efx_tx_queue_partner(tx_queue);
   879                  fill_level = max(tx_queue->insert_count - tx_queue->read_count,
   880                                   txq2->insert_count - txq2->read_count);
   881                  if (fill_level <= efx->txq_wake_thresh)
   882                          netif_tx_wake_queue(tx_queue->core_txq);
   883          }
   884
   885          efx_xmit_done_check_empty(tx_queue);
   886  }
   887
   888  void efx_xmit_done_single(struct efx_tx_queue *tx_queue)
   889  {
   890          unsigned int pkts_compl = 0, bytes_compl = 0;
   891          unsigned int read_ptr;
   892          bool finished = false;
   893
   894          read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
   895
   896          while (!finished) {
   897                  struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr];
   898
   899                  if (!efx_tx_buffer_in_use(buffer)) {
   900                          struct efx_nic *efx = tx_queue->efx;
   901
   902                          netif_err(efx, hw, efx->net_dev,
   903                                    "TX queue %d spurious single TX completion\n",
   904                                    tx_queue->queue);
 > 905                          atomic_inc(&efx->errors.spurious_tx);
   906                          efx_schedule_reset(efx, RESET_TYPE_TX_SKIP);
   907                          return;
   908                  }
   909
   910                  /* Need to check the flag before dequeueing. */
   911                  if (buffer->flags & EFX_TX_BUF_SKB)
   912                          finished = true;
   913                  efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl);
   914
   915                  ++tx_queue->read_count;
   916                  read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
   917          }
   918
   919          tx_queue->pkts_compl += pkts_compl;
   920          tx_queue->bytes_compl += bytes_compl;
   921
   922          EFX_WARN_ON_PARANOID(pkts_compl != 1);
   923
   924          efx_xmit_done_check_empty(tx_queue);
   925  }
   926

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-02-24  9:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-19 14:08 [PATCH net-next] sfc: complete the next packet when we receive a timestamp Tom Zhao
2020-02-19 19:06 ` David Miller
2020-02-22 13:36 ` kbuild test robot
2020-02-22 13:36   ` kbuild test robot
2020-02-24  9:41   ` Tom Zhao
2020-02-24  9:41     ` Tom Zhao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.