DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Boyer <aboyer@pensando.io>
To: dev@dpdk.org
Cc: Alfredo Cardigliano <cardigliano@ntop.org>,
	Andrew Boyer <aboyer@pensando.io>
Subject: [dpdk-dev] [PATCH 1/6] net/ionic: revise configuration flag handling
Date: Mon, 11 Jan 2021 11:02:04 -0800	[thread overview]
Message-ID: <20210111190209.70928-2-aboyer@pensando.io> (raw)
In-Reply-To: <20210111190209.70928-1-aboyer@pensando.io>

Configuration flags come to the driver in dev_configure(). From there,
the driver calls ionic_lif_configure() to update the lif->feature
bitfield, and then programs the port.

Features like VLAN_RX_FILTER and RX_HASH cannot be disabled in the
device, so do nothing in response to requests to disable them. (The
device config would ideally show them enabled by default, but some
DTS tests fail if RSS_HASH is set but RSS is not.)

Move features from the per-queue to per-port lists. IONIC does not
really support per-queue configuration: the stack disallows disabling
a queue feature if it is enabled on the port, while the device
disallows enabling a queue feature if it is disabled on the port.
Thus all configuration is per-port.

Move the guts of ionic_vlan_offload_set() into a new function,
ionic_lif_configure_vlan_offload(), so it can be called by
ionic_lif_configure().

Move the check for DEV_RX_OFFLOAD_SCATTER from rx_queue_setup() up
into ionic_lif_configure().

Warn if rx_drop_en is not set.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
---
 drivers/net/ionic/ionic_ethdev.c |  77 +++++++++---------------
 drivers/net/ionic/ionic_lif.c    | 100 ++++++++++++++++++++++++++-----
 drivers/net/ionic/ionic_lif.h    |   3 +-
 drivers/net/ionic/ionic_rxtx.c   |   6 +-
 4 files changed, 118 insertions(+), 68 deletions(-)

diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index fd7cd510e..5ff155f85 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -397,25 +397,16 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 		ETH_LINK_SPEED_100G;
 
 	/*
-	 * Per-queue capabilities. Actually most of the offloads are enabled
-	 * by default on the port and can be used on selected queues (by adding
-	 * packet flags at runtime when required)
+	 * Per-queue capabilities
+	 * RTE does not support disabling a feature on a queue if it is
+	 * enabled globally on the device. Thus the driver does not advertise
+	 * capabilities like DEV_TX_OFFLOAD_IPV4_CKSUM as per-queue even
+	 * though the driver would be otherwise capable of disabling it on
+	 * a per-queue basis.
 	 */
 
-	dev_info->rx_queue_offload_capa =
-		DEV_RX_OFFLOAD_IPV4_CKSUM |
-		DEV_RX_OFFLOAD_UDP_CKSUM |
-		DEV_RX_OFFLOAD_TCP_CKSUM |
-		0;
-
-	dev_info->tx_queue_offload_capa =
-		DEV_TX_OFFLOAD_IPV4_CKSUM |
-		DEV_TX_OFFLOAD_UDP_CKSUM |
-		DEV_TX_OFFLOAD_TCP_CKSUM |
-		DEV_TX_OFFLOAD_VLAN_INSERT |
-		DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
-		DEV_TX_OFFLOAD_OUTER_UDP_CKSUM |
-		0;
+	dev_info->rx_queue_offload_capa = 0;
+	dev_info->tx_queue_offload_capa = 0;
 
 	/*
 	 * Per-port capabilities
@@ -423,15 +414,25 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	 */
 
 	dev_info->rx_offload_capa = dev_info->rx_queue_offload_capa |
+		DEV_RX_OFFLOAD_IPV4_CKSUM |
+		DEV_RX_OFFLOAD_UDP_CKSUM |
+		DEV_RX_OFFLOAD_TCP_CKSUM |
 		DEV_RX_OFFLOAD_JUMBO_FRAME |
 		DEV_RX_OFFLOAD_VLAN_FILTER |
 		DEV_RX_OFFLOAD_VLAN_STRIP |
 		DEV_RX_OFFLOAD_SCATTER |
