From patchwork Tue Jul 24 02:36:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao1, Wei" X-Patchwork-Id: 43287 X-Patchwork-Delegate: qi.z.zhang@intel.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 5A395F72; Tue, 24 Jul 2018 04:58:46 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id AE100160; Tue, 24 Jul 2018 04:58:44 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jul 2018 19:58:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,396,1526367600"; d="scan'208";a="247775196" Received: from dpdk6.bj.intel.com ([172.16.182.94]) by fmsmga005.fm.intel.com with ESMTP; 23 Jul 2018 19:58:40 -0700 From: Wei Zhao To: dev@dpdk.org Cc: ferruh.yigit@intel.com, stable@dpdk.org, Wei Zhao , Wenzhuo Lu Date: Tue, 24 Jul 2018 10:36:51 +0800 Message-Id: <1532399811-52078-1-git-send-email-wei.zhao1@intel.com> X-Mailer: git-send-email 2.7.5 Subject: [dpdk-dev] [PATCH] net/ixgbe: remove hardcoded CRC STRIP config from ixgbe 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" There is CRC related ifdefs for ixgbe: CONFIG_RTE_LIBRTE_IXGBE_PF_DISABLE_STRIP_CRC=n It is used in VF drivers ixgbevf_dev_configure() functions. VF cannot change the CRC strip behavior and based on what PF configured it needs to response proper to user ixgbevf_dev_configure() request. Right now what PF set is defined by above config options but this method is too static. Signed-off-by: Wei Zhao Signed-off-by: Wenzhuo Lu --- app/test-pmd/parameters.c | 6 ++++++ app/test-pmd/testpmd.c | 2 ++ app/test-pmd/testpmd.h | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++---------- lib/librte_ethdev/rte_ethdev.h | 1 + 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 962fad7..b981b0f 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -188,6 +188,7 @@ usage(char* progname) printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n"); printf(" --hot-plug: enable hot plug for device.\n"); printf(" --vxlan-gpe-port=N: UPD port of tunnel VXLAN-GPE\n"); + printf(" --pf-crc-keep: disable pf CRC strip function for device\n"); printf(" --mlockall: lock all memory\n"); printf(" --no-mlockall: do not lock all memory\n"); } @@ -623,6 +624,7 @@ launch_args_parse(int argc, char** argv) { "tx-offloads", 1, 0, 0 }, { "hot-plug", 0, 0, 0 }, { "vxlan-gpe-port", 1, 0, 0 }, + { "pf-crc-keep", 0, 0, 0 }, { "mlockall", 0, 0, 0 }, { "no-mlockall", 0, 0, 0 }, { 0, 0, 0, 0 }, @@ -1131,6 +1133,9 @@ launch_args_parse(int argc, char** argv) rte_exit(EXIT_FAILURE, "vxlan-gpe-port must be >= 0\n"); } + if (!strcmp(lgopts[opt_idx].name, "pf-crc-keep")) { + rx_offloads_disable |= DEV_RX_OFFLOAD_CRC_STRIP; + } if (!strcmp(lgopts[opt_idx].name, "print-event")) if (parse_event_printing_config(optarg, 1)) { rte_exit(EXIT_FAILURE, @@ -1163,4 +1168,5 @@ launch_args_parse(int argc, char** argv) /* Set offload configuration from command line parameters. */ rx_mode.offloads = rx_offloads; tx_mode.offloads = tx_offloads; + rx_mode.offloads_disable = rx_offloads_disable; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index d3ce92f..c94328a 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -287,6 +287,8 @@ uint8_t rmv_interrupt = 1; /* enabled by default */ uint8_t hot_plug = 0; /**< hotplug disabled by default. */ +uint64_t rx_offloads_disable = 0; /**< rx offload enabled by default. */ + /* * Display or mask ether events * Default to all events except VF_MBOX diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 4fc30a8..d9734d3 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -313,6 +313,7 @@ extern uint32_t event_print_mask; /**< set by "--print-event xxxx" and "--mask-event xxxx parameters */ extern uint8_t hot_plug; /**< enable by "--hot-plug" parameter */ extern int do_mlockall; /**< set by "--mlockall" or "--no-mlockall" parameter */ +extern uint64_t rx_offloads_disable; #ifdef RTE_LIBRTE_IXGBE_BYPASS extern uint32_t bypass_timeout; /**< Store the NIC bypass watchdog timeout */ diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 26b1927..25c1187 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -5007,17 +5007,17 @@ ixgbevf_dev_configure(struct rte_eth_dev *dev) * VF has no ability to enable/disable HW CRC * Keep the persistent behavior the same as Host PF */ -#ifndef RTE_LIBRTE_IXGBE_PF_DISABLE_STRIP_CRC - if (rte_eth_dev_must_keep_crc(conf->rxmode.offloads)) { - PMD_INIT_LOG(NOTICE, "VF can't disable HW CRC Strip"); - conf->rxmode.offloads |= DEV_RX_OFFLOAD_CRC_STRIP; - } -#else - if (!rte_eth_dev_must_keep_crc(conf->rxmode.offloads)) { - PMD_INIT_LOG(NOTICE, "VF can't enable HW CRC Strip"); - conf->rxmode.offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; + if (conf->rxmode.offloads_disable & DEV_RX_OFFLOAD_CRC_STRIP) { + if (rte_eth_dev_must_keep_crc(conf->rxmode.offloads)) { + PMD_INIT_LOG(NOTICE, "VF can't disable HW CRC Strip"); + conf->rxmode.offloads |= DEV_RX_OFFLOAD_CRC_STRIP; + } + } else { + if (!rte_eth_dev_must_keep_crc(conf->rxmode.offloads)) { + PMD_INIT_LOG(NOTICE, "VF can't enable HW CRC Strip"); + conf->rxmode.offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; + } } -#endif /* * Initialize to TRUE. If any of Rx queues doesn't meet the bulk diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index f5f593b..35a2dd1 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -334,6 +334,7 @@ struct rte_eth_rxmode { * structure are allowed to be set. */ uint64_t offloads; + uint64_t offloads_disable; }; /**