From patchwork Thu Jun 20 07:25:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Haiyue" X-Patchwork-Id: 55121 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 995B61D057; Thu, 20 Jun 2019 09:30:04 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 4E99B1BF15 for ; Thu, 20 Jun 2019 09:30:03 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2019 00:30:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,396,1557212400"; d="scan'208";a="182983415" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.119.148]) by fmsmga004.fm.intel.com with ESMTP; 20 Jun 2019 00:30:01 -0700 From: Haiyue Wang To: dev@dpdk.org Cc: Haiyue Wang Date: Thu, 20 Jun 2019 15:25:52 +0800 Message-Id: <1561015552-37671-1-git-send-email-haiyue.wang@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [RFC] ethdev: reserve the RX offload most-significant bits for PMD scartch 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" Generally speaking, the DEV_RX_OFFLOAD_xxx for RX offload capabilities of a device is one-bit field definition, it has 64 different values at most. Nowdays the receiving queue of NIC has rich features not just checksum offload, like it can extract the network protocol header fields to its RX descriptors for quickly handling. But this kind of feature is not so common, and it is hardware related. Normally, this can be done through rte_devargs driver parameters, but the scope is per device. This is not so nice for per queue design. The per queue API 'rte_eth_rx_queue_setup' and data structure 'struct rte_eth_rxconf' are stable now, and be common for all PMDs. For keeping the ethdev API & ABI compatibility, and the application can make good use of the NIC's specific features, reserving the most-significant bits of RX offload seems an compromise method. Then the PMDs redefine these bits as they want, all PMDs share the same bit positions and expose their new definitions with the header file. The experimental reserved bits number is 6 currently. Tt can be one-bit for each features up to the the maximum number 6. It can also be some bits encoding: e.g, 6 bits can stand for 63 maximum number of features. We call these reserved bits as DEV_RX_OFFLOAD_PMD_SCRATCH. And the left unused bits number is : 64 - 19 (currently defined) - 6 (PMD scartch) = 39. This is not so nice for applications, they need to check PMD's driver name for lookuping their DEV_RX_OFFLOAD_PMD_SCRATCH definitions. But it is good for the applications to make use of the hardware compatibility. Signed-off-by: Haiyue Wang Signed-off-by: Haiyue Wang Signed-off-by: Haiyue Wang Signed-off-by: Haiyue Wang --- app/test-pmd/cmdline.c | 18 ++++++++++++------ lib/librte_ethdev/rte_ethdev.c | 6 ++++++ lib/librte_ethdev/rte_ethdev.h | 12 ++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d1e0d44..ffcc835 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -879,7 +879,8 @@ static void cmd_help_long_parsed(void *parsed_result, "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" "vlan_filter|vlan_extend|jumbo_frame|crc_strip|" - "scatter|timestamp|security|keep_crc on|off\n" + "scatter|timestamp|security|keep_crc|" + "pmd_scratch0|pmd_scratch1|pmd_scratch2|pmd_scratch3|pmd_scratch4|pmd_scratch5 on|off\n" " Enable or disable a per port Rx offloading" " on all Rx queues of a port\n\n" @@ -887,7 +888,8 @@ static void cmd_help_long_parsed(void *parsed_result, "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" "outer_ipv4_cksum|macsec_strip|header_split|" "vlan_filter|vlan_extend|jumbo_frame|crc_strip|" - "scatter|timestamp|security|keep_crc on|off\n" + "scatter|timestamp|security|keep_crc|" + "pmd_scratch0|pmd_scratch1|pmd_scratch2|pmd_scratch3|pmd_scratch4|pmd_scratch5 on|off\n" " Enable or disable a per queue Rx offloading" " only on a specific Rx queue\n\n" @@ -17991,7 +17993,8 @@ cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_offload = offload, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "crc_strip#scatter#timestamp#security#keep_crc"); + "crc_strip#scatter#timestamp#security#keep_crc#" + "pmd_scratch0#pmd_scratch1#pmd_scratch2#pmd_scratch3#pmd_scratch4#pmd_scratch5"); cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off = TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_rx_offload_result, @@ -18067,7 +18070,8 @@ cmdline_parse_inst_t cmd_config_per_port_rx_offload = { .help_str = "port config rx_offload vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" - "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc " + "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc|" + "pmd_scratch0|pmd_scratch1|pmd_scratch2|pmd_scratch3|pmd_scratch4|pmd_scratch5 " "on|off", .tokens = { (void *)&cmd_config_per_port_rx_offload_result_port, @@ -18117,7 +18121,8 @@ cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_offload = offload, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "crc_strip#scatter#timestamp#security#keep_crc"); + "crc_strip#scatter#timestamp#security#keep_crc#" + "pmd_scratch0#pmd_scratch1#pmd_scratch2#pmd_scratch3#pmd_scratch4#pmd_scratch5"); cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off = TOKEN_STRING_INITIALIZER (struct cmd_config_per_queue_rx_offload_result, @@ -18169,7 +18174,8 @@ cmdline_parse_inst_t cmd_config_per_queue_rx_offload = { "vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" - "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc " + "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc|" + "pmd_scratch0|pmd_scratch1|pmd_scratch2|pmd_scratch3|pmd_scratch4|pmd_scratch5 " "on|off", .tokens = { (void *)&cmd_config_per_queue_rx_offload_result_port, diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 8ac3016..bc6a676 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -129,6 +129,12 @@ static const struct { RTE_RX_OFFLOAD_BIT2STR(KEEP_CRC), RTE_RX_OFFLOAD_BIT2STR(SCTP_CKSUM), RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM), + RTE_RX_OFFLOAD_BIT2STR(PMD_SCRATCH0), + RTE_RX_OFFLOAD_BIT2STR(PMD_SCRATCH1), + RTE_RX_OFFLOAD_BIT2STR(PMD_SCRATCH2), + RTE_RX_OFFLOAD_BIT2STR(PMD_SCRATCH3), + RTE_RX_OFFLOAD_BIT2STR(PMD_SCRATCH4), + RTE_RX_OFFLOAD_BIT2STR(PMD_SCRATCH5), }; #undef RTE_RX_OFFLOAD_BIT2STR diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 50c6936..45bac1c 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -1011,6 +1011,12 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_KEEP_CRC 0x00010000 #define DEV_RX_OFFLOAD_SCTP_CKSUM 0x00020000 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM 0x00040000 +#define DEV_RX_OFFLOAD_PMD_SCRATCH0 (1ULL << 58) /* Defined by PMD */ +#define DEV_RX_OFFLOAD_PMD_SCRATCH1 (1ULL << 59) /* Defined by PMD */ +#define DEV_RX_OFFLOAD_PMD_SCRATCH2 (1ULL << 60) /* Defined by PMD */ +#define DEV_RX_OFFLOAD_PMD_SCRATCH3 (1ULL << 61) /* Defined by PMD */ +#define DEV_RX_OFFLOAD_PMD_SCRATCH4 (1ULL << 62) /* Defined by PMD */ +#define DEV_RX_OFFLOAD_PMD_SCRATCH5 (1ULL << 63) /* Defined by PMD */ #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \ @@ -1018,6 +1024,12 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_VLAN (DEV_RX_OFFLOAD_VLAN_STRIP | \ DEV_RX_OFFLOAD_VLAN_FILTER | \ DEV_RX_OFFLOAD_VLAN_EXTEND) +#define DEV_RX_OFFLOAD_PMD_SCRATCH (DEV_RX_OFFLOAD_PMD_SCRATCH0 | \ + DEV_RX_OFFLOAD_PMD_SCRATCH1 | \ + DEV_RX_OFFLOAD_PMD_SCRATCH2 | \ + DEV_RX_OFFLOAD_PMD_SCRATCH3 | \ + DEV_RX_OFFLOAD_PMD_SCRATCH4 | \ + DEV_RX_OFFLOAD_PMD_SCRATCH5) /* * If new Rx offload capabilities are defined, they also must be