[dpdk-dev] vmxnet3: replenish ring buffers in rx processing

Message ID 20170825152211.10911-1-dharton@cisco.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

David Harton Aug. 25, 2017, 3:22 p.m. UTC
  vmxnet3 rx processing should replenish ring buffers after new buffers
are available to prevent the interface from getting stuck in a state
that no new work is processed.

Signed-off-by: David Harton <dharton@cisco.com>
---
 drivers/net/vmxnet3/vmxnet3_rxtx.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Comments

Wiles, Keith Aug. 25, 2017, 3:41 p.m. UTC | #1
> On Aug 25, 2017, at 10:22 AM, David Harton <dharton@cisco.com> wrote:
> 
> vmxnet3 rx processing should replenish ring buffers after new buffers
> are available to prevent the interface from getting stuck in a state
> that no new work is processed.
> 
> Signed-off-by: David Harton <dharton@cisco.com>
> ---
> drivers/net/vmxnet3/vmxnet3_rxtx.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> index d9cf437..9861d35 100644
> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> @@ -880,6 +880,23 @@
> 		}
> 	}
> 
> +	if (unlikely(nb_rxd == 0)) {
> +		uint32_t avail;
> +		for (ring_idx = 0; ring_idx < VMXNET3_RX_CMDRING_SIZE; ring_idx++) {
> +			avail = vmxnet3_cmd_ring_desc_avail(&rxq->cmd_ring[ring_idx]);
> +			if (unlikely(avail > 0)) {
> +				/* try to alloc new buf and renew descriptors */
> +				vmxnet3_post_rx_bufs(rxq, ring_idx);
> +			}
> +		}
> +		if (unlikely(rxq->shared->ctrl.updateRxProd)) {
> +			for (ring_idx = 0; ring_idx < VMXNET3_RX_CMDRING_SIZE; ring_idx++) {
> +				VMXNET3_WRITE_BAR0_REG(hw, rxprod_reg[ring_idx] + (rxq->queue_id * VMXNET3_REG_ALIGN),

Did you run checkpatch here as it seems the line length is greater then 80.

BTW, I think requirements of 80 and tab length of 8, is a bit outdated in 2017 :-(

> +						       rxq->cmd_ring[ring_idx].next2fill);
> +			}
> +		}
> +	}
> +
> 	return nb_rx;
> }
> 
> -- 
> 1.8.3.1
> 

Regards,
Keith
  
David Harton Aug. 25, 2017, 3:51 p.m. UTC | #2
> -----Original Message-----
> From: Wiles, Keith [mailto:keith.wiles@intel.com]
> Sent: Friday, August 25, 2017 11:41 AM
> To: David Harton (dharton) <dharton@cisco.com>
> Cc: skhare@vmware.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] vmxnet3: replenish ring buffers in rx
> processing
> 
> 
> > On Aug 25, 2017, at 10:22 AM, David Harton <dharton@cisco.com> wrote:
> >
> > vmxnet3 rx processing should replenish ring buffers after new buffers
> > are available to prevent the interface from getting stuck in a state
> > that no new work is processed.
> >
> > Signed-off-by: David Harton <dharton@cisco.com>
> > ---
> > drivers/net/vmxnet3/vmxnet3_rxtx.c | 17 +++++++++++++++++
> > 1 file changed, 17 insertions(+)
> >
> > diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c
> > b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> > index d9cf437..9861d35 100644
> > --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
> > +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> > @@ -880,6 +880,23 @@
> > 		}
> > 	}
> >
> > +	if (unlikely(nb_rxd == 0)) {
> > +		uint32_t avail;
> > +		for (ring_idx = 0; ring_idx < VMXNET3_RX_CMDRING_SIZE;
> ring_idx++) {
> > +			avail = vmxnet3_cmd_ring_desc_avail(&rxq-
> >cmd_ring[ring_idx]);
> > +			if (unlikely(avail > 0)) {
> > +				/* try to alloc new buf and renew descriptors */
> > +				vmxnet3_post_rx_bufs(rxq, ring_idx);
> > +			}
> > +		}
> > +		if (unlikely(rxq->shared->ctrl.updateRxProd)) {
> > +			for (ring_idx = 0; ring_idx < VMXNET3_RX_CMDRING_SIZE;
> ring_idx++) {
> > +				VMXNET3_WRITE_BAR0_REG(hw, rxprod_reg[ring_idx] +
> (rxq->queue_id
> > +* VMXNET3_REG_ALIGN),
> 
> Did you run checkpatch here as it seems the line length is greater then
> 80.

I did.  I'm following the conventions already established in the file.
Several lines above the file are > 80 characters.  In fact, some just a few lines above these diffs.

Are you asking me to deviate from the established code convention?

Thanks,
Dave

> 
> BTW, I think requirements of 80 and tab length of 8, is a bit outdated in
> 2017 :-(
> 
> > +						       rxq-
> >cmd_ring[ring_idx].next2fill);
> > +			}
> > +		}
> > +	}
> > +
> > 	return nb_rx;
> > }
> >
> > --
> > 1.8.3.1
> >
> 
> Regards,
> Keith
  
