DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/bnxt: switch to the new offload API
@ 2018-03-06 19:40 Ajit Khaparde
  2018-03-21 19:08 ` Ferruh Yigit
  0 siblings, 1 reply; 15+ messages in thread
From: Ajit Khaparde @ 2018-03-06 19:40 UTC (permalink / raw)
  To: dev

Update bnxt PMD to new ethdev offloads API.
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 59 +++++++++++++++++++++++++++++-------------
 1 file changed, 41 insertions(+), 18 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 21c46f833..cca4ef40c 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -146,6 +146,27 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 	ETH_RSS_NONFRAG_IPV6_TCP |	\
 	ETH_RSS_NONFRAG_IPV6_UDP)
 
+#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_VLAN_INSERT | \
+				     DEV_TX_OFFLOAD_IPV4_CKSUM | \
+				     DEV_TX_OFFLOAD_TCP_CKSUM | \
+				     DEV_TX_OFFLOAD_UDP_CKSUM | \
+				     DEV_TX_OFFLOAD_TCP_TSO | \
+				     DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | \
+				     DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \
+				     DEV_TX_OFFLOAD_GRE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_IPIP_TNL_TSO | \
+				     DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_MULTI_SEGS)
+
+#define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
+				     DEV_RX_OFFLOAD_VLAN_STRIP | \
+				     DEV_RX_OFFLOAD_IPV4_CKSUM | \
+				     DEV_RX_OFFLOAD_UDP_CKSUM | \
+				     DEV_RX_OFFLOAD_TCP_CKSUM | \
+				     DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
+				     DEV_RX_OFFLOAD_JUMBO_FRAME | \
+				     DEV_RX_OFFLOAD_CRC_STRIP)
+
 static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
 static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
 
@@ -430,21 +451,14 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->min_rx_bufsize = 1;
 	dev_info->max_rx_pktlen = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN
 				  + VLAN_TAG_SIZE;
-	dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
-					DEV_RX_OFFLOAD_IPV4_CKSUM |
-					DEV_RX_OFFLOAD_UDP_CKSUM |
-					DEV_RX_OFFLOAD_TCP_CKSUM |
-					DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
-	dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
-					DEV_TX_OFFLOAD_IPV4_CKSUM |
-					DEV_TX_OFFLOAD_TCP_CKSUM |
-					DEV_TX_OFFLOAD_UDP_CKSUM |
-					DEV_TX_OFFLOAD_TCP_TSO |
-					DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
-					DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
-					DEV_TX_OFFLOAD_GRE_TNL_TSO |
-					DEV_TX_OFFLOAD_IPIP_TNL_TSO |
-					DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
+
+	dev_info->rx_queue_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
+	dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
+	if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
+		dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP;
+	dev_info->tx_queue_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
+	dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
+	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
 	/* *INDENT-OFF* */
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
@@ -454,7 +468,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 			.wthresh = 0,
 		},
 		.rx_free_thresh = 32,
-		.rx_drop_en = 0,
+		/* If no descriptors available, pkts are dropped by default */
+		.rx_drop_en = 1,
 	};
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
@@ -465,8 +480,6 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 		},
 		.tx_free_thresh = 32,
 		.tx_rs_thresh = 32,
-		.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
-			     ETH_TXQ_FLAGS_NOOFFLOADS,
 	};
 	eth_dev->data->dev_conf.intr_conf.lsc = 1;
 
@@ -510,6 +523,16 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	uint64_t tx_offloads = eth_dev->data->dev_conf.txmode.offloads;
+	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
+
+	if (tx_offloads != BNXT_DEV_TX_OFFLOAD_SUPPORT)
+		PMD_DRV_LOG(ERR, "Tx offloads requested 0x%lx supported 0x%x\n",
+			    tx_offloads, BNXT_DEV_TX_OFFLOAD_SUPPORT);
+
+	if (rx_offloads != BNXT_DEV_RX_OFFLOAD_SUPPORT)
+		PMD_DRV_LOG(ERR, "Rx offloads requested 0x%lx supported 0x%x\n",
+			    rx_offloads, BNXT_DEV_RX_OFFLOAD_SUPPORT);
 
 	bp->rx_queues = (void *)eth_dev->data->rx_queues;
 	bp->tx_queues = (void *)eth_dev->data->tx_queues;
-- 
2.14.3 (Apple Git-98)

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

* Re: [dpdk-dev] [PATCH] net/bnxt: switch to the new offload API
  2018-03-06 19:40 [dpdk-dev] [PATCH] net/bnxt: switch to the new offload API Ajit Khaparde
@ 2018-03-21 19:08 ` Ferruh Yigit
  2018-03-21 19:27   ` Ajit Khaparde
  2018-03-26 22:47   ` [dpdk-dev] [PATCH v2] " Ajit Khaparde
  0 siblings, 2 replies; 15+ messages in thread
From: Ferruh Yigit @ 2018-03-21 19:08 UTC (permalink / raw)
  To: Ajit Khaparde, dev; +Cc: Shahaf Shuler

On 3/6/2018 7:40 PM, Ajit Khaparde wrote:
> Update bnxt PMD to new ethdev offloads API.
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 59 +++++++++++++++++++++++++++++-------------
>  1 file changed, 41 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 21c46f833..cca4ef40c 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -146,6 +146,27 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
>  	ETH_RSS_NONFRAG_IPV6_TCP |	\
>  	ETH_RSS_NONFRAG_IPV6_UDP)
>  
> +#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_VLAN_INSERT | \
> +				     DEV_TX_OFFLOAD_IPV4_CKSUM | \
> +				     DEV_TX_OFFLOAD_TCP_CKSUM | \
> +				     DEV_TX_OFFLOAD_UDP_CKSUM | \
> +				     DEV_TX_OFFLOAD_TCP_TSO | \
> +				     DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | \
> +				     DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \
> +				     DEV_TX_OFFLOAD_GRE_TNL_TSO | \
> +				     DEV_TX_OFFLOAD_IPIP_TNL_TSO | \
> +				     DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \
> +				     DEV_TX_OFFLOAD_MULTI_SEGS)
> +
> +#define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
> +				     DEV_RX_OFFLOAD_VLAN_STRIP | \
> +				     DEV_RX_OFFLOAD_IPV4_CKSUM | \
> +				     DEV_RX_OFFLOAD_UDP_CKSUM | \
> +				     DEV_RX_OFFLOAD_TCP_CKSUM | \
> +				     DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
> +				     DEV_RX_OFFLOAD_JUMBO_FRAME | \
> +				     DEV_RX_OFFLOAD_CRC_STRIP)
> +
>  static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
>  static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
>  
> @@ -430,21 +451,14 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
>  	dev_info->min_rx_bufsize = 1;
>  	dev_info->max_rx_pktlen = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN
>  				  + VLAN_TAG_SIZE;
> -	dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
> -					DEV_RX_OFFLOAD_IPV4_CKSUM |
> -					DEV_RX_OFFLOAD_UDP_CKSUM |
> -					DEV_RX_OFFLOAD_TCP_CKSUM |
> -					DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
> -	dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
> -					DEV_TX_OFFLOAD_IPV4_CKSUM |
> -					DEV_TX_OFFLOAD_TCP_CKSUM |
> -					DEV_TX_OFFLOAD_UDP_CKSUM |
> -					DEV_TX_OFFLOAD_TCP_TSO |
> -					DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
> -					DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
> -					DEV_TX_OFFLOAD_GRE_TNL_TSO |
> -					DEV_TX_OFFLOAD_IPIP_TNL_TSO |
> -					DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
> +
> +	dev_info->rx_queue_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;