+		DEV_RX_OFFLOAD_RSS_HASH |
 		0;
 
 	dev_info->tx_offload_capa = dev_info->tx_queue_offload_capa |
+		DEV_TX_OFFLOAD_IPV4_CKSUM |
+		DEV_TX_OFFLOAD_UDP_CKSUM |
+		DEV_TX_OFFLOAD_TCP_CKSUM |
+		DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+		DEV_TX_OFFLOAD_OUTER_UDP_CKSUM |
 		DEV_TX_OFFLOAD_MULTI_SEGS |
 		DEV_TX_OFFLOAD_TCP_TSO |
+		DEV_TX_OFFLOAD_VLAN_INSERT |
 		0;
 
 	dev_info->rx_desc_lim = rx_desc_lim;
@@ -445,6 +446,11 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	dev_info->default_rxportconf.ring_size = IONIC_DEF_TXRX_DESC;
 	dev_info->default_txportconf.ring_size = IONIC_DEF_TXRX_DESC;
 
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		/* Packets are always dropped if no desc are available */
+		.rx_drop_en = 1,
+	};
+
 	return 0;
 }
 
@@ -502,34 +508,8 @@ static int
 ionic_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
 {
 	struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
-	struct rte_eth_rxmode *rxmode;
-	rxmode = &eth_dev->data->dev_conf.rxmode;
-	int i;
-
-	if (mask & ETH_VLAN_STRIP_MASK) {
-		if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) {
-			for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
-				struct ionic_qcq *rxq =
-					eth_dev->data->rx_queues[i];
-				rxq->offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
-			}
-			lif->features |= IONIC_ETH_HW_VLAN_RX_STRIP;
-		} else {
-			for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
-				struct ionic_qcq *rxq =
-					eth_dev->data->rx_queues[i];
-				rxq->offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
-			}
-			lif->features &= ~IONIC_ETH_HW_VLAN_RX_STRIP;
-		}
-	}
 
-	if (mask & ETH_VLAN_FILTER_MASK) {
-		if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
-			lif->features |= IONIC_ETH_HW_VLAN_RX_FILTER;
-		else
-			lif->features &= ~IONIC_ETH_HW_VLAN_RX_FILTER;
-	}
+	ionic_lif_configure_vlan_offload(lif, mask);
 
 	ionic_lif_set_features(lif);
 
@@ -845,15 +825,12 @@ static int
 ionic_dev_configure(struct rte_eth_dev *eth_dev)
 {
 	struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
-	int err;
 
 	IONIC_PRINT_CALL();
 
-	err = ionic_lif_configure(lif);
-	if (err) {
-		IONIC_PRINT(ERR, "Cannot configure LIF: %d", err);
-		return err;
-	}
+	ionic_lif_configure(lif);
+
+	ionic_lif_set_features(lif);
 
 	return 0;
 }
diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index 3e643d145..ed1595e62 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -1532,18 +1532,11 @@ ionic_lif_init(struct ionic_lif *lif)
 	if (err)
 		goto err_out_adminq_deinit;
 
-	lif->features =
-		  IONIC_ETH_HW_VLAN_TX_TAG
-		| IONIC_ETH_HW_VLAN_RX_STRIP
-		| IONIC_ETH_HW_VLAN_RX_FILTER
-		| IONIC_ETH_HW_RX_HASH
-		| IONIC_ETH_HW_TX_SG
-		| IONIC_ETH_HW_RX_SG
-		| IONIC_ETH_HW_TX_CSUM
-		| IONIC_ETH_HW_RX_CSUM
-		| IONIC_ETH_HW_TSO
-		| IONIC_ETH_HW_TSO_IPV6
-		| IONIC_ETH_HW_TSO_ECN;
+	/*
+	 * Configure initial feature set
+	 * This will be updated later by the dev_configure() step
+	 */
+	lif->features = IONIC_ETH_HW_RX_HASH | IONIC_ETH_HW_VLAN_RX_FILTER;
 
 	err = ionic_lif_set_features(lif);
 	if (err)