Wiles, Keith Aug. 25, 2017, 3:57 p.m. UTC | #3
> On Aug 25, 2017, at 10:51 AM, David Harton (dharton) <dharton@cisco.com> wrote:
> 
> 
> 
>> -----Original Message-----
>> From: Wiles, Keith [mailto:keith.wiles@intel.com]
>> Sent: Friday, August 25, 2017 11:41 AM
>> To: David Harton (dharton) <dharton@cisco.com>
>> Cc: skhare@vmware.com; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH] vmxnet3: replenish ring buffers in rx
>> processing
>> 
>> 
>>> On Aug 25, 2017, at 10:22 AM, David Harton <dharton@cisco.com> wrote:
>>> 
>>> vmxnet3 rx processing should replenish ring buffers after new buffers
>>> are available to prevent the interface from getting stuck in a state
>>> that no new work is processed.
>>> 
>>> Signed-off-by: David Harton <dharton@cisco.com>
>>> ---
>>> drivers/net/vmxnet3/vmxnet3_rxtx.c | 17 +++++++++++++++++
>>> 1 file changed, 17 insertions(+)
>>> 
>>> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c
>>> b/drivers/net/vmxnet3/vmxnet3_rxtx.c
>>> index d9cf437..9861d35 100644
>>> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
>>> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
>>> @@ -880,6 +880,23 @@
>>> 		}
>>> 	}
>>> 
>>> +	if (unlikely(nb_rxd == 0)) {
>>> +		uint32_t avail;
>>> +		for (ring_idx = 0; ring_idx < VMXNET3_RX_CMDRING_SIZE;
>> ring_idx++) {
>>> +			avail = vmxnet3_cmd_ring_desc_avail(&rxq-
>>> cmd_ring[ring_idx]);
>>> +			if (unlikely(avail > 0)) {
>>> +				/* try to alloc new buf and renew descriptors */
>>> +				vmxnet3_post_rx_bufs(rxq, ring_idx);
>>> +			}
>>> +		}
>>> +		if (unlikely(rxq->shared->ctrl.updateRxProd)) {
>>> +			for (ring_idx = 0; ring_idx < VMXNET3_RX_CMDRING_SIZE;
>> ring_idx++) {
>>> +				VMXNET3_WRITE_BAR0_REG(hw, rxprod_reg[ring_idx] +
>> (rxq->queue_id
>>> +* VMXNET3_REG_ALIGN),
>> 
>> Did you run checkpatch here as it seems the line length is greater then
>> 80.
> 
> I did.  I'm following the conventions already established in the file.
> Several lines above the file are > 80 characters.  In fact, some just a few lines above these diffs.
> 
> Are you asking me to deviate from the established code convention?

If that is the existing convention in the file, then no.

> 
> Thanks,
> Dave
> 
>> 
>> BTW, I think requirements of 80 and tab length of 8, is a bit outdated in
>> 2017 :-(
>> 
>>> +						       rxq-
>>> cmd_ring[ring_idx].next2fill);
>>> +			}
>>> +		}
>>> +	}
>>> +
>>> 	return nb_rx;
>>> }
>>> 
>>> --
>>> 1.8.3.1
>>> 
>> 
>> Regards,
>> Keith

