From patchwork Tue Mar 6 01:46:28 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: 35671 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 D70812BE5; Tue, 6 Mar 2018 02:46:44 +0100 (CET) Received: from rcdn-iport-9.cisco.com (rcdn-iport-9.cisco.com [173.37.86.80]) by dpdk.org (Postfix) with ESMTP id 802891BE0 for ; Tue, 6 Mar 2018 02:46:41 +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=1520300801; x=1521510401; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=wdHiESHvdXcUf0G2jOBLZHEYdlV0UZnHX/Oj0yPCNqU=; b=Aql4uO2V454dqi1yyq8JWuHUcgpQMWa81GAOPyYT9XQ21syKluSb89iX 9FfEVEU1NP35f3WANoK2WwdiJYubSJ1aJ2fkeHHOU3JU7LlANjikbAXGK GlUDzIseiLQ3xLlsG0+7tgzjq5dKNBJL+m3RyJygn6+Ov/ncrUVkw4oJu Q=; X-IronPort-AV: E=Sophos;i="5.47,429,1515456000"; d="scan'208";a="357024685" Received: from alln-core-11.cisco.com ([173.36.13.133]) by rcdn-iport-9.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2018 01:46:40 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-11.cisco.com (8.14.5/8.14.5) with ESMTP id w261kes4005094; Tue, 6 Mar 2018 01:46:40 GMT Received: by cisco.com (Postfix, from userid 392789) id 5602F20F2005; Mon, 5 Mar 2018 17:46:40 -0800 (PST) From: John Daley To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Hyong Youb Kim Date: Mon, 5 Mar 2018 17:46:28 -0800 Message-Id: <20180306014634.28398-5-johndale@cisco.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180306014634.28398-1-johndale@cisco.com> References: <20180224191748.20908-10-johndale@cisco.com> <20180306014634.28398-1-johndale@cisco.com> Subject: [dpdk-dev] [PATCH v2 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,