Hi Ajit,

Is bnxt supports queue level offloads? If not PMD should return 0 as
rx_queue_offload_capa and tx_queue_offload_capa.

> +	dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
> +	if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
> +		dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP;
> +	dev_info->tx_queue_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
> +	dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
> +	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
>  
>  	/* *INDENT-OFF* */
>  	dev_info->default_rxconf = (struct rte_eth_rxconf) {
> @@ -454,7 +468,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
>  			.wthresh = 0,
>  		},
>  		.rx_free_thresh = 32,
> -		.rx_drop_en = 0,
> +		/* If no descriptors available, pkts are dropped by default */
> +		.rx_drop_en = 1,
>  	};
>  
>  	dev_info->default_txconf = (struct rte_eth_txconf) {
> @@ -465,8 +480,6 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
>  		},
>  		.tx_free_thresh = 32,
>  		.tx_rs_thresh = 32,
> -		.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
> -			     ETH_TXQ_FLAGS_NOOFFLOADS,
>  	};
>  	eth_dev->data->dev_conf.intr_conf.lsc = 1;
>  
> @@ -510,6 +523,16 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
>  static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
>  {
>  	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
> +	uint64_t tx_offloads = eth_dev->data->dev_conf.txmode.offloads;
> +	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
> +
> +	if (tx_offloads != BNXT_DEV_TX_OFFLOAD_SUPPORT)
> +		PMD_DRV_LOG(ERR, "Tx offloads requested 0x%lx supported 0x%x\n",
> +			    tx_offloads, BNXT_DEV_TX_OFFLOAD_SUPPORT);

Isn't is possible that application request only a subset of the supported offloads?

And should API return an error for this case?

> +
> +	if (rx_offloads != BNXT_DEV_RX_OFFLOAD_SUPPORT)
> +		PMD_DRV_LOG(ERR, "Rx offloads requested 0x%lx supported 0x%x\n",
> +			    rx_offloads, BNXT_DEV_RX_OFFLOAD_SUPPORT);
>  
>  	bp->rx_queues = (void *)eth_dev->data->rx_queues;
>  	bp->tx_queues = (void *)eth_dev->data->tx_queues;
> 

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

* Re: [dpdk-dev] [PATCH] net/bnxt: switch to the new offload API
  2018-03-21 19:08 ` Ferruh Yigit
@ 2018-03-21 19:27   ` Ajit Khaparde
  2018-03-22  6:22     ` Shahaf Shuler
  2018-03-26 22:47   ` [dpdk-dev] [PATCH v2] " Ajit Khaparde
  1 sibling, 1 reply; 15+ messages in thread
From: Ajit Khaparde @ 2018-03-21 19:27 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Shahaf Shuler

Hi Shahaf,
Well, the application could.
While we can't ignore the advantages of enabling the offloads.
I felt if we should really mandate applications to request all the
supported offloads?

Thanks
Ajit

On Wed, Mar 21, 2018 at 12:08 PM, Ferruh Yigit <ferruh.yigit@intel.com>
wrote:

> On 3/6/2018 7:40 PM, Ajit Khaparde wrote:
> > Update bnxt PMD to new ethdev offloads API.
> > Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> > ---
> >  drivers/net/bnxt/bnxt_ethdev.c | 59 +++++++++++++++++++++++++++++-
> ------------
> >  1 file changed, 41 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_
> ethdev.c
> > index 21c46f833..cca4ef40c 100644
> > --- a/drivers/net/bnxt/bnxt_ethdev.c
> > +++ b/drivers/net/bnxt/bnxt_ethdev.c
> > @@ -146,6 +146,27 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
> >       ETH_RSS_NONFRAG_IPV6_TCP |      \
> >       ETH_RSS_NONFRAG_IPV6_UDP)
> >
> > +#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_VLAN_INSERT | \
> > +                                  DEV_TX_OFFLOAD_IPV4_CKSUM | \
> > +                                  DEV_TX_OFFLOAD_TCP_CKSUM | \
> > +                                  DEV_TX_OFFLOAD_UDP_CKSUM | \
> > +                                  DEV_TX_OFFLOAD_TCP_TSO | \
> > +                                  DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | \
> > +                                  DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \
> > +                                  DEV_TX_OFFLOAD_GRE_TNL_TSO | \
> > +                                  DEV_TX_OFFLOAD_IPIP_TNL_TSO | \
> > +                                  DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \
> > +                                  DEV_TX_OFFLOAD_MULTI_SEGS)
> > +
> > +#define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
> > +                                  DEV_RX_OFFLOAD_VLAN_STRIP | \
> > +                                  DEV_RX_OFFLOAD_IPV4_CKSUM | \
> > +                                  DEV_RX_OFFLOAD_UDP_CKSUM | \
> > +                                  DEV_RX_OFFLOAD_TCP_CKSUM | \
> > +                                  DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
> > +                                  DEV_RX_OFFLOAD_JUMBO_FRAME | \
> > +                                  DEV_RX_OFFLOAD_CRC_STRIP)
> > +
> >  static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
> >  static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
> >
> > @@ -430,21 +451,14 @@ static void bnxt_dev_info_get_op(struct
> rte_eth_dev *eth_dev,
> >       dev_info->min_rx_bufsize = 1;
> >       dev_info->max_rx_pktlen = BNXT_MAX_MTU + ETHER_HDR_LEN +
> ETHER_CRC_LEN
> >                                 + VLAN_TAG_SIZE;
> > -     dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
> > -                                     DEV_RX_OFFLOAD_IPV4_CKSUM |
> > -                                     DEV_RX_OFFLOAD_UDP_CKSUM |
> > -                                     DEV_RX_OFFLOAD_TCP_CKSUM |
> > -                                     DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
> > -     dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
> > -                                     DEV_TX_OFFLOAD_IPV4_CKSUM |
> > -                                     DEV_TX_OFFLOAD_TCP_CKSUM |
> > -                                     DEV_TX_OFFLOAD_UDP_CKSUM |
> > -                                     DEV_TX_OFFLOAD_TCP_TSO |
> > -                                     DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
> > -                                     DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
> > -                                     DEV_TX_OFFLOAD_GRE_TNL_TSO |
> > -                                     DEV_TX_OFFLOAD_IPIP_TNL_TSO |
> > -                                     DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
> > +
> > +     dev_info->rx_queue_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
>
> Hi Ajit,
>
> Is bnxt supports queue level offloads? If not PMD should return 0 as
> rx_queue_offload_capa and tx_queue_offload_capa.
>
> > +     dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
> > +     if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
> > +             dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP;
> > +     dev_info->tx_queue_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
> > +     dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
> > +     dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
> >
> >       /* *INDENT-OFF* */
> >       dev_info->default_rxconf = (struct rte_eth_rxconf) {
> > @@ -454,7 +468,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev
> *eth_dev,
> >                       .wthresh = 0,
> >               },
> >               .rx_free_thresh = 32,
> > -             .rx_drop_en = 0,
> > +             /* If no descriptors available, pkts are dropped by
> default */
> > +             .rx_drop_en = 1,
> >       };
> >
> >       dev_info->default_txconf = (struct rte_eth_txconf) {
> > @@ -465,8 +480,6 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev
> *eth_dev,
> >               },
> >               .tx_free_thresh = 32,
> >               .tx_rs_thresh = 32,
> > -             .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
> > -                          ETH_TXQ_FLAGS_NOOFFLOADS,
> >       };
> >       eth_dev->data->dev_conf.intr_conf.lsc = 1;
> >
> > @@ -510,6 +523,16 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev
> *eth_dev,
> >  static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
> >  {
> >       struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
> > +     uint64_t tx_offloads = eth_dev->data->dev_conf.txmode.offloads;
> > +     uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
> > +
> > +     if (tx_offloads != BNXT_DEV_TX_OFFLOAD_SUPPORT)
> > +             PMD_DRV_LOG(ERR, "Tx offloads requested 0x%lx supported
> 0x%x\n",
> > +                         tx_offloads, BNXT_DEV_TX_OFFLOAD_SUPPORT);
>
> Isn't is possible that application request only a subset of the supported
> offloads?
>
> And should API return an error for this case?
>
> > +
> > +     if (rx_offloads != BNXT_DEV_RX_OFFLOAD_SUPPORT)
> > +             PMD_DRV_LOG(ERR, "Rx offloads requested 0x%lx supported
> 0x%x\n",
> > +                         rx_offloads, BNXT_DEV_RX_OFFLOAD_SUPPORT);
> >
> >       bp->rx_queues = (void *)eth_dev->data->rx_queues;
> >       bp->tx_queues = (void *)eth_dev->data->tx_queues;
> >
>
>

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

* Re: [dpdk-dev] [PATCH] net/bnxt: switch to the new offload API
  2018-03-21 19:27   ` Ajit Khaparde
@ 2018-03-22  6:22     ` Shahaf Shuler
  0 siblings, 0 replies; 15+ messages in thread
From: Shahaf Shuler @ 2018-03-22  6:22 UTC (permalink / raw)
  To: Ajit Khaparde, Ferruh Yigit; +Cc: dev

Wednesday, March 21, 2018 9:27 PM, Ajit Khaparde:
>Hi Shahaf,
>Well, the application could.
>While we can't ignore the advantages of enabling the offloads.
>I felt if we should really mandate applications to request all the supported offloads?

Sorry, I don’t understand the question here. Can you rephrase ?


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

* [dpdk-dev] [PATCH v2] net/bnxt: switch to the new offload API
  2018-03-21 19:08 ` Ferruh Yigit
  2018-03-21 19:27   ` Ajit Khaparde
@ 2018-03-26 22:47   ` Ajit Khaparde
  2018-03-30 10:38     ` Ferruh Yigit
  1 sibling, 1 reply; 15+ messages in thread
From: Ajit Khaparde @ 2018-03-26 22:47 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

Update bnxt PMD to new ethdev offloads API.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
v1->v2: return an error if requested offload flags do not
match supported offload capabilities.
---
 drivers/net/bnxt/bnxt_ethdev.c | 63 ++++++++++++++++++++++++++++++------------
 1 file changed, 45 insertions(+), 18 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index a4042420c..d02d8207b 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -152,6 +152,27 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 	ETH_RSS_NONFRAG_IPV6_TCP |	\
 	ETH_RSS_NONFRAG_IPV6_UDP)
 
