From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3221CA0577; Mon, 13 Apr 2020 21:45:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5671F1C123; Mon, 13 Apr 2020 21:42:23 +0200 (CEST) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by dpdk.org (Postfix) with ESMTP id 457C11C10D for ; Mon, 13 Apr 2020 21:42:20 +0200 (CEST) Received: by mail-pf1-f195.google.com with SMTP id x3so4724639pfp.7 for ; Mon, 13 Apr 2020 12:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lhUKNr4BQDS/JwGej21/sv8hNab8o984cmrf4FSZAmY=; b=T0+OcdN1BWQPnbTIQc/H61c3uSODXrw9Hov+rgIFbWHDTw/b1HtiQDB5cEBlIDDRjK 1ukxrboZErGMsdJcHzOwiwMgUviXTitVddvwKpwz96VJLZvSkvp2QDYiFttjadyqBfaF 389ZgH+RBY1VD/X4ryzS6IEtCGoeEKZ61Utd8= 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:mime-version:content-transfer-encoding; bh=lhUKNr4BQDS/JwGej21/sv8hNab8o984cmrf4FSZAmY=; b=XajZmGF20XdvkNyZ5e29OHZvw3mUQ7SrJa9aFzfwMpfWzlemiXI8udqeXdyBprJz5m o1lEnHSSPlgC6k4ei9wnEa9FD+Ud0gVZagcxeyOjT9fsdkAhojfzGgtyyxcNKq5HwdIl kbw0AnvNVrJhcFCcc3rvPEydJN97j5bIdEHdRiEu+GPDxO/iqAAxCAziC8Q6m8+qZ7CJ 2mtRtyKMD//J9GyyL1TxiaxyJepKbNA+qzCixKoupe36PS+9o3VbPAITNhyKfe3mXhoW n4ZVBjAjxoO+lIQQL920UgDkkmjAnWKD2Sb5n3hs5yYkZMKBLy6ESgGRdYrfAvCVHlJA 03sg== X-Gm-Message-State: AGi0PubfqfVET+kGJ/FOeba6ubRFMdjHbeulXjKnLA1Ml3oMvr35EDkW ACAlguG5MUg2jwSDN/pbOz8Do2YJnUFwLj+ZhUOFah97lO+y3L7IE5UvFP+hITe8kPdd8DqtfWY Fj3GFHyIIxLUDhUtLIcSqrO8HAt0YlnFLtnNkq1jmj2gMf9M/E44/ZBkQAvAkP0Jq6sSN X-Google-Smtp-Source: APiQypL2Y5Qe8TDkhJu0ollZDa1rhlFYoXTloy+9ZnCKOmru0LRMRQEhyW8bUiktACVWOBgJjWD9uQ== X-Received: by 2002:a62:7c8b:: with SMTP id x133mr18875676pfc.229.1586806939045; Mon, 13 Apr 2020 12:42:19 -0700 (PDT) Received: from S60.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 9sm1381663pfn.204.2020.04.13.12.42.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Apr 2020 12:42:18 -0700 (PDT) From: Venkat Duvvuru To: dev@dpdk.org Cc: Venkat Duvvuru Date: Tue, 14 Apr 2020 01:09:52 +0530 Message-Id: <1586806811-21736-16-git-send-email-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1586806811-21736-1-git-send-email-venkatkumar.duvvuru@broadcom.com> References: <1584459511-5353-1-git-send-email-venkatkumar.duvvuru@broadcom.com> <1586806811-21736-1-git-send-email-venkatkumar.duvvuru@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 15/34] net/bnxt: add devargs parameter for host memory based TRUFLOW feature X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 feature can be enabled by passing "-w 0000:0d:00.0,host-based-truflow=1” to the DPDK application. Signed-off-by: Venkat Duvvuru Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt.h | 4 ++- drivers/net/bnxt/bnxt_ethdev.c | 73 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index c4507f7..cd84ebd 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -685,7 +685,9 @@ struct bnxt { #define BNXT_SVIF_INVALID 0xFFFF uint16_t func_svif; uint16_t port_svif; - struct tf tfp; + + struct tf tfp; + uint8_t truflow; }; int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 57ed90f..c4bbf1d 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "bnxt.h" #include "bnxt_filter.h" @@ -126,6 +127,18 @@ static const struct rte_pci_id bnxt_pci_id_map[] = { DEV_RX_OFFLOAD_SCATTER | \ DEV_RX_OFFLOAD_RSS_HASH) +#define BNXT_DEVARG_TRUFLOW "host-based-truflow" +static const char *const bnxt_dev_args[] = { + BNXT_DEVARG_TRUFLOW, + NULL +}; + +/* + * truflow == false to disable the feature + * truflow == true to enable the feature + */ +#define BNXT_DEVARG_TRUFLOW_INVALID(truflow) ((truflow) > 1) + 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); static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev); @@ -4854,6 +4867,63 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev) } static int +bnxt_parse_devarg_truflow(__rte_unused const char *key, + const char *value, void *opaque_arg) +{ + struct bnxt *bp = opaque_arg; + unsigned long truflow; + char *end = NULL; + + if (!value || !opaque_arg) { + PMD_DRV_LOG(ERR, + "Invalid parameter passed to truflow devargs.\n"); + return -EINVAL; + } + + truflow = strtoul(value, &end, 10); + if (end == NULL || *end != '\0' || + (truflow == ULONG_MAX && errno == ERANGE)) { + PMD_DRV_LOG(ERR, + "Invalid parameter passed to truflow devargs.\n"); + return -EINVAL; + } + + if (BNXT_DEVARG_TRUFLOW_INVALID(truflow)) { + PMD_DRV_LOG(ERR, + "Invalid value passed to truflow devargs.\n"); + return -EINVAL; + } + + bp->truflow = truflow; + if (bp->truflow) + PMD_DRV_LOG(INFO, "Host-based truflow feature enabled.\n"); + + return 0; +} + +static void +bnxt_parse_dev_args(struct bnxt *bp, struct rte_devargs *devargs) +{ + struct rte_kvargs *kvlist; + + if (devargs == NULL) + return; + + kvlist = rte_kvargs_parse(devargs->args, bnxt_dev_args); + if (kvlist == NULL) + return; + + /* + * Handler for "truflow" devarg. + * Invoked as for ex: "-w 0000:00:0d.0,host-based-truflow=1” + */ + rte_kvargs_process(kvlist, BNXT_DEVARG_TRUFLOW, + bnxt_parse_devarg_truflow, bp); + + rte_kvargs_free(kvlist); +} + +static int bnxt_dev_init(struct rte_eth_dev *eth_dev) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); @@ -4879,6 +4949,9 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) bp = eth_dev->data->dev_private; + /* Parse dev arguments passed on when starting the DPDK application. */ + bnxt_parse_dev_args(bp, pci_dev->device.devargs); + bp->flags &= ~BNXT_FLAG_RX_VECTOR_PKT_MODE; if (bnxt_vf_pciid(pci_dev->id.device_id)) -- 2.7.4