net/qede: only access sw rx ring index for debug

Message ID 1569583729-19851-1-git-send-email-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series net/qede: only access sw rx ring index for debug |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-dpdk_compile_spdk success Compile Testing PASS
ci/iol-dpdk_compile_ovs success Compile Testing PASS
ci/iol-dpdk_compile success Compile Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

David Marchand Sept. 27, 2019, 11:28 a.m. UTC
  Caught by clang, this idx value is only used for a debug message when
the mbufs allocation fails.
No need to use idx as a temporary storage.

Fixes: 8f2312474529 ("net/qede: fix performance bottleneck in Rx path")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/qede/qede_rxtx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Jerin Jacob Oct. 3, 2019, 2:39 p.m. UTC | #1
On Fri, Sep 27, 2019 at 4:59 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> Caught by clang, this idx value is only used for a debug message when
> the mbufs allocation fails.
> No need to use idx as a temporary storage.
>
> Fixes: 8f2312474529 ("net/qede: fix performance bottleneck in Rx path")
> Cc: stable@dpdk.org

Rasesh, Shahed,

Please review this patch.

>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  drivers/net/qede/qede_rxtx.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
> index c38cbb9..1fbeba2 100644
> --- a/drivers/net/qede/qede_rxtx.c
> +++ b/drivers/net/qede/qede_rxtx.c
> @@ -46,8 +46,6 @@ static inline int qede_alloc_rx_bulk_mbufs(struct qede_rx_queue *rxq, int count)
>         int i, ret = 0;
>         uint16_t idx;
>
> -       idx = rxq->sw_rx_prod & NUM_RX_BDS(rxq);
> -
>         if (count > QEDE_MAX_BULK_ALLOC_COUNT)
>                 count = QEDE_MAX_BULK_ALLOC_COUNT;
>
> @@ -56,7 +54,9 @@ static inline int qede_alloc_rx_bulk_mbufs(struct qede_rx_queue *rxq, int count)
>                 PMD_RX_LOG(ERR, rxq,
>                            "Failed to allocate %d rx buffers "
>                             "sw_rx_prod %u sw_rx_cons %u mp entries %u free %u",
> -                           count, idx, rxq->sw_rx_cons & NUM_RX_BDS(rxq),
> +                           count,
> +                           rxq->sw_rx_prod & NUM_RX_BDS(rxq),
> +                           rxq->sw_rx_cons & NUM_RX_BDS(rxq),
>                             rte_mempool_avail_count(rxq->mb_pool),
>                             rte_mempool_in_use_count(rxq->mb_pool));
>                 return -ENOMEM;
> --
> 1.8.3.1
>
  
Rasesh Mody Oct. 3, 2019, 6:30 p.m. UTC | #2
>From: dev <dev-bounces@dpdk.org> On Behalf Of Jerin Jacob
>Sent: Thursday, October 03, 2019 7:40 AM
>
>On Fri, Sep 27, 2019 at 4:59 PM David Marchand
><david.marchand@redhat.com> wrote:
>>
>> Caught by clang, this idx value is only used for a debug message when
>> the mbufs allocation fails.
>> No need to use idx as a temporary storage.
>>
>> Fixes: 8f2312474529 ("net/qede: fix performance bottleneck in Rx
>> path")
>> Cc: stable@dpdk.org
>
>Rasesh, Shahed,
>
>Please review this patch.

Acked.

Thanks!
-Rasesh
>
>>
>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>> ---
>>  drivers/net/qede/qede_rxtx.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/qede/qede_rxtx.c
>> b/drivers/net/qede/qede_rxtx.c index c38cbb9..1fbeba2 100644
>> --- a/drivers/net/qede/qede_rxtx.c
>> +++ b/drivers/net/qede/qede_rxtx.c
>> @@ -46,8 +46,6 @@ static inline int qede_alloc_rx_bulk_mbufs(struct
>qede_rx_queue *rxq, int count)
>>         int i, ret = 0;
>>         uint16_t idx;
>>
>> -       idx = rxq->sw_rx_prod & NUM_RX_BDS(rxq);
>> -
>>         if (count > QEDE_MAX_BULK_ALLOC_COUNT)
>>                 count = QEDE_MAX_BULK_ALLOC_COUNT;
>>
>> @@ -56,7 +54,9 @@ static inline int qede_alloc_rx_bulk_mbufs(struct
>qede_rx_queue *rxq, int count)
>>                 PMD_RX_LOG(ERR, rxq,
>>                            "Failed to allocate %d rx buffers "
>>                             "sw_rx_prod %u sw_rx_cons %u mp entries %u free %u",
>> -                           count, idx, rxq->sw_rx_cons & NUM_RX_BDS(rxq),
>> +                           count,
>> +                           rxq->sw_rx_prod & NUM_RX_BDS(rxq),
>> +                           rxq->sw_rx_cons & NUM_RX_BDS(rxq),
>>                             rte_mempool_avail_count(rxq->mb_pool),
>>                             rte_mempool_in_use_count(rxq->mb_pool));
>>                 return -ENOMEM;
>> --
>> 1.8.3.1
>>
  

Patch

diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index c38cbb9..1fbeba2 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -46,8 +46,6 @@  static inline int qede_alloc_rx_bulk_mbufs(struct qede_rx_queue *rxq, int count)
 	int i, ret = 0;
 	uint16_t idx;
 
-	idx = rxq->sw_rx_prod & NUM_RX_BDS(rxq);
-
 	if (count > QEDE_MAX_BULK_ALLOC_COUNT)
 		count = QEDE_MAX_BULK_ALLOC_COUNT;
 
@@ -56,7 +54,9 @@  static inline int qede_alloc_rx_bulk_mbufs(struct qede_rx_queue *rxq, int count)
 		PMD_RX_LOG(ERR, rxq,
 			   "Failed to allocate %d rx buffers "
 			    "sw_rx_prod %u sw_rx_cons %u mp entries %u free %u",
-			    count, idx, rxq->sw_rx_cons & NUM_RX_BDS(rxq),
+			    count,
+			    rxq->sw_rx_prod & NUM_RX_BDS(rxq),
+			    rxq->sw_rx_cons & NUM_RX_BDS(rxq),
 			    rte_mempool_avail_count(rxq->mb_pool),
 			    rte_mempool_in_use_count(rxq->mb_pool));
 		return -ENOMEM;