[v2,01/10] net/bnxt: move tx bd checking to header file

Message ID 20190524144935.18765-2-lance.richardson@broadcom.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series bnxt patchset |

Checks

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

Commit Message

Lance Richardson May 24, 2019, 2:49 p.m. UTC
  To allow sharing of tx_bds_in_hw() and bnxt_tx_avail() between
vector-mode and non-vector transmit functions, move these functions
into bnxt_txr.h.

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/bnxt/bnxt_txr.c | 15 ---------------
 drivers/net/bnxt/bnxt_txr.h | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 15 deletions(-)
  

Comments

Ferruh Yigit May 27, 2019, 9:36 a.m. UTC | #1
On 5/24/2019 3:49 PM, Lance Richardson wrote:
> To allow sharing of tx_bds_in_hw() and bnxt_tx_avail() between
> vector-mode and non-vector transmit functions, move these functions
> into bnxt_txr.h.
> 
> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  drivers/net/bnxt/bnxt_txr.c | 15 ---------------
>  drivers/net/bnxt/bnxt_txr.h | 15 +++++++++++++++
>  2 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
> index 9de12e0d0..16598ba63 100644
> --- a/drivers/net/bnxt/bnxt_txr.c
> +++ b/drivers/net/bnxt/bnxt_txr.c
> @@ -103,21 +103,6 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
>  	return 0;
>  }
>  
> -static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq)
> -{
> -	return ((txq->tx_ring->tx_prod - txq->tx_ring->tx_cons) &
> -		txq->tx_ring->tx_ring_struct->ring_mask);
> -}

I can't find this function at all, am I doing something wrong?
Can you please confirm if this function is upstreamed at all?

$ git co v19.05
$ git grep bnxt_tx_bds_in_hw
$ echo $?
1
  
Ferruh Yigit May 27, 2019, 3:24 p.m. UTC | #2
On 5/27/2019 10:36 AM, Ferruh Yigit wrote:
> On 5/24/2019 3:49 PM, Lance Richardson wrote:
>> To allow sharing of tx_bds_in_hw() and bnxt_tx_avail() between
>> vector-mode and non-vector transmit functions, move these functions
>> into bnxt_txr.h.
>>
>> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
>> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
>> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> ---
>>  drivers/net/bnxt/bnxt_txr.c | 15 ---------------
>>  drivers/net/bnxt/bnxt_txr.h | 15 +++++++++++++++
>>  2 files changed, 15 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
>> index 9de12e0d0..16598ba63 100644
>> --- a/drivers/net/bnxt/bnxt_txr.c
>> +++ b/drivers/net/bnxt/bnxt_txr.c
>> @@ -103,21 +103,6 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
>>  	return 0;
>>  }
>>  
>> -static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq)
>> -{
>> -	return ((txq->tx_ring->tx_prod - txq->tx_ring->tx_cons) &
>> -		txq->tx_ring->tx_ring_struct->ring_mask);
>> -}
> 
> I can't find this function at all, am I doing something wrong?
> Can you please confirm if this function is upstreamed at all?
> 
> $ git co v19.05
> $ git grep bnxt_tx_bds_in_hw
> $ echo $?
> 1
> 

Ah, it is coming from "bnxt patchset for Tx performance optimization" patchset,
I will check it first.
(It is good to write dependency information clearly in the cover letter of the
patchset)
  
Lance Richardson May 27, 2019, 6:50 p.m. UTC | #3
Apologies for the confusion.

Regards,

   Lance

On Mon, May 27, 2019 at 11:24 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 5/27/2019 10:36 AM, Ferruh Yigit wrote:
> > On 5/24/2019 3:49 PM, Lance Richardson wrote:
> >> To allow sharing of tx_bds_in_hw() and bnxt_tx_avail() between
> >> vector-mode and non-vector transmit functions, move these functions
> >> into bnxt_txr.h.
> >>
> >> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> >> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> >> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> >> ---
> >>  drivers/net/bnxt/bnxt_txr.c | 15 ---------------
> >>  drivers/net/bnxt/bnxt_txr.h | 15 +++++++++++++++
> >>  2 files changed, 15 insertions(+), 15 deletions(-)
> >>
> >> diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
> >> index 9de12e0d0..16598ba63 100644
> >> --- a/drivers/net/bnxt/bnxt_txr.c
> >> +++ b/drivers/net/bnxt/bnxt_txr.c
> >> @@ -103,21 +103,6 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
> >>      return 0;
> >>  }
> >>
> >> -static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq)
> >> -{
> >> -    return ((txq->tx_ring->tx_prod - txq->tx_ring->tx_cons) &
> >> -            txq->tx_ring->tx_ring_struct->ring_mask);
> >> -}
> >
> > I can't find this function at all, am I doing something wrong?
> > Can you please confirm if this function is upstreamed at all?
> >
> > $ git co v19.05
> > $ git grep bnxt_tx_bds_in_hw
> > $ echo $?
> > 1
> >
>
> Ah, it is coming from "bnxt patchset for Tx performance optimization" patchset,
> I will check it first.
> (It is good to write dependency information clearly in the cover letter of the
> patchset)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 9de12e0d0..16598ba63 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -103,21 +103,6 @@  int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
 	return 0;
 }
 
-static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq)
-{
-	return ((txq->tx_ring->tx_prod - txq->tx_ring->tx_cons) &
-		txq->tx_ring->tx_ring_struct->ring_mask);
-}
-
-static inline uint32_t bnxt_tx_avail(struct bnxt_tx_queue *txq)
-{
-	/* Tell compiler to fetch tx indices from memory. */
-	rte_compiler_barrier();
-
-	return ((txq->tx_ring->tx_ring_struct->ring_size -
-		 bnxt_tx_bds_in_hw(txq)) - 1);
-}
-
 static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 				struct bnxt_tx_queue *txq,
 				uint16_t *coal_pkts,
diff --git a/drivers/net/bnxt/bnxt_txr.h b/drivers/net/bnxt/bnxt_txr.h
index f802d5080..13ca04676 100644
--- a/drivers/net/bnxt/bnxt_txr.h
+++ b/drivers/net/bnxt/bnxt_txr.h
@@ -37,6 +37,21 @@  struct bnxt_sw_tx_bd {
 	unsigned short		nr_bds;
 };
 
+static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq)
+{
+	return ((txq->tx_ring->tx_prod - txq->tx_ring->tx_cons) &
+		txq->tx_ring->tx_ring_struct->ring_mask);
+}
+
+static inline uint32_t bnxt_tx_avail(struct bnxt_tx_queue *txq)
+{
+	/* Tell compiler to fetch tx indices from memory. */
+	rte_compiler_barrier();
+
+	return ((txq->tx_ring->tx_ring_struct->ring_size -
+		 bnxt_tx_bds_in_hw(txq)) - 1);
+}
+
 void bnxt_free_tx_rings(struct bnxt *bp);
 int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq);
 int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id);