[04/11] net/bnxt: fix double counting VLAN tags

Message ID 20190521213953.25425-5-ajit.khaparde@broadcom.com (mailing list archive)
State Superseded, 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

Ajit Khaparde May 21, 2019, 9:39 p.m. UTC
  From: Lance Richardson <lance.richardson@broadcom.com>

When determining whether scattered receive mode is needed, the
size of a QinQ header is being added to rxmode.max_rx_pkt_len
before comparing to the receive buffer size, however max_rx_pkt_len
already accounts for the QinQ header size. Fix by simply comparing
rxmode.max_rx_pkt_len against the buffer size.

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Maxime Coquelin May 23, 2019, 12:21 p.m. UTC | #1
On 5/21/19 11:39 PM, Ajit Khaparde wrote:
> From: Lance Richardson <lance.richardson@broadcom.com>
> 
> When determining whether scattered receive mode is needed, the
> size of a QinQ header is being added to rxmode.max_rx_pkt_len
> before comparing to the receive buffer size, however max_rx_pkt_len
> already accounts for the QinQ header size. Fix by simply comparing
> rxmode.max_rx_pkt_len against the buffer size.
> 
> Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>   drivers/net/bnxt/bnxt_ethdev.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 064a153ec..52a6b94e0 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -638,8 +638,7 @@ static int bnxt_scattered_rx(struct rte_eth_dev *eth_dev)
>   
>   		buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rxq->mb_pool) -
>   				      RTE_PKTMBUF_HEADROOM);
> -		if (eth_dev->data->dev_conf.rxmode.max_rx_pkt_len +
> -		    VLAN_TAG_SIZE * BNXT_NUM_VLANS > buf_size)
> +		if (eth_dev->data->dev_conf.rxmode.max_rx_pkt_len > buf_size)
>   			return 1;
>   	}
>   	return 0;
> 

Isn't it fixing patch 2?
If so, Fixes line is wrong, and it should be squashed directly into
patch 2.
  
Lance Richardson May 23, 2019, 6:53 p.m. UTC | #2
On Thu, May 23, 2019 at 8:21 AM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
...
> Isn't it fixing patch 2?
> If so, Fixes line is wrong, and it should be squashed directly into
> patch 2.

Yes... thanks, will fix in v2.

   Lance
  

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 064a153ec..52a6b94e0 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -638,8 +638,7 @@  static int bnxt_scattered_rx(struct rte_eth_dev *eth_dev)
 
 		buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rxq->mb_pool) -
 				      RTE_PKTMBUF_HEADROOM);
-		if (eth_dev->data->dev_conf.rxmode.max_rx_pkt_len +
-		    VLAN_TAG_SIZE * BNXT_NUM_VLANS > buf_size)
+		if (eth_dev->data->dev_conf.rxmode.max_rx_pkt_len > buf_size)
 			return 1;
 	}
 	return 0;