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]; From patchwork Mon Jan 11 19:02:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 86344 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 07D0FA04B5; Mon, 11 Jan 2021 20:02:35 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F77314101A; Mon, 11 Jan 2021 20:02:34 +0100 (CET) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mails.dpdk.org (Postfix) with ESMTP id EF673141019 for ; Mon, 11 Jan 2021 20:02:32 +0100 (CET) Received: by mail-pj1-f54.google.com with SMTP id b5so113644pjl.0 for ; Mon, 11 Jan 2021 11:02:32 -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=64WJ/yuiQU7a42lxH10ubhqKTX93wC3EhlLHBBNoFI8=; b=HQXQIltUuoaGI5kgc4oyWIEcIWMyGq0MoCT3mMkdBNHdotrwXNW7Rcdc50NDG0l2zt 7crdip2sSbrjc/bAUDfQOBOWyc5SkpcCPC5I0aVP+5+K/iHrtwc6Q4e3F7U7msMmr+DX 5Gc2mOPrqTXEITrmympI4B7CLT/9f3EUvT1eUzfQWrDFpzFaOPAsXTWMvDweTZRpNXQB ystN0YnfO1gBR+7Nk11lvaaDhsYXLb9Z85vY6vGb/PtW6K8SulsQfGOEqk+6AzO3GK0o u7EPtToec6Q/0bgOLd2m5Jf6TOEIe4mgN1QfXIfcXHXtQaSPfog6qEkg/9oCs1I8TK3n trYw== 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=64WJ/yuiQU7a42lxH10ubhqKTX93wC3EhlLHBBNoFI8=; b=p7l9/ZqgVUf3q5yWnlBWAZ2YSLsdgC+OE7JdHOTEnfkDb9akXwSETXsk67ZVK81Kys mTk0egLyGHd3/BE0cycjUvQtoi23acpQrap4LB0/rnutxqXEAVgKOyyBRBoyzhAfGmNl CzrK4Mag1IkmrroYO4auyswnHhhb4+JXjArwMVXdRzTUFmdGQc98m4id5PYWtUWBisH9 AovuUssivFO7/LhbydMvzi/HLO+JlFkEDG4/g8rsXpBUOLFCufKPsa5z9UQ3RBTvi8qt XAbnDVMsiGtk04qp8XQ0OA+Mats+t7iDHlyBYglcrZp/m+M+/qVPSo0Lwa3u2gHa/zsb 1PUA== X-Gm-Message-State: AOAM53216rIAClHK/MmxuHPipTlS5syTFMPygYXMHHIbw+zwKEeK8FNY wxBXqabAfSOvopTpClYsH4D6T0vWUlQ81A== X-Google-Smtp-Source: ABdhPJz7hlCR1xFVO2B1gGAvo8/jPymdG+7efORG+H2D3QNvg8fQt+7vAvrODSYCmO4El3DKI3mN8A== X-Received: by 2002:a17:90a:12c4:: with SMTP id b4mr294209pjg.234.1610391751737; Mon, 11 Jan 2021 11:02:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 11:02:31 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer , Neel Patel Date: Mon, 11 Jan 2021 11:02:05 -0800 Message-Id: <20210111190209.70928-3-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 2/6] net/ionic: combine queue init and enable commands 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" Adding F_ENA to the q_init command has the same effect as q_enable. This reduces the startup time a bit. Signed-off-by: Andrew Boyer Signed-off-by: Neel Patel --- drivers/net/ionic/ionic_lif.c | 4 ++-- drivers/net/ionic/ionic_rxtx.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index ed1595e62..673f789f3 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1371,7 +1371,7 @@ ionic_lif_txq_init(struct ionic_qcq *qcq) .opcode = IONIC_CMD_Q_INIT, .type = q->type, .index = q->index, - .flags = IONIC_QINIT_F_SG, + .flags = IONIC_QINIT_F_SG | IONIC_QINIT_F_ENA, .intr_index = cq->bound_intr->index, .ring_size = rte_log2_u32(q->num_descs), .ring_base = q->base_pa, @@ -1417,7 +1417,7 @@ ionic_lif_rxq_init(struct ionic_qcq *qcq) .opcode = IONIC_CMD_Q_INIT, .type = q->type, .index = q->index, - .flags = IONIC_QINIT_F_SG, + .flags = IONIC_QINIT_F_SG | IONIC_QINIT_F_ENA, .intr_index = cq->bound_intr->index, .ring_size = rte_log2_u32(q->num_descs), .ring_base = q->base_pa, diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index cf7ff6ce7..5d0e9d5d5 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -232,10 +232,10 @@ ionic_dev_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) err = ionic_lif_txq_init(txq); if (err) return err; + } else { + ionic_qcq_enable(txq); } - ionic_qcq_enable(txq); - tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; return 0; @@ -988,6 +988,8 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) err = ionic_lif_rxq_init(rxq); if (err) return err; + } else { + ionic_qcq_enable(rxq); } /* Allocate buffers for descriptor rings */ @@ -997,8 +999,6 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) return -1; } - ionic_qcq_enable(rxq); - rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; return 0; From patchwork Mon Jan 11 19:02:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 86345 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 50455A04B5; Mon, 11 Jan 2021 20:02:45 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DED5E141025; Mon, 11 Jan 2021 20:02:36 +0100 (CET) Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by mails.dpdk.org (Postfix) with ESMTP id A893F141012 for ; Mon, 11 Jan 2021 20:02:35 +0100 (CET) Received: by mail-pj1-f42.google.com with SMTP id f14so94286pju.4 for ; Mon, 11 Jan 2021 11:02:35 -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=rgpIY9ZwVya+U/xlAbFYv0Fb5ZRb4c8cV3sNomAkSiI=; b=v0IWVam7cD6qyOssSMGmpTn86HUXb8/kAsgFh9PB/xnUBEWYzEFgxbn0x6RK6B6iLy GjETQyZqaAx1EIHLHqZCbWvTC+9FGq28IeCWK/DmC9/RyMdKcKw7lDOOgfeaCrFNKe1n npi/Hb5oBob+TtzM+XSub39eERRczhdFDdv8qoofZXSVO65bzAZQsD1mm6ujFi0pgBjX C6yo+qYJgEUC2kVnOajuZyYl0+RfMOkJnVsaySDgTxOv7a7jrhsyfqaxY/kOI7rpncqq bGJvLKnLxkmLgP8A1RUryz8DETU3FoV+XIXhKJ55/Hb14Lc7yHpTTn8oMCsqx/pqYSM9 S4+A== 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=rgpIY9ZwVya+U/xlAbFYv0Fb5ZRb4c8cV3sNomAkSiI=; b=OoC4Dt9sjc3PeikZzWK/G/0JbrpdplQ3zUuQBHz/S44+d6tdYGq37UwpeThNSmikH/ /+fAGce+KHlPi2UxJOBJI7ePAj6EX2tweuZK4bEfKTM/EcAcb1cztEU9PJVL23/iesuv yfmW5strk4TKp6Bn7KdAHSz/l+vdtvKJNHFV+UvUo9a5xWYP3/p2opC/LlVhXu/euxP6 DUu8fDXCrbro9HSntorYtsmQMdUxZebkZnEs49vOPx6+xenDwzdwGXQQwheC9JtlAqYB gOVBpEaAQuZ9h/y0hOKrtYjQIsunH44/WLW7pEnoFDp6CR0Rf3FOa8N55n7io0kgo2P2 DpJA== X-Gm-Message-State: AOAM532cbOVHKpNPrthrwN2Ik1GbhoyOz7kILgSzZdCqbql5fD0ofCtG EDqWvLpEw9d6A2AcoUn2CXoQTPN2gOyaAQ== X-Google-Smtp-Source: ABdhPJyuFJKayq1TdwgphyPVcEbF00IdGzZ1hJ3YPYSRiN4eZcAYBiOqnhEXgbUTQLRxEYVWkrbo5g== X-Received: by 2002:a17:90a:658c:: with SMTP id k12mr290083pjj.224.1610391754775; Mon, 11 Jan 2021 11:02:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 11:02:34 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer , Neel Patel Date: Mon, 11 Jan 2021 11:02:06 -0800 Message-Id: <20210111190209.70928-4-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 3/6] net/ionic: set port admin state to up in port init 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" This reduces the startup time a bit. Signed-off-by: Andrew Boyer Signed-off-by: Neel Patel --- drivers/net/ionic/ionic_main.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index ce5d11311..467696a54 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -403,21 +403,13 @@ ionic_port_init(struct ionic_adapter *adapter) for (i = 0; i < nwords; i++) iowrite32(ident->port.config.words[i], &idev->dev_cmd->data[i]); + idev->port_info->config.state = IONIC_PORT_ADMIN_STATE_UP; ionic_dev_cmd_port_init(idev); err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); - if (err) { + if (err) IONIC_PRINT(ERR, "Failed to init port"); - return err; - } - - ionic_dev_cmd_port_state(idev, IONIC_PORT_ADMIN_STATE_UP); - err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); - if (err) { - IONIC_PRINT(WARNING, "Failed to bring port UP"); - return err; - } - return 0; + return err; } int From patchwork Mon Jan 11 19:02:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 86346 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 D1D21A04B5; Mon, 11 Jan 2021 20:02:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2B55314102D; Mon, 11 Jan 2021 20:02:39 +0100 (CET) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 0611F141029 for ; Mon, 11 Jan 2021 20:02:38 +0100 (CET) Received: by mail-pl1-f177.google.com with SMTP id g3so350593plp.2 for ; Mon, 11 Jan 2021 11:02:37 -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=cI3rgAbwisSV2D5k2lKJEWxTrseF14za2EWgKtbU1pQ=; b=Kn3ETVZ0i3shyVEUA/GJQMzIYyMXx8nPU3ZiXfuiLeqlahKCS9xnryYkJOKP9/KR2s F7tiy/w06FV5J/gsrea1F4nIVgOpzLdngjFC85yVQh79HaH/XE8J7hIONDm6Pe6uiGm/ 1oYhOW2PolZU2t6k7B/RU0c2omQqbn7aofswDpVxCewlWucg0ZW3hCPy8IUFZolXigJh +jlQ4dEhMHfHwM2kR4RcZi2ZyxiJ+jxc7crtSwYOs8LC/CHexv054N09TBot7rfeTcJv u/pl26+EZqx2pogh6VnkP1eF25h0ptGzzC7T1eTtKqcP9SJei3pw6gxRahCZdB5RKGLs +4rA== 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=cI3rgAbwisSV2D5k2lKJEWxTrseF14za2EWgKtbU1pQ=; b=b1o4DQC5G0urd3/TP7QBVaeU2L58gKQv6qXiG9taexPUYCEi7oIGuVNjKw2zd9YxDc tChNasTuqOOBpXbZy28+SA8nxCk6jsafxzXIKb203chDhoLQASSuNyLLHt9eTRvaSZKu ydecMu3c0DTn9vYFwiu9tJUhiIfo8S2QMtjmUvLo9pcExobnZY+jDvWaAz6Qb2jHxCfe 82TW7r9RqFOiQ0G2vJru8n3I2eNlXlKYok/WcbUvVy9LommqzU/1yCaj89sb67OgEl7l iHRmihQPhgGW1vh0+/h5YbGb4PJAjYjtnuN7qX3mM3cLcgZgfRULZT0cbDFvxnnXb6sI JXng== X-Gm-Message-State: AOAM531osglBgWTtXBEYo4KHElxSjl71QCa9x+7TAaBvWtQzyk53x4HC Q5439W7jKuvUS6LWhXLstTdNJ/nrVMOYTA== X-Google-Smtp-Source: ABdhPJwidRfBVZBKkQ1nTq+nCBoqEhje3nvgN3Hcoybu8REmzzp31m52Y6kpE83GRfSRZrm+ZqmF4A== X-Received: by 2002:a17:902:cb95:b029:dc:3a38:c7df with SMTP id d21-20020a170902cb95b02900dc3a38c7dfmr679965ply.49.1610391757062; Mon, 11 Jan 2021 11:02:37 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 11:02:36 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer , Neel Patel Date: Mon, 11 Jan 2021 11:02:07 -0800 Message-Id: <20210111190209.70928-5-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 4/6] net/ionic: don't add station MAC filter on init 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" The address is not needed in the firmware. This reduces the startup time a bit. Signed-off-by: Andrew Boyer Signed-off-by: Neel Patel --- drivers/net/ionic/ionic_lif.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 673f789f3..f39b54e8e 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1469,24 +1469,8 @@ ionic_station_set(struct ionic_lif *lif) if (err) return err; - if (!rte_is_zero_ether_addr((struct rte_ether_addr *) - lif->mac_addr)) { - IONIC_PRINT(INFO, "deleting station MAC addr"); - - ionic_lif_addr_del(lif, lif->mac_addr); - } - memcpy(lif->mac_addr, ctx.comp.lif_getattr.mac, RTE_ETHER_ADDR_LEN); - if (rte_is_zero_ether_addr((struct rte_ether_addr *)lif->mac_addr)) { - IONIC_PRINT(NOTICE, "empty MAC addr (VF?)"); - return 0; - } - - IONIC_PRINT(DEBUG, "adding station MAC addr"); - - ionic_lif_addr_add(lif, lif->mac_addr); - return 0; } From patchwork Mon Jan 11 19:02:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 86347 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 B966AA04B5; Mon, 11 Jan 2021 20:03:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6407C14102B; Mon, 11 Jan 2021 20:02:41 +0100 (CET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 2DCF3141031 for ; Mon, 11 Jan 2021 20:02:40 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id q4so335101plr.7 for ; Mon, 11 Jan 2021 11:02:40 -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=4A2XR7Lvc/O1iv2ByaZLiIt9DUnlARzCWCer+32JKe4=; b=kCOFVpJa7dhpHvhxQkHUBnbUh1B5pWnNsmO+s/wDf2NgJyaAmEARacP0mjhlPLN6aM FeCnOYqCky+Tu6x13BPN1E0CpuT76n2twuibsmOzCCJSELLdwDYP+g14qIPdSzacX6us Ts4bJnmd/DiZavH5bj954bxxtuwgyih+ALX/oYH3ov1V+ZtTWSafofN/I9JG/ou9/eyw 2kWVBRnHjVmNaiZQoFSe2zvj02+uvdGhkBZU7uju55jlK4xBoMNo6BdDI0loEhFttV9W L66Xtf0P+mp3TmOvLVOmkZr+gFSe3rJq6TdnDJCr4s7Dxgc3T8J8FvCyjw/IHE4Iw6mj MgLg== 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=4A2XR7Lvc/O1iv2ByaZLiIt9DUnlARzCWCer+32JKe4=; b=AY22rCrOU37G9TSKAu9x49NBp2+PYt3tqgF7/EtYhKpLB6pJ3qH5t0ROVUcLf1vSZc /fDs01eCYW4N1U+HVS9EEOmDjBz3wcyOfl7yLTxfS0GUgWT1oa0wvwgcdAkfSMMkXU1x uX7BRE/XtCcXodjF4fBJZTqCpHxApHpa3dPsmvjajUbu8Trhqxqg8DK6iiMZaGHWRSxg fB0ghGFpciW0a3GPrYV0p/WiYZTFrDospit24meEm42iqCWLTCBeMu7ViTzbvb489kIQ u/S8X5Bwq6qL9A1NvJCOPAgqe1GeMfGm7KbwFtPANTtYmZLwyuPWGqG+sxUBLjLOZEBH 1ixg== X-Gm-Message-State: AOAM533oEatpoBjV+S+rHAfsQ00o/I2tHIJPidStVrPWFMj50qag02n7 ChF4GjioIm+CrZy8yDwAT3OJ6XD3BSDyRw== X-Google-Smtp-Source: ABdhPJzOVrWwNVkRXLGvne675o/BejIgcTaXj8Wnrl3er6NIjXj/5gS+LkOuFTJh6/GkPqdp6B91eQ== X-Received: by 2002:a17:902:7489:b029:dc:bbf:d70 with SMTP id h9-20020a1709027489b02900dc0bbf0d70mr754249pll.8.1610391759178; Mon, 11 Jan 2021 11:02:39 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 11:02:38 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Mon, 11 Jan 2021 11:02:08 -0800 Message-Id: <20210111190209.70928-6-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 5/6] net/ionic: clear up confusion around FC autoneg 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" IONIC does not support Flow-Control autonegotiation. Always wait for completion after each dev cmd. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_ethdev.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 5ff155f85..838e93ef7 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -463,7 +463,8 @@ ionic_flow_ctrl_get(struct rte_eth_dev *eth_dev, struct ionic_dev *idev = &adapter->idev; if (idev->port_info) { - fc_conf->autoneg = idev->port_info->config.an_enable; + /* Flow control autoneg not supported */ + fc_conf->autoneg = 0; if (idev->port_info->config.pause_type) fc_conf->mode = RTE_FC_FULL; @@ -482,7 +483,12 @@ ionic_flow_ctrl_set(struct rte_eth_dev *eth_dev, struct ionic_adapter *adapter = lif->adapter; struct ionic_dev *idev = &adapter->idev; uint8_t pause_type = IONIC_PORT_PAUSE_TYPE_NONE; - uint8_t an_enable; + int err; + + if (fc_conf->autoneg) { + IONIC_PRINT(WARNING, "Flow control autoneg not supported"); + return -ENOTSUP; + } switch (fc_conf->mode) { case RTE_FC_NONE: @@ -496,12 +502,12 @@ ionic_flow_ctrl_set(struct rte_eth_dev *eth_dev, return -ENOTSUP; } - an_enable = fc_conf->autoneg; - ionic_dev_cmd_port_pause(idev, pause_type); - ionic_dev_cmd_port_autoneg(idev, an_enable); + err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); + if (err) + IONIC_PRINT(WARNING, "Failed to configure flow control"); - return 0; + return err; } static int From patchwork Mon Jan 11 19:02:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 86348 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 7121DA04B5; Mon, 11 Jan 2021 20:03:09 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9245141019; Mon, 11 Jan 2021 20:02:43 +0100 (CET) Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by mails.dpdk.org (Postfix) with ESMTP id 93C59141019 for ; Mon, 11 Jan 2021 20:02:42 +0100 (CET) Received: by mail-pf1-f177.google.com with SMTP id 11so506771pfu.4 for ; Mon, 11 Jan 2021 11:02:42 -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=beTohpLfgb6l8rXBS9/XutfXLVnpDbl3xTEDdbcHP5U=; b=AtFEkQbyS4GmKZZxecdA3+MikvRYaXxmUCpZZvuUIe6waQ0WPOA9RJ4PwfiE0p199G FERPgeU3YJeQReexDEKm89JsRFjUat07i2BKZ06Y+DO+IJEqK2+zFYe/nQwtqiEH1IEs qtU+wBCMgFJZ3yfL/4jy6gWAr19ZbnArJGM3xMBOyCumBUmCQCYt5MVlOou/ydyJbKmz LxUxWhpTOVDwD1wxHRrCHjFvau9+S4XzDDVZoGNOzVoJIy0h/sRY0p7SU+sRs+xtJxGC QhSwhcUvADVLellcF28wZ5vpYsPkEBglii4Sq5e2N9t5nMzgA/GpPY+cBIMMfKHsQ538 x6JQ== 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=beTohpLfgb6l8rXBS9/XutfXLVnpDbl3xTEDdbcHP5U=; b=Bd3bAF81Y9v5m4oVPTqxx3FoC2oCvEaw2VZXVN56lQo/9cr8THq+KCcTHPTPeGg21K NK36ztGjLlJlvFetazz0twZq6x7rNwep3nk5FiGW4A1bZOpN/QYUiSMKxhe/vL/hmDHm R4zA/0Cd/+jk4xb/ztEO2mE9VFObz5xtaA2bkM3NfEEc1LzkkPESx32TZy60j7or0oyp d1dmXm9Fd0QHSpcfSzhRXOxv1/nWPux2cujbZ7ujrBtkLMuMbCuAAltssq7tdPbaImQz otGLaYc/TeG9nKfBCIdS2BQUahtyVmH+fZH0q9ZIEN90wHqbU1a86LD3frDkfX6iXQTL vfrw== X-Gm-Message-State: AOAM531W/znhzz3LMklO8fWvdMu/ddhDwECFSAMvYUwZDQK0MFrORRPo TMAINHXJInzVNmlxykgMUE80KyHj5fkR4w== X-Google-Smtp-Source: ABdhPJz2Qg1ZCRdit1l7xiMUonZlrsev47sYtBWTTx28rKrgKdGCEQocmlysV9u0GbOA1bfpac35MA== X-Received: by 2002:a65:498e:: with SMTP id r14mr922410pgs.235.1610391761639; Mon, 11 Jan 2021 11:02:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 11:02:41 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Mon, 11 Jan 2021 11:02:09 -0800 Message-Id: <20210111190209.70928-7-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 6/6] net/ionic: correctly set link speed and autonegotiation 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" Don't assume autoneg in link_update(). Always call ionic_dev_cmd_port_autoneg() in start(). This allows the client to specify the link settings. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_ethdev.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 838e93ef7..2face7c63 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -276,7 +276,10 @@ ionic_dev_link_update(struct rte_eth_dev *eth_dev, /* Initialize */ memset(&link, 0, sizeof(link)); - link.link_autoneg = ETH_LINK_AUTONEG; + + if (adapter->idev.port_info->config.an_enable) { + link.link_autoneg = ETH_LINK_AUTONEG; + } if (!adapter->link_up || !(lif->state & IONIC_LIF_F_UP)) { @@ -869,7 +872,8 @@ ionic_dev_start(struct rte_eth_dev *eth_dev) struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); struct ionic_adapter *adapter = lif->adapter; struct ionic_dev *idev = &adapter->idev; - uint32_t allowed_speeds; + uint32_t speed = 0, allowed_speeds; + uint8_t an_enable; int err; IONIC_PRINT_CALL(); @@ -896,11 +900,23 @@ ionic_dev_start(struct rte_eth_dev *eth_dev) return err; } - if (eth_dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED) { - uint32_t speed = ionic_parse_link_speeds(dev_conf->link_speeds); + /* Configure link */ + an_enable = (dev_conf->link_speeds & ETH_LINK_SPEED_FIXED) == 0; - if (speed) - ionic_dev_cmd_port_speed(idev, speed); + ionic_dev_cmd_port_autoneg(idev, an_enable); + err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); + if (err) + IONIC_PRINT(WARNING, "Failed to %s autonegotiation", + an_enable ? "enable" : "disable"); + + if (!an_enable) + speed = ionic_parse_link_speeds(dev_conf->link_speeds); + if (speed) { + ionic_dev_cmd_port_speed(idev, speed); + err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); + if (err) + IONIC_PRINT(WARNING, "Failed to set link speed %u", + speed); } ionic_dev_link_update(eth_dev, 0);