From patchwork Mon Jan 11 19:02:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 86343 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 365CBA04B5; Mon, 11 Jan 2021 20:02:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19A06141013; Mon, 11 Jan 2021 20:02:28 +0100 (CET) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id 49522141012 for ; Mon, 11 Jan 2021 20:02:27 +0100 (CET) Received: by mail-pf1-f176.google.com with SMTP id m6so514905pfk.1 for ; Mon, 11 Jan 2021 11:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=e72vFuhHQhH/PAW4u3o7wSmFNTTWiakWsuHlenqWXOw=; b=z61EZe9Ch0j0IehnhtaPvrxUoJkTInvYQ9b/3HtpsKJvmeL0Ww81ukeZjSJrS5KKOR 6eogbNH61FU0ELayclnClwgWUCzVp1Kob1XjrbYT1UFQK3dnbxc9Z4F0te9f7SITi1P3 s4hFCWwtTNkSvlx+UpvuOHw55aZbZFruEBOJH/E0vupmoT6ENgHKemLEfy9rErKJaU+u FJZfeNYWiZl/PAcj/Z6VsJnLJC/DUmPUrSOrM2ElwLITRgAP5M98JTKjwJn+kI7zTbqx uOfmRmyX4cKlsJTMqO9bO2d2UKi+0nD8oMCM+8wQVa+5UBhyybCkJa9ncHuvxjr+Pc7v Q/Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e72vFuhHQhH/PAW4u3o7wSmFNTTWiakWsuHlenqWXOw=; b=rzUQdzBxWlc7WlB6vBA1/UsMNWG1ruGY3m2CHDwq2oFA/wSrjoz7MbNiw6pvlrv/cn 4c18IM8UdAad6iqyVDcsJ+rvyLMIarq6t1cyYAaIMJeVQdo/JGvlw3HepQR6ljQodQ50 vQ27BrGqnBC+9uEzFqvpR1p00BH4CngZTaOn9w8dAg2K9Cn4VPdNIuokJgBhMvyTedaE f5Oqx5jIBxm0omtCCk7d1p3xutwHqspPzYR7dh9zdDaHuAr7uZDjRHuzQJ6YpHaq8Kyw l+ZNQK4a0YzgaKeOnMABL9eZSRsrgDisXpZ/rDOk/J/KCFxtQjZ4TLhCyOSWetmfEXUW GcOg== X-Gm-Message-State: AOAM530B3fAeBglLIKkJIYdu13WxYga3MMh2NXgZSRo+7mxATl4UI3ql DBFojFXPummO+KUPr+58J+72WUb5FMOCMg== X-Google-Smtp-Source: ABdhPJyYJS/aVpIGDqJtAzbiQYHHkyIfTcW3nVCy1J+oWPUXjRcNdn0hbBSdoK87uclsUxedTYnXIg== X-Received: by 2002:a63:4c11:: with SMTP id z17mr892601pga.437.1610391746152; Mon, 11 Jan 2021 11:02:26 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id x1sm361858pfc.112.2021.01.11.11.02.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 11:02:25 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Mon, 11 Jan 2021 11:02:04 -0800 Message-Id: <20210111190209.70928-2-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210111190209.70928-1-aboyer@pensando.io> References: <20210111190209.70928-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH 1/6] net/ionic: revise configuration flag handling X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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 = ð_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 = ð_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];