+#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_VLAN_INSERT | \
+				     DEV_TX_OFFLOAD_IPV4_CKSUM | \
+				     DEV_TX_OFFLOAD_TCP_CKSUM | \
+				     DEV_TX_OFFLOAD_UDP_CKSUM | \
+				     DEV_TX_OFFLOAD_TCP_TSO | \
+				     DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | \
+				     DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \
+				     DEV_TX_OFFLOAD_GRE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_IPIP_TNL_TSO | \
+				     DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_MULTI_SEGS)
+
+#define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
+				     DEV_RX_OFFLOAD_VLAN_STRIP | \
+				     DEV_RX_OFFLOAD_IPV4_CKSUM | \
+				     DEV_RX_OFFLOAD_UDP_CKSUM | \
+				     DEV_RX_OFFLOAD_TCP_CKSUM | \
+				     DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
+				     DEV_RX_OFFLOAD_JUMBO_FRAME | \
+				     DEV_RX_OFFLOAD_CRC_STRIP)
+
 static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
 static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
 
@@ -436,21 +457,14 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->min_rx_bufsize = 1;
 	dev_info->max_rx_pktlen = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN
 				  + VLAN_TAG_SIZE;
-	dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
-					DEV_RX_OFFLOAD_IPV4_CKSUM |
-					DEV_RX_OFFLOAD_UDP_CKSUM |
-					DEV_RX_OFFLOAD_TCP_CKSUM |
-					DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
-	dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
-					DEV_TX_OFFLOAD_IPV4_CKSUM |
-					DEV_TX_OFFLOAD_TCP_CKSUM |
-					DEV_TX_OFFLOAD_UDP_CKSUM |
-					DEV_TX_OFFLOAD_TCP_TSO |
-					DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
-					DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
-					DEV_TX_OFFLOAD_GRE_TNL_TSO |
-					DEV_TX_OFFLOAD_IPIP_TNL_TSO |
-					DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
+
+	dev_info->rx_queue_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
+	dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
+	if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
+		dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP;
+	dev_info->tx_queue_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
+	dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
+	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
 	/* *INDENT-OFF* */
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
@@ -460,7 +474,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 			.wthresh = 0,
 		},
 		.rx_free_thresh = 32,
-		.rx_drop_en = 0,
+		/* If no descriptors available, pkts are dropped by default */
+		.rx_drop_en = 1,
 	};
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
@@ -471,8 +486,6 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 		},
 		.tx_free_thresh = 32,
 		.tx_rs_thresh = 32,
-		.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
-			     ETH_TXQ_FLAGS_NOOFFLOADS,
 	};
 	eth_dev->data->dev_conf.intr_conf.lsc = 1;
 
@@ -516,6 +529,20 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	uint64_t tx_offloads = eth_dev->data->dev_conf.txmode.offloads;
+	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
+
+	if (tx_offloads != (tx_offloads & BNXT_DEV_TX_OFFLOAD_SUPPORT)) {
+		PMD_DRV_LOG(ERR, "Tx offloads requested 0x%lx supported 0x%x\n",
+			    tx_offloads, BNXT_DEV_TX_OFFLOAD_SUPPORT);
+		return -ENOTSUP;
+	}
+
+	if (rx_offloads != (rx_offloads & BNXT_DEV_RX_OFFLOAD_SUPPORT)) {
+		PMD_DRV_LOG(ERR, "Rx offloads requested 0x%lx supported 0x%x\n",
+			    rx_offloads, BNXT_DEV_RX_OFFLOAD_SUPPORT);
+		return -ENOTSUP;
+	}
 
 	bp->rx_queues = (void *)eth_dev->data->rx_queues;
 	bp->tx_queues = (void *)eth_dev->data->tx_queues;
