From patchwork Thu Mar 8 02:46:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "John Daley (johndale)" X-Patchwork-Id: 35769 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E5B6A6CA3; Thu, 8 Mar 2018 03:49:19 +0100 (CET) Received: from alln-iport-8.cisco.com (alln-iport-8.cisco.com [173.37.142.95]) by dpdk.org (Postfix) with ESMTP id 7477C5F5F for ; Thu, 8 Mar 2018 03:49:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3831; q=dns/txt; s=iport; t=1520477357; x=1521686957; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=wdHiESHvdXcUf0G2jOBLZHEYdlV0UZnHX/Oj0yPCNqU=; b=PRxjLDy99ztRhQlLVwXnKrP1t8mpiHzJLCDFmfm0YK78+0siVyE46zTe DMIe7qrgT0Dxkw33xZ2lodCwlBFX29S3y8LMKV/cg08F1GpJffLx4WoP5 QioHL1HNbBczN+61RuC2Uu/OCgIfTLDicmdj2fU4cEvoVdnqahCEiPaQ/ g=; X-IronPort-AV: E=Sophos;i="5.47,438,1515456000"; d="scan'208";a="80348492" Received: from alln-core-6.cisco.com ([173.36.13.139]) by alln-iport-8.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2018 02:49:16 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-6.cisco.com (8.14.5/8.14.5) with ESMTP id w282nGx3005294; Thu, 8 Mar 2018 02:49:16 GMT Received: by cisco.com (Postfix, from userid 392789) id 12DF320F2001; Wed, 7 Mar 2018 18:49:16 -0800 (PST) From: John Daley To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Hyong Youb Kim Date: Wed, 7 Mar 2018 18:46:56 -0800 Message-Id: <20180308024702.25974-5-johndale@cisco.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180308024702.25974-1-johndale@cisco.com> References: <20180306014634.28398-2-johndale@cisco.com> <20180308024702.25974-1-johndale@cisco.com> Subject: [dpdk-dev] [PATCH v3 04/10] net/enic: remove the VLAN filter handler 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" From: Hyong Youb Kim VIC does not support VLAN filtering at the moment. The firmware does accept the filter add/del commands and returns success. But, they are no-ops. To avoid confusion, remove the filter set handler so the app sees an error instead of silent failure. Also during the device configure time, enicpmd_vlan_offload_set would not print a warning message about unsupported VLAN filtering, because the caller specifies only ETH_VLAN_STRIP_MASK. This is wrong, as we should attempt to apply all requested offloads at the configure time. So, pass all VLAN offload masks, which triggers a warning message about VLAN filtering, if requested. Finally, enicpmd_vlan_offload_set should check both mask and rxmode.offloads, not just mask. Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/enic_ethdev.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index bdbaf4cdf..e5523e311 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -318,40 +318,29 @@ static int enicpmd_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, return enicpmd_dev_setup_intr(enic); } -static int enicpmd_vlan_filter_set(struct rte_eth_dev *eth_dev, - uint16_t vlan_id, int on) -{ - struct enic *enic = pmd_priv(eth_dev); - int err; - - ENICPMD_FUNC_TRACE(); - if (on) - err = enic_add_vlan(enic, vlan_id); - else - err = enic_del_vlan(enic, vlan_id); - return err; -} - static int enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) { struct enic *enic = pmd_priv(eth_dev); + uint64_t offloads; ENICPMD_FUNC_TRACE(); + offloads = eth_dev->data->dev_conf.rxmode.offloads; if (mask & ETH_VLAN_STRIP_MASK) { - if (eth_dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_STRIP) + if (offloads & DEV_RX_OFFLOAD_VLAN_STRIP) enic->ig_vlan_strip_en = 1; else enic->ig_vlan_strip_en = 0; } - if (mask & ETH_VLAN_FILTER_MASK) { + if ((mask & ETH_VLAN_FILTER_MASK) && + (offloads & DEV_RX_OFFLOAD_VLAN_FILTER)) { dev_warning(enic, "Configuration of VLAN filter is not supported\n"); } - if (mask & ETH_VLAN_EXTEND_MASK) { + if ((mask & ETH_VLAN_EXTEND_MASK) && + (offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)) { dev_warning(enic, "Configuration of extended VLAN is not supported\n"); } @@ -362,6 +351,7 @@ static int enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) static int enicpmd_dev_configure(struct rte_eth_dev *eth_dev) { int ret; + int mask; struct enic *enic = pmd_priv(eth_dev); if (rte_eal_process_type() != RTE_PROC_PRIMARY) @@ -376,7 +366,11 @@ static int enicpmd_dev_configure(struct rte_eth_dev *eth_dev) enic->hw_ip_checksum = !!(eth_dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_CHECKSUM); - ret = enicpmd_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK); + /* All vlan offload masks to apply the current settings */ + mask = ETH_VLAN_STRIP_MASK | + ETH_VLAN_FILTER_MASK | + ETH_VLAN_EXTEND_MASK; + ret = enicpmd_vlan_offload_set(eth_dev, mask); if (ret) { dev_err(enic, "Failed to configure VLAN offloads\n"); return ret; @@ -710,7 +704,7 @@ static const struct eth_dev_ops enicpmd_eth_dev_ops = { .dev_infos_get = enicpmd_dev_info_get, .dev_supported_ptypes_get = enicpmd_dev_supported_ptypes_get, .mtu_set = enicpmd_mtu_set, - .vlan_filter_set = enicpmd_vlan_filter_set, + .vlan_filter_set = NULL, .vlan_tpid_set = NULL, .vlan_offload_set = enicpmd_vlan_offload_set, .vlan_strip_queue_set = NULL,