Regards,
Keith
  
Shrikrishna Khare Sept. 10, 2017, 4:47 p.m. UTC | #4
On Fri, 25 Aug 2017, David Harton wrote:

> vmxnet3 rx processing should replenish ring buffers after new buffers
> are available to prevent the interface from getting stuck in a state
> that no new work is processed.
> 
> Signed-off-by: David Harton <dharton@cisco.com>

Thanks for the fix.

Acked-by: Shrikrishna Khare <skhare@vmware.com>

> ---
>  drivers/net/vmxnet3/vmxnet3_rxtx.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> index d9cf437..9861d35 100644
> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> @@ -880,6 +880,23 @@
>  		}
>  	}
>  
> +	if (unlikely(nb_rxd == 0)) {
> +		uint32_t avail;
> +		for (ring_idx = 0; ring_idx < VMXNET3_RX_CMDRING_SIZE; ring_idx++) {
> +			avail = vmxnet3_cmd_ring_desc_avail(&rxq->cmd_ring[ring_idx]);
> +			if (unlikely(avail > 0)) {
> +				/* try to alloc new buf and renew descriptors */
> +				vmxnet3_post_rx_bufs(rxq, ring_idx);
> +			}
> +		}
> +		if (unlikely(rxq->shared->ctrl.updateRxProd)) {
> +			for (ring_idx = 0; ring_idx < VMXNET3_RX_CMDRING_SIZE; ring_idx++) {
> +				VMXNET3_WRITE_BAR0_REG(hw, rxprod_reg[ring_idx] + (rxq->queue_id * VMXNET3_REG_ALIGN),
> +						       rxq->cmd_ring[ring_idx].next2fill);
> +			}
> +		}
> +	}
> +
>  	return nb_rx;
>  }
>  
> -- 
> 1.8.3.1
> 
>
  
Ferruh Yigit Sept. 11, 2017, 1:19 p.m. UTC | #5
On 9/10/2017 5:47 PM, Shrikrishna Khare wrote:
> 
> 
> On Fri, 25 Aug 2017, David Harton wrote:
> 
>> vmxnet3 rx processing should replenish ring buffers after new buffers
>> are available to prevent the interface from getting stuck in a state
>> that no new work is processed.
>>
>> Signed-off-by: David Harton <dharton@cisco.com>
> 
> Thanks for the fix.
> 
> Acked-by: Shrikrishna Khare <skhare@vmware.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index d9cf437..9861d35 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -880,6 +880,23 @@ 
 		}
 	}
 
+	if (unlikely(nb_rxd == 0)) {
+		uint32_t avail;
+		for (ring_idx = 0; ring_idx < VMXNET3_RX_CMDRING_SIZE; ring_idx++) {
+			avail = vmxnet3_cmd_ring_desc_avail(&rxq->cmd_ring[ring_idx]);
+			if (unlikely(avail > 0)) {
+				/* try to alloc new buf and renew descriptors */
+				vmxnet3_post_rx_bufs(rxq, ring_idx);
+			}
+		}
+		if (unlikely(rxq->shared->ctrl.updateRxProd)) {
+			for (ring_idx = 0; ring_idx < VMXNET3_RX_CMDRING_SIZE; ring_idx++) {
+				VMXNET3_WRITE_BAR0_REG(hw, rxprod_reg[ring_idx] + (rxq->queue_id * VMXNET3_REG_ALIGN),
+						       rxq->cmd_ring[ring_idx].next2fill);
+			}
+		}
+	}
+
 	return nb_rx;
 }