diff mbox series

[02/11] net/bnxt: compute and store scattered RX status

Message ID 20190521213953.25425-3-ajit.khaparde@broadcom.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series bnxt patchset | expand

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>

In preparation for a bnxt vector-mode driver, compute and store
scattered_rx status for the device when started.

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Maxime Coquelin May 23, 2019, 11:47 a.m. UTC | #1
On 5/21/19 11:39 PM, Ajit Khaparde wrote:
> From: Lance Richardson<lance.richardson@broadcom.com>
> 
> In preparation for a bnxt vector-mode driver, compute and store
> scattered_rx status for the device when started.
> 
> Signed-off-by: Lance Richardson<lance.richardson@broadcom.com>
> Reviewed-by: Ajit Khaparde<ajit.khaparde@broadcom.com>
> ---
>   drivers/net/bnxt/bnxt_ethdev.c | 23 +++++++++++++++++++++++
>   1 file changed, 23 insertions(+)

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
diff mbox series

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index da0de211d..e0e0b72c6 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -624,6 +624,27 @@  static int bnxt_dev_lsc_intr_setup(struct rte_eth_dev *eth_dev)
 	return 0;
 }
 
+/*
+ * Determine whether the current configuration requires support for scattered
+ * receive; return 1 if scattered receive is required and 0 if not.
+ */
+static int bnxt_scattered_rx(struct rte_eth_dev *eth_dev)
+{
+	uint16_t buf_size;
+	int i;
+
+	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+		struct bnxt_rx_queue *rxq = eth_dev->data->rx_queues[i];
+
+		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)
+			return 1;
+	}
+	return 0;
+}
+
 static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
@@ -642,6 +663,8 @@  static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	if (rc)
 		goto error;
 
+	eth_dev->data->scattered_rx = bnxt_scattered_rx(eth_dev);
+
 	bnxt_link_update_op(eth_dev, 1);
 
 	if (rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)