-- 
2.14.3 (Apple Git-98)

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

* Re: [dpdk-dev] [PATCH v2] net/bnxt: switch to the new offload API
  2018-03-26 22:47   ` [dpdk-dev] [PATCH v2] " Ajit Khaparde
@ 2018-03-30 10:38     ` Ferruh Yigit
  2018-04-02 22:25       ` [dpdk-dev] [PATCH v3 1/2] " Ajit Khaparde
  0 siblings, 1 reply; 15+ messages in thread
From: Ferruh Yigit @ 2018-03-30 10:38 UTC (permalink / raw)
  To: Ajit Khaparde, dev

On 3/26/2018 11:47 PM, Ajit Khaparde wrote:
> Update bnxt PMD to new ethdev offloads API.
> 
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
> v1->v2: return an error if requested offload flags do not
> match supported offload capabilities.

<...>

> +
> +	dev_info->rx_queue_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;

Hi Ajit,

Is bnxt supports queue level offloads? If not PMD should return 0 as
rx_queue_offload_capa and tx_queue_offload_capa.

<...>

>  		.rx_free_thresh = 32,
> -		.rx_drop_en = 0,
> +		/* If no descriptors available, pkts are dropped by default */
> +		.rx_drop_en = 1,

This is not related to the offload API but changing default config, does it make
sense a separate patch for this?

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

* [dpdk-dev] [PATCH v3 1/2] net/bnxt: switch to the new offload API
  2018-03-30 10:38     ` Ferruh Yigit
@ 2018-04-02 22:25       ` Ajit Khaparde
  2018-04-02 22:25         ` [dpdk-dev] [PATCH v3 2/2] net/bnxt: fix rx_drop_en setting Ajit Khaparde
  2018-04-05 14:36         ` [dpdk-dev] [PATCH v3 1/2] net/bnxt: switch to the new offload API Ferruh Yigit
  0 siblings, 2 replies; 15+ messages in thread
From: Ajit Khaparde @ 2018-04-02 22:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

Update bnxt PMD to new ethdev offloads API.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: return an error if requested offload flags do not
match supported offload capabilities.
v2->v3: modify the code based on review comments.
---
 drivers/net/bnxt/bnxt_ethdev.c | 58 +++++++++++++++++++++++++++++-------------
 1 file changed, 41 insertions(+), 17 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0aebcfd58..f208c90b8 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -152,6 +152,27 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 	ETH_RSS_NONFRAG_IPV6_TCP |	\
 	ETH_RSS_NONFRAG_IPV6_UDP)
 
+#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_VLAN_INSERT | \
+				     DEV_TX_OFFLOAD_IPV4_CKSUM | \
+				     DEV_TX_OFFLOAD_TCP_CKSUM | \
+				     DEV_TX_OFFLOAD_UDP_CKSUM | \
+				     DEV_TX_OFFLOAD_TCP_TSO | \
+				     DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | \
+				     DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \
+				     DEV_TX_OFFLOAD_GRE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_IPIP_TNL_TSO | \
+				     DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_MULTI_SEGS)
+
+#define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
+				     DEV_RX_OFFLOAD_VLAN_STRIP | \
+				     DEV_RX_OFFLOAD_IPV4_CKSUM | \
+				     DEV_RX_OFFLOAD_UDP_CKSUM | \
+				     DEV_RX_OFFLOAD_TCP_CKSUM | \
+				     DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
+				     DEV_RX_OFFLOAD_JUMBO_FRAME | \
+				     DEV_RX_OFFLOAD_CRC_STRIP)
+
 static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
 static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
 
@@ -436,21 +457,12 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->min_rx_bufsize = 1;
 	dev_info->max_rx_pktlen = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN
 				  + VLAN_TAG_SIZE;
-	dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
-					DEV_RX_OFFLOAD_IPV4_CKSUM |
-					DEV_RX_OFFLOAD_UDP_CKSUM |
-					DEV_RX_OFFLOAD_TCP_CKSUM |
-					DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
-	dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
-					DEV_TX_OFFLOAD_IPV4_CKSUM |
-					DEV_TX_OFFLOAD_TCP_CKSUM |
-					DEV_TX_OFFLOAD_UDP_CKSUM |
-					DEV_TX_OFFLOAD_TCP_TSO |
-					DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
-					DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
-					DEV_TX_OFFLOAD_GRE_TNL_TSO |
-					DEV_TX_OFFLOAD_IPIP_TNL_TSO |
-					DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
+
+	dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
+	if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
+		dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP;
+	dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
+	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
 	/* *INDENT-OFF* */
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
@@ -471,8 +483,6 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 		},
 		.tx_free_thresh = 32,
 		.tx_rs_thresh = 32,
-		.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
-			     ETH_TXQ_FLAGS_NOOFFLOADS,
 	};
 	eth_dev->data->dev_conf.intr_conf.lsc = 1;
 
@@ -516,6 +526,20 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	uint64_t tx_offloads = eth_dev->data->dev_conf.txmode.offloads;
+	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
+
+	if (tx_offloads != (tx_offloads & BNXT_DEV_TX_OFFLOAD_SUPPORT)) {
+		PMD_DRV_LOG(ERR, "Tx offloads requested 0x%lx supported 0x%x\n",
+			    tx_offloads, BNXT_DEV_TX_OFFLOAD_SUPPORT);
+		return -ENOTSUP;
+	}
+
+	if (rx_offloads != (rx_offloads & BNXT_DEV_RX_OFFLOAD_SUPPORT)) {
+		PMD_DRV_LOG(ERR, "Rx offloads requested 0x%lx supported 0x%x\n",
+			    rx_offloads, BNXT_DEV_RX_OFFLOAD_SUPPORT);
+		return -ENOTSUP;
+	}
 
 	bp->rx_queues = (void *)eth_dev->data->rx_queues;
 	bp->tx_queues = (void *)eth_dev->data->tx_queues;
-- 
2.14.3 (Apple Git-98)

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

* [dpdk-dev] [PATCH v3 2/2] net/bnxt: fix rx_drop_en setting
  2018-04-02 22:25       ` [dpdk-dev] [PATCH v3 1/2] " Ajit Khaparde
@ 2018-04-02 22:25         ` Ajit Khaparde
  2018-04-05 14:36         ` [dpdk-dev] [PATCH v3 1/2] net/bnxt: switch to the new offload API Ferruh Yigit
  1 sibling, 0 replies; 15+ messages in thread
From: Ajit Khaparde @ 2018-04-02 22:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

If Rx descriptors are not available, pkts are dropped by default.
Fix rx_drop_en setting in bnxt_dev_info_get_op to reflect it.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index f208c90b8..cfb0829ae 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -472,7 +472,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 			.wthresh = 0,
 		},
 		.rx_free_thresh = 32,
-		.rx_drop_en = 0,
+		/* If no descriptors available, pkts are dropped by default */
+		.rx_drop_en = 1,
 	};
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
-- 
2.14.3 (Apple Git-98)

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

* Re: [dpdk-dev] [PATCH v3 1/2] net/bnxt: switch to the new offload API
  2018-04-02 22:25       ` [dpdk-dev] [PATCH v3 1/2] " Ajit Khaparde
  2018-04-02 22:25         ` [dpdk-dev] [PATCH v3 2/2] net/bnxt: fix rx_drop_en setting Ajit Khaparde
@ 2018-04-05 14:36         ` Ferruh Yigit
  2018-04-06  0:22           ` [dpdk-dev] [PATCH v4 1/2] net/bnxt: fix rx_drop_en setting Ajit Khaparde
  1 sibling, 1 reply; 15+ messages in thread
From: Ferruh Yigit @ 2018-04-05 14:36 UTC (permalink / raw)
  To: Ajit Khaparde, dev

On 4/2/2018 11:25 PM, Ajit Khaparde wrote:
> Update bnxt PMD to new ethdev offloads API.
> 
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> --
> v1->v2: return an error if requested offload flags do not
> match supported offload capabilities.
> v2->v3: modify the code based on review comments.

<...>

> @@ -516,6 +526,20 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
>  static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
>  {
>  	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
> +	uint64_t tx_offloads = eth_dev->data->dev_conf.txmode.offloads;
> +	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
> +
> +	if (tx_offloads != (tx_offloads & BNXT_DEV_TX_OFFLOAD_SUPPORT)) {
> +		PMD_DRV_LOG(ERR, "Tx offloads requested 0x%lx supported 0x%x\n",
> +			    tx_offloads, BNXT_DEV_TX_OFFLOAD_SUPPORT);
> +		return -ENOTSUP;
> +	}
> +
> +	if (rx_offloads != (rx_offloads & BNXT_DEV_RX_OFFLOAD_SUPPORT)) {
> +		PMD_DRV_LOG(ERR, "Rx offloads requested 0x%lx supported 0x%x\n",
> +			    rx_offloads, BNXT_DEV_RX_OFFLOAD_SUPPORT);
> +		return -ENOTSUP;
> +	}

This is causing i686 build error [1].

[1]
In file included from .../dpdk/drivers/net/bnxt/bnxt_ethdev.c:43:0:

.../dpdk/drivers/net/bnxt/bnxt_ethdev.c: In function ‘bnxt_dev_configure_op’:
.../dpdk/drivers/net/bnxt/bnxt.h:341:50: error: format ‘%lx’ expects argument of
type ‘long unsigned int’, but argument 5 has type ‘uint64_t {aka long long
unsigned int}’ [-Werror=format=]
  rte_log(RTE_LOG_ ## level, bnxt_logtype_driver, "%s(): " fmt, \
                                                  ^
.../dpdk/drivers/net/bnxt/bnxt.h:345:2: note: in expansion of macro
‘PMD_DRV_LOG_RAW’
  PMD_DRV_LOG_RAW(level, fmt, ## args)
  ^~~~~~~~~~~~~~~
.../dpdk/drivers/net/bnxt/bnxt_ethdev.c:528:3: note: in expansion of macro
‘PMD_DRV_LOG’
   PMD_DRV_LOG(ERR, "Tx offloads requested 0x%lx supported 0x%x\n",
   ^~~~~~~~~~~
.../dpdk/drivers/net/bnxt/bnxt_ethdev.c:528:47: note: format string is defined here
   PMD_DRV_LOG(ERR, "Tx offloads requested 0x%lx supported 0x%x\n",
                                             ~~^
                                             %llx
In file included from .../dpdk/drivers/net/bnxt/bnxt_ethdev.c:43:0:
.../dpdk/drivers/net/bnxt/bnxt.h:341:50: error: format ‘%lx’ expects argument of
type ‘long unsigned int’, but argument 5 has type ‘uint64_t {aka long long
unsigned int}’ [-Werror=format=]
  rte_log(RTE_LOG_ ## level, bnxt_logtype_driver, "%s(): " fmt, \
                                                  ^
.../dpdk/drivers/net/bnxt/bnxt.h:345:2: note: in expansion of macro
‘PMD_DRV_LOG_RAW’
  PMD_DRV_LOG_RAW(level, fmt, ## args)
  ^~~~~~~~~~~~~~~
.../dpdk/drivers/net/bnxt/bnxt_ethdev.c:534:3: note: in expansion of macro
‘PMD_DRV_LOG’
   PMD_DRV_LOG(ERR, "Rx offloads requested 0x%lx supported 0x%x\n",
   ^~~~~~~~~~~
.../dpdk/drivers/net/bnxt/bnxt_ethdev.c:534:47: note: format string is defined here
   PMD_DRV_LOG(ERR, "Rx offloads requested 0x%lx supported 0x%x\n",
                                             ~~^
                                             %llx
cc1: all warnings being treated as errors

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

* [dpdk-dev] [PATCH v4 1/2] net/bnxt: fix rx_drop_en setting
  2018-04-05 14:36         ` [dpdk-dev] [PATCH v3 1/2] net/bnxt: switch to the new offload API Ferruh Yigit
@ 2018-04-06  0:22           ` Ajit Khaparde
  2018-04-06  0:22             ` [dpdk-dev] [PATCH v4 2/2] net/bnxt: switch to the new offload API Ajit Khaparde
  0 siblings, 1 reply; 15+ messages in thread
From: Ajit Khaparde @ 2018-04-06  0:22 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

If Rx descriptors are not available, pkts are dropped by default.
Fix rx_drop_en setting in bnxt_dev_info_get_op to reflect it.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 7c007c8f9..27a51048a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -426,7 +426,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 			.wthresh = 0,
 		},
 		.rx_free_thresh = 32,
-		.rx_drop_en = 0,
+		/* If no descriptors available, pkts are dropped by default */
+		.rx_drop_en = 1,
 	};
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
-- 
2.15.1 (Apple Git-101)

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

* [dpdk-dev] [PATCH v4 2/2] net/bnxt: switch to the new offload API
  2018-04-06  0:22           ` [dpdk-dev] [PATCH v4 1/2] net/bnxt: fix rx_drop_en setting Ajit Khaparde
@ 2018-04-06  0:22             ` Ajit Khaparde
  2018-04-06 15:11               ` Ferruh Yigit
  0 siblings, 1 reply; 15+ messages in thread
From: Ajit Khaparde @ 2018-04-06  0:22 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

Update bnxt PMD to new ethdev offloads API.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: return an error if requested offload flags do not
match supported offload capabilities.
v2->v3: modify the code based on review comments.
v3->v4: fix compilation for i686 configuration.
---
 drivers/net/bnxt/bnxt_ethdev.c | 62 ++++++++++++++++++++++++++++++------------
 1 file changed, 45 insertions(+), 17 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 27a51048a..4469f5c00 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -118,6 +118,27 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 	ETH_RSS_NONFRAG_IPV6_TCP |	\
 	ETH_RSS_NONFRAG_IPV6_UDP)
 
+#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_VLAN_INSERT | \
+				     DEV_TX_OFFLOAD_IPV4_CKSUM | \
+				     DEV_TX_OFFLOAD_TCP_CKSUM | \
+				     DEV_TX_OFFLOAD_UDP_CKSUM | \
+				     DEV_TX_OFFLOAD_TCP_TSO | \
+				     DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | \
+				     DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \
+				     DEV_TX_OFFLOAD_GRE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_IPIP_TNL_TSO | \
+				     DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_MULTI_SEGS)
+
+#define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
+				     DEV_RX_OFFLOAD_VLAN_STRIP | \
+				     DEV_RX_OFFLOAD_IPV4_CKSUM | \
+				     DEV_RX_OFFLOAD_UDP_CKSUM | \
+				     DEV_RX_OFFLOAD_TCP_CKSUM | \
+				     DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
+				     DEV_RX_OFFLOAD_JUMBO_FRAME | \
+				     DEV_RX_OFFLOAD_CRC_STRIP)
+
 static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
 static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
 
@@ -402,21 +423,12 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->min_rx_bufsize = 1;
 	dev_info->max_rx_pktlen = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN
 				  + VLAN_TAG_SIZE;
-	dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
-					DEV_RX_OFFLOAD_IPV4_CKSUM |
-					DEV_RX_OFFLOAD_UDP_CKSUM |
-					DEV_RX_OFFLOAD_TCP_CKSUM |
-					DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
-	dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
-					DEV_TX_OFFLOAD_IPV4_CKSUM |
-					DEV_TX_OFFLOAD_TCP_CKSUM |
-					DEV_TX_OFFLOAD_UDP_CKSUM |
-					DEV_TX_OFFLOAD_TCP_TSO |
-					DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
-					DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
-					DEV_TX_OFFLOAD_GRE_TNL_TSO |
-					DEV_TX_OFFLOAD_IPIP_TNL_TSO |
-					DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
+
+	dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
+	if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
+		dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP;
+	dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
+	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
 	/* *INDENT-OFF* */
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
@@ -438,8 +450,6 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 		},
 		.tx_free_thresh = 32,
 		.tx_rs_thresh = 32,
-		.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
-			     ETH_TXQ_FLAGS_NOOFFLOADS,
 	};
 	eth_dev->data->dev_conf.intr_conf.lsc = 1;
 
@@ -483,6 +493,24 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	uint64_t tx_offloads = eth_dev->data->dev_conf.txmode.offloads;
+	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
+
+	if (tx_offloads != (tx_offloads & BNXT_DEV_TX_OFFLOAD_SUPPORT)) {
+		PMD_DRV_LOG
+			(ERR,
+			 "Tx offloads requested 0x%" PRIx64 " supported 0x%x\n",
+			 tx_offloads, BNXT_DEV_TX_OFFLOAD_SUPPORT);
+		return -ENOTSUP;
+	}
+
+	if (rx_offloads != (rx_offloads & BNXT_DEV_RX_OFFLOAD_SUPPORT)) {
+		PMD_DRV_LOG
+			(ERR,
+			 "Rx offloads requested 0x%" PRIx64 " supported 0x%x\n",
+			    rx_offloads, BNXT_DEV_RX_OFFLOAD_SUPPORT);
+		return -ENOTSUP;
+	}
 
 	bp->rx_queues = (void *)eth_dev->data->rx_queues;
 	bp->tx_queues = (void *)eth_dev->data->tx_queues;
-- 
2.15.1 (Apple Git-101)

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

* Re: [dpdk-dev] [PATCH v4 2/2] net/bnxt: switch to the new offload API
  2018-04-06  0:22             ` [dpdk-dev] [PATCH v4 2/2] net/bnxt: switch to the new offload API Ajit Khaparde
@ 2018-04-06 15:11               ` Ferruh Yigit
  2018-04-07 17:40                 ` [dpdk-dev] [PATCH v5 1/2] net/bnxt: fix rx_drop_en setting Ajit Khaparde
  0 siblings, 1 reply; 15+ messages in thread
From: Ferruh Yigit @ 2018-04-06 15:11 UTC (permalink / raw)
  To: Ajit Khaparde, dev, Shahaf Shuler

On 4/6/2018 1:22 AM, Ajit Khaparde wrote:
> Update bnxt PMD to new ethdev offloads API.
> 
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> --
> v1->v2: return an error if requested offload flags do not
> match supported offload capabilities.
> v2->v3: modify the code based on review comments.
> v3->v4: fix compilation for i686 configuration.
> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 62 ++++++++++++++++++++++++++++++------------

Hi Ajit,

I can see there are a few more rxmode.xxx usage in bnxt driver not covered with
this patch.

Expectation is to switch "offloads" version of those. Like, rxmode.hw_strip_crc,
rxmode.enable_lro, rxmode.hw_vlan_filter etc ...

I believe this patch should convert them all. cc'ed Shahaf too.

<...>

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

* [dpdk-dev] [PATCH v5 1/2] net/bnxt: fix rx_drop_en setting
  2018-04-06 15:11               ` Ferruh Yigit
@ 2018-04-07 17:40                 ` Ajit Khaparde
  2018-04-07 17:40                   ` [dpdk-dev] [PATCH v5 2/2] net/bnxt: switch to the new offload API Ajit Khaparde
  2018-04-09 16:53                   ` [dpdk-dev] [dpdk-stable] [PATCH v5 1/2] net/bnxt: fix rx_drop_en setting Ferruh Yigit
  0 siblings, 2 replies; 15+ messages in thread
From: Ajit Khaparde @ 2018-04-07 17:40 UTC (permalink / raw)
  To: dev; +Cc: stable

If Rx descriptors are not available, pkts are dropped by default.
Fix rx_drop_en setting in bnxt_dev_info_get_op to reflect it.

Fixes: 0a6d2a720078 ("net/bnxt: get device infos")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: added fixes to commit message.
---
 drivers/net/bnxt/bnxt_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 7c007c8f9..27a51048a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -426,7 +426,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 			.wthresh = 0,
 		},
 		.rx_free_thresh = 32,
-		.rx_drop_en = 0,
+		/* If no descriptors available, pkts are dropped by default */
+		.rx_drop_en = 1,
 	};
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
-- 
2.15.1 (Apple Git-101)

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

* [dpdk-dev] [PATCH v5 2/2] net/bnxt: switch to the new offload API
  2018-04-07 17:40                 ` [dpdk-dev] [PATCH v5 1/2] net/bnxt: fix rx_drop_en setting Ajit Khaparde
@ 2018-04-07 17:40                   ` Ajit Khaparde
  2018-04-09 16:53                   ` [dpdk-dev] [dpdk-stable] [PATCH v5 1/2] net/bnxt: fix rx_drop_en setting Ferruh Yigit
  1 sibling, 0 replies; 15+ messages in thread
From: Ajit Khaparde @ 2018-04-07 17:40 UTC (permalink / raw)
  To: dev

Update bnxt PMD to new ethdev offloads API.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: return an error if requested offload flags do not
match supported offload capabilities.
v2->v3: modify the code based on review comments.
v3->v4: fix compilation for i686 configuration.
v4->v5: remove leftovers of old offload API
---
 drivers/net/bnxt/bnxt_ethdev.c | 94 +++++++++++++++++++++++++++++-------------
 drivers/net/bnxt/bnxt_ring.c   |  5 ++-
 drivers/net/bnxt/bnxt_rxq.c    |  5 ++-
 3 files changed, 71 insertions(+), 33 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 27a51048a..37585f319 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -118,6 +118,28 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 	ETH_RSS_NONFRAG_IPV6_TCP |	\
 	ETH_RSS_NONFRAG_IPV6_UDP)
 
+#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_VLAN_INSERT | \
+				     DEV_TX_OFFLOAD_IPV4_CKSUM | \
+				     DEV_TX_OFFLOAD_TCP_CKSUM | \
+				     DEV_TX_OFFLOAD_UDP_CKSUM | \
+				     DEV_TX_OFFLOAD_TCP_TSO | \
+				     DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | \
+				     DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \
+				     DEV_TX_OFFLOAD_GRE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_IPIP_TNL_TSO | \
+				     DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \
+				     DEV_TX_OFFLOAD_MULTI_SEGS)
+
+#define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
+				     DEV_RX_OFFLOAD_VLAN_STRIP | \
+				     DEV_RX_OFFLOAD_IPV4_CKSUM | \
+				     DEV_RX_OFFLOAD_UDP_CKSUM | \
+				     DEV_RX_OFFLOAD_TCP_CKSUM | \
+				     DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
+				     DEV_RX_OFFLOAD_JUMBO_FRAME | \
+				     DEV_RX_OFFLOAD_CRC_STRIP | \
+				     DEV_RX_OFFLOAD_TCP_LRO)
+
 static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
 static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
 
@@ -187,10 +209,12 @@ static int bnxt_init_chip(struct bnxt *bp)
 	rte_intr_disable(intr_handle);
 
 	if (bp->eth_dev->data->mtu > ETHER_MTU) {
-		bp->eth_dev->data->dev_conf.rxmode.jumbo_frame = 1;
+		bp->eth_dev->data->dev_conf.rxmode.offloads |=
+			DEV_RX_OFFLOAD_JUMBO_FRAME;
 		bp->flags |= BNXT_FLAG_JUMBO;
 	} else {
-		bp->eth_dev->data->dev_conf.rxmode.jumbo_frame = 0;
+		bp->eth_dev->data->dev_conf.rxmode.offloads &=
+			~DEV_RX_OFFLOAD_JUMBO_FRAME;
 		bp->flags &= ~BNXT_FLAG_JUMBO;
 	}
 
@@ -261,7 +285,8 @@ static int bnxt_init_chip(struct bnxt *bp)
 
 		bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
 
-		if (bp->eth_dev->data->dev_conf.rxmode.enable_lro)
+		if (bp->eth_dev->data->dev_conf.rxmode.offloads &
+		    DEV_RX_OFFLOAD_TCP_LRO)
 			bnxt_hwrm_vnic_tpa_cfg(bp, vnic, 1);
 		else
 			bnxt_hwrm_vnic_tpa_cfg(bp, vnic, 0);
@@ -402,21 +427,12 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->min_rx_bufsize = 1;
 	dev_info->max_rx_pktlen = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN
 				  + VLAN_TAG_SIZE;
-	dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
-					DEV_RX_OFFLOAD_IPV4_CKSUM |
-					DEV_RX_OFFLOAD_UDP_CKSUM |
-					DEV_RX_OFFLOAD_TCP_CKSUM |
-					DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
-	dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
-					DEV_TX_OFFLOAD_IPV4_CKSUM |
-					DEV_TX_OFFLOAD_TCP_CKSUM |
-					DEV_TX_OFFLOAD_UDP_CKSUM |
-					DEV_TX_OFFLOAD_TCP_TSO |
-					DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
-					DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
-					DEV_TX_OFFLOAD_GRE_TNL_TSO |
-					DEV_TX_OFFLOAD_IPIP_TNL_TSO |
-					DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
+
+	dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
+	if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
+		dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP;
+	dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
+	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
 	/* *INDENT-OFF* */
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
@@ -438,8 +454,6 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 		},
 		.tx_free_thresh = 32,
 		.tx_rs_thresh = 32,
-		.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
-			     ETH_TXQ_FLAGS_NOOFFLOADS,
 	};
 	eth_dev->data->dev_conf.intr_conf.lsc = 1;
 
@@ -483,6 +497,24 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	uint64_t tx_offloads = eth_dev->data->dev_conf.txmode.offloads;
+	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
+
+	if (tx_offloads != (tx_offloads & BNXT_DEV_TX_OFFLOAD_SUPPORT)) {
+		PMD_DRV_LOG
+			(ERR,
+			 "Tx offloads requested 0x%" PRIx64 " supported 0x%x\n",
+			 tx_offloads, BNXT_DEV_TX_OFFLOAD_SUPPORT);
+		return -ENOTSUP;
+	}
+
+	if (rx_offloads != (rx_offloads & BNXT_DEV_RX_OFFLOAD_SUPPORT)) {
+		PMD_DRV_LOG
+			(ERR,
+			 "Rx offloads requested 0x%" PRIx64 " supported 0x%x\n",
+			    rx_offloads, BNXT_DEV_RX_OFFLOAD_SUPPORT);
+		return -ENOTSUP;
+	}
 
 	bp->rx_queues = (void *)eth_dev->data->rx_queues;
 	bp->tx_queues = (void *)eth_dev->data->tx_queues;
@@ -513,7 +545,7 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 	bp->rx_cp_nr_rings = bp->rx_nr_rings;
 	bp->tx_cp_nr_rings = bp->tx_nr_rings;
 
-	if (eth_dev->data->dev_conf.rxmode.jumbo_frame)
+	if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME)
 		eth_dev->data->mtu =
 				eth_dev->data->dev_conf.rxmode.max_rx_pkt_len -
 				ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE;
@@ -544,6 +576,7 @@ static int bnxt_dev_lsc_intr_setup(struct rte_eth_dev *eth_dev)
 static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
 	int vlan_mask = 0;
 	int rc;
 
@@ -560,9 +593,9 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 
 	bnxt_link_update_op(eth_dev, 1);
 
-	if (eth_dev->data->dev_conf.rxmode.hw_vlan_filter)
+	if (rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
 		vlan_mask |= ETH_VLAN_FILTER_MASK;
-	if (eth_dev->data->dev_conf.rxmode.hw_vlan_strip)
+	if (rx_offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
 		vlan_mask |= ETH_VLAN_STRIP_MASK;
 	rc = bnxt_vlan_offload_set_op(eth_dev, vlan_mask);
 	if (rc)
@@ -1339,30 +1372,31 @@ static int
 bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
 {
 	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	uint64_t rx_offloads = dev->data->dev_conf.rxmode.offloads;
 	unsigned int i;
 
 	if (mask & ETH_VLAN_FILTER_MASK) {
-		if (!dev->data->dev_conf.rxmode.hw_vlan_filter) {
+		if (!(rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)) {
 			/* Remove any VLAN filters programmed */
 			for (i = 0; i < 4095; i++)
 				bnxt_del_vlan_filter(bp, i);
 		}
 		PMD_DRV_LOG(DEBUG, "VLAN Filtering: %d\n",
-			dev->data->dev_conf.rxmode.hw_vlan_filter);
+			!!(rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER));
 	}
 
 	if (mask & ETH_VLAN_STRIP_MASK) {
 		/* Enable or disable VLAN stripping */
 		for (i = 0; i < bp->nr_vnics; i++) {
 			struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
-			if (dev->data->dev_conf.rxmode.hw_vlan_strip)
+			if (rx_offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
 				vnic->vlan_strip = true;
 			else
 				vnic->vlan_strip = false;
 			bnxt_hwrm_vnic_cfg(bp, vnic);
 		}
 		PMD_DRV_LOG(DEBUG, "VLAN Strip Offload: %d\n",
-			dev->data->dev_conf.rxmode.hw_vlan_strip);
+			!!(rx_offloads & DEV_RX_OFFLOAD_VLAN_STRIP));
 	}
 
 	if (mask & ETH_VLAN_EXTEND_MASK)
@@ -1513,9 +1547,11 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 
 	if (new_mtu > ETHER_MTU) {
 		bp->flags |= BNXT_FLAG_JUMBO;
-		eth_dev->data->dev_conf.rxmode.jumbo_frame = 1;
+		bp->eth_dev->data->dev_conf.rxmode.offloads |=
+			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	} else {
-		eth_dev->data->dev_conf.rxmode.jumbo_frame = 0;
+		bp->eth_dev->data->dev_conf.rxmode.offloads &=
+			~DEV_RX_OFFLOAD_JUMBO_FRAME;
 		bp->flags &= ~BNXT_FLAG_JUMBO;
 	}
 
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 1355ced7e..160780c33 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -70,6 +70,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	struct bnxt_ring *tx_ring;
 	struct bnxt_ring *rx_ring;
 	struct rte_pci_device *pdev = bp->pdev;
+	uint64_t rx_offloads = bp->eth_dev->data->dev_conf.rxmode.offloads;
 	const struct rte_memzone *mz = NULL;
 	char mz_name[RTE_MEMZONE_NAMESIZE];
 	rte_iova_t mz_phys_addr;
@@ -127,7 +128,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 				       sizeof(struct bnxt_tpa_info)) : 0;
 
 	int total_alloc_len = tpa_info_start;
-	if (bp->eth_dev->data->dev_conf.rxmode.enable_lro)
+	if (rx_offloads & DEV_RX_OFFLOAD_TCP_LRO)
 		total_alloc_len += tpa_info_len;
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
@@ -224,7 +225,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 				    ag_bitmap_start, ag_bitmap_len);
 
 		/* TPA info */
-		if (bp->eth_dev->data->dev_conf.rxmode.enable_lro)
+		if (rx_offloads & DEV_RX_OFFLOAD_TCP_LRO)
 			rx_ring_info->tpa_info =
 				((struct bnxt_tpa_info *)((char *)mz->addr +
 							  tpa_info_start));
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 1b7fc7ab3..ce3f0a1d9 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -280,6 +280,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 			       struct rte_mempool *mp)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
 	struct bnxt_rx_queue *rxq;
 	int rc = 0;
 
@@ -322,8 +323,8 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 
 	rxq->queue_id = queue_idx;
 	rxq->port_id = eth_dev->data->port_id;
-	rxq->crc_len = (uint8_t)((eth_dev->data->dev_conf.rxmode.hw_strip_crc) ?
-				0 : ETHER_CRC_LEN);
+	rxq->crc_len = rx_offloads & DEV_RX_OFFLOAD_CRC_STRIP ?
+		0 : ETHER_CRC_LEN;
 
 	eth_dev->data->rx_queues[queue_idx] = rxq;
 	/* Allocate RX ring hardware descriptors */
-- 
2.15.1 (Apple Git-101)

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

* Re: [dpdk-dev] [dpdk-stable] [PATCH v5 1/2] net/bnxt: fix rx_drop_en setting
  2018-04-07 17:40                 ` [dpdk-dev] [PATCH v5 1/2] net/bnxt: fix rx_drop_en setting Ajit Khaparde
  2018-04-07 17:40                   ` [dpdk-dev] [PATCH v5 2/2] net/bnxt: switch to the new offload API Ajit Khaparde
@ 2018-04-09 16:53                   ` Ferruh Yigit
  1 sibling, 0 replies; 15+ messages in thread
From: Ferruh Yigit @ 2018-04-09 16:53 UTC (permalink / raw)
  To: Ajit Khaparde, dev; +Cc: stable

On 4/7/2018 6:40 PM, Ajit Khaparde wrote:
> If Rx descriptors are not available, pkts are dropped by default.
> Fix rx_drop_en setting in bnxt_dev_info_get_op to reflect it.
> 
> Fixes: 0a6d2a720078 ("net/bnxt: get device infos")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

Series applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2018-04-09 16:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-06 19:40 [dpdk-dev] [PATCH] net/bnxt: switch to the new offload API Ajit Khaparde
2018-03-21 19:08 ` Ferruh Yigit
2018-03-21 19:27   ` Ajit Khaparde
2018-03-22  6:22     ` Shahaf Shuler
2018-03-26 22:47   ` [dpdk-dev] [PATCH v2] " Ajit Khaparde
2018-03-30 10:38     ` Ferruh Yigit
2018-04-02 22:25       ` [dpdk-dev] [PATCH v3 1/2] " Ajit Khaparde
2018-04-02 22:25         ` [dpdk-dev] [PATCH v3 2/2] net/bnxt: fix rx_drop_en setting Ajit Khaparde
2018-04-05 14:36         ` [dpdk-dev] [PATCH v3 1/2] net/bnxt: switch to the new offload API Ferruh Yigit
2018-04-06  0:22           ` [dpdk-dev] [PATCH v4 1/2] net/bnxt: fix rx_drop_en setting Ajit Khaparde
2018-04-06  0:22             ` [dpdk-dev] [PATCH v4 2/2] net/bnxt: switch to the new offload API Ajit Khaparde
2018-04-06 15:11               ` Ferruh Yigit
2018-04-07 17:40                 ` [dpdk-dev] [PATCH v5 1/2] net/bnxt: fix rx_drop_en setting Ajit Khaparde
2018-04-07 17:40                   ` [dpdk-dev] [PATCH v5 2/2] net/bnxt: switch to the new offload API Ajit Khaparde
2018-04-09 16:53                   ` [dpdk-dev] [dpdk-stable] [PATCH v5 1/2] net/bnxt: fix rx_drop_en setting Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).