@@ -1589,9 +1582,31 @@ ionic_lif_deinit(struct ionic_lif *lif)
 	lif->state &= ~IONIC_LIF_F_INITED;
 }
 
-int
+void
+ionic_lif_configure_vlan_offload(struct ionic_lif *lif, int mask)
+{
+	struct rte_eth_dev *eth_dev = lif->eth_dev;
+	struct rte_eth_rxmode *rxmode = &eth_dev->data->dev_conf.rxmode;
+
+	/*
+	 * IONIC_ETH_HW_VLAN_RX_FILTER cannot be turned off, so
+	 * set DEV_RX_OFFLOAD_VLAN_FILTER and ignore ETH_VLAN_FILTER_MASK
+	 */
+	rxmode->offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
+
+	if (mask & ETH_VLAN_STRIP_MASK) {
+		if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
+			lif->features |= IONIC_ETH_HW_VLAN_RX_STRIP;
+		else
+			lif->features &= ~IONIC_ETH_HW_VLAN_RX_STRIP;
+	}
+}
+
+void
 ionic_lif_configure(struct ionic_lif *lif)
 {
+	struct rte_eth_rxmode *rxmode = &lif->eth_dev->data->dev_conf.rxmode;
+	struct rte_eth_txmode *txmode = &lif->eth_dev->data->dev_conf.txmode;
 	struct ionic_identity *ident = &lif->adapter->ident;
 	uint32_t ntxqs_per_lif =
 		ident->lif.eth.config.queue_count[IONIC_QTYPE_TXQ];
@@ -1614,7 +1629,64 @@ ionic_lif_configure(struct ionic_lif *lif)
 	lif->nrxqcqs = nrxqs_per_lif;
 	lif->ntxqcqs = ntxqs_per_lif;
 
-	return 0;
+	/* Update the LIF configuration based on the eth_dev */
+
+	/*
+	 * NB: While it is true that RSS_HASH is always enabled on ionic,
+	 *     setting this flag unconditionally causes problems in DTS.
+	 * rxmode->offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+	 */
+
+	/* RX per-port */
+
+	if (rxmode->offloads & DEV_RX_OFFLOAD_IPV4_CKSUM ||
+	    rxmode->offloads & DEV_RX_OFFLOAD_UDP_CKSUM ||
+	    rxmode->offloads & DEV_RX_OFFLOAD_TCP_CKSUM)
+		lif->features |= IONIC_ETH_HW_RX_CSUM;
+	else
+		lif->features &= ~IONIC_ETH_HW_RX_CSUM;
+
+	if (rxmode->offloads & DEV_RX_OFFLOAD_SCATTER) {
+		lif->features |= IONIC_ETH_HW_RX_SG;
+		lif->eth_dev->data->scattered_rx = 1;
+	} else {
+		lif->features &= ~IONIC_ETH_HW_RX_SG;
+		lif->eth_dev->data->scattered_rx = 0;
+	}
+
+	/* Covers VLAN_STRIP */
+	ionic_lif_configure_vlan_offload(lif, ETH_VLAN_STRIP_MASK);
+
+	/* TX per-port */
+
+	if (txmode->offloads & DEV_TX_OFFLOAD_IPV4_CKSUM ||
+	    txmode->offloads & DEV_TX_OFFLOAD_UDP_CKSUM ||
+	    txmode->offloads & DEV_TX_OFFLOAD_TCP_CKSUM ||
+	    txmode->offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM ||
+	    txmode->offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM)
+		lif->features |= IONIC_ETH_HW_TX_CSUM;
+	else
+		lif->features &= ~IONIC_ETH_HW_TX_CSUM;
+
+	if (txmode->offloads & DEV_TX_OFFLOAD_VLAN_INSERT)
+		lif->features |= IONIC_ETH_HW_VLAN_TX_TAG;
+	else
+		lif->features &= ~IONIC_ETH_HW_VLAN_TX_TAG;
+
+	if (txmode->offloads & DEV_TX_OFFLOAD_MULTI_SEGS)
+		lif->features |= IONIC_ETH_HW_TX_SG;
+	else
+		lif->features &= ~IONIC_ETH_HW_TX_SG;
+
+	if (txmode->offloads & DEV_TX_OFFLOAD_TCP_TSO) {
+		lif->features |= IONIC_ETH_HW_TSO;
+		lif->features |= IONIC_ETH_HW_TSO_IPV6;
+		lif->features |= IONIC_ETH_HW_TSO_ECN;
+	} else {
+		lif->features &= ~IONIC_ETH_HW_TSO;
+		lif->features &= ~IONIC_ETH_HW_TSO_IPV6;
+		lif->features &= ~IONIC_ETH_HW_TSO_ECN;
+	}
 }
 
 int
diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h
index 86d933606..4f48845eb 100644
--- a/drivers/net/ionic/ionic_lif.h
+++ b/drivers/net/ionic/ionic_lif.h
@@ -131,7 +131,8 @@ void ionic_lif_deinit(struct ionic_lif *lif);
 int ionic_lif_start(struct ionic_lif *lif);
 void ionic_lif_stop(struct ionic_lif *lif);
 
-int ionic_lif_configure(struct ionic_lif *lif);
+void ionic_lif_configure(struct ionic_lif *lif);
+void ionic_lif_configure_vlan_offload(struct ionic_lif *lif, int mask);
 void ionic_lif_reset(struct ionic_lif *lif);
 
 int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr);
diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c
index d06f1246c..cf7ff6ce7 100644
--- a/drivers/net/ionic/ionic_rxtx.c
+++ b/drivers/net/ionic/ionic_rxtx.c
@@ -675,6 +675,9 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 		"Configuring skt %u RX queue %u with %u buffers, offloads %jx",
 		socket_id, rx_queue_id, nb_desc, offloads);
 
+	if (!rx_conf->rx_drop_en)
+		IONIC_PRINT(WARNING, "No-drop mode is not supported");
+
 	/* Validate number of receive descriptors */
 	if (!rte_is_power_of_2(nb_desc) ||
 			nb_desc < IONIC_MIN_RING_DESC ||
@@ -685,9 +688,6 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 		return -EINVAL; /* or use IONIC_DEFAULT_RING_DESC */
 	}
 
-	if (rx_conf->offloads & DEV_RX_OFFLOAD_SCATTER)
-		eth_dev->data->scattered_rx = 1;
-
 	/* Free memory prior to re-allocation if needed... */
 	if (eth_dev->data->rx_queues[rx_queue_id] != NULL) {
 		void *rx_queue = eth_dev->data->rx_queues[rx_queue_id];
-- 
2.17.1


  reply	other threads:[~2021-01-11 19:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 19:02 [dpdk-dev] [PATCH 0/6] net/ionic: fix device configuration and init Andrew Boyer
2021-01-11 19:02 ` Andrew Boyer [this message]
2021-01-11 19:02 ` [dpdk-dev] [PATCH 2/6] net/ionic: combine queue init and enable commands Andrew Boyer
2021-01-11 19:02 ` [dpdk-dev] [PATCH 3/6] net/ionic: set port admin state to up in port init Andrew Boyer
2021-01-11 19:02 ` [dpdk-dev] [PATCH 4/6] net/ionic: don't add station MAC filter on init Andrew Boyer
2021-01-11 19:02 ` [dpdk-dev] [PATCH 5/6] net/ionic: clear up confusion around FC autoneg Andrew Boyer
2021-01-11 19:02 ` [dpdk-dev] [PATCH 6/6] net/ionic: correctly set link speed and autonegotiation Andrew Boyer
2021-01-18 17:10   ` Ferruh Yigit
2021-01-18 17:09 ` [dpdk-dev] [PATCH 0/6] net/ionic: fix device configuration and init Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210111190209.70928-2-aboyer@pensando.io \
    --to=aboyer@pensando.io \
    --cc=cardigliano@ntop.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).