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 2A388A058A; Fri, 17 Apr 2020 09:23:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EB1D01DCE5; Fri, 17 Apr 2020 09:23:25 +0200 (CEST) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id BFDF31DCAE for ; Fri, 17 Apr 2020 09:23:24 +0200 (CEST) Received: by mail-pg1-f194.google.com with SMTP id o15so130948pgi.1 for ; Fri, 17 Apr 2020 00:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Hu/GBFxH1GswcPkBIY05SZ34S0YUMcJRmWUq62h29JU=; b=lpFN/ACRKPWP23S45mXa00fQLvelE80FEEB9mDJvw9SsgMXHhs1CyQV17Vb5GMYjNN OH2dSxQrho2ulpiAWSdHf0FmtJNqz3c6YedShH7ekfmuWRMlbZviasoXa0kAbdl7oWSj dTPO1K1yWHBdUyFopXflC+WSv7Fla6TEw25+DMtSHIf///6Fc/6nrOr8KkIy0M8/dS/T hjsdIuLZDhWwnh076fKNgzc/BF2resLU6aTZ3syVsrtd4AeI00mMR3OmhVJGQ3EuiB0c +iIskmj3D2bjb953SYNupUaaVB+ZT8PTF9VsdmnDOQCEEqKvg+/2EgMOlF4BW4P6U4m8 rEPg== 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; bh=Hu/GBFxH1GswcPkBIY05SZ34S0YUMcJRmWUq62h29JU=; b=VtetOZkG9KPUhXn8/AZuAlj6xt5iugzd2fZudKzd3vZZF8Iv2cxVyDIshFV2q6O8Ed raDUvfQUzTATGh559RBBJOJ+4aJRUUX1xjR4+vk+ulPLCuPatQ/qIACnNPPY5qRgnAc2 uiwgXpgYbsR35zjDuo5ro/yFiZyO7EmJsmcWqU6hMPBtXuMvQF4tcGAtldb4St6nsvO/ TSNIdxag4ro9MuFVS0apg6/nshkSNmR+vZ6Yvq5McFqCn5tMzSBRmZL3BZJ60JZ9pXok Qs/7uAczUg/JwOpcLVpxT7MDeu0wh47UGc6sYIEieLZkF7ykcBnna2g9rI+0WDT4Ju8y LW5g== X-Gm-Message-State: AGi0PuaYKgi+6YoywIi0OAt6q4kQaul8ZHSEvGQXZvaYT+S33hkMNAXI OqVhfDdAikxoOpFAa4P4vX0= X-Google-Smtp-Source: APiQypKpa1QhN/pWV0r2knGwKs7WPp7GaEbgmAineC+QGQo5/x/Lo4SvsJM8tp1bNO88ALk4AyvR7A== X-Received: by 2002:a63:6fc6:: with SMTP id k189mr1662882pgc.175.1587108203702; Fri, 17 Apr 2020 00:23:23 -0700 (PDT) Received: from hyd1588t430.marvell.com ([115.113.156.2]) by smtp.gmail.com with ESMTPSA id v4sm18750983pfb.31.2020.04.17.00.23.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2020 00:23:23 -0700 (PDT) From: Nithin Dabilpuram To: thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com, orika@mellanox.com, cristian.dumitrescu@intel.com, anatoly.burakov@intel.com, John McNamara , Marko Kovacevic , Olivier Matz Cc: dev@dpdk.org, jerinj@marvell.com, kkanas@marvell.com, Nithin Dabilpuram Date: Fri, 17 Apr 2020 12:52:51 +0530 Message-Id: <20200417072254.11455-1-nithind1988@gmail.com> X-Mailer: git-send-email 2.8.4 Subject: [dpdk-dev] [PATCH 1/3] mbuf: add Tx offloads for packet marking 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: Nithin Dabilpuram Introduce PKT_TX_MARK_IP_DSCP, PKT_TX_MARK_IP_ECN and PKT_TX_MARK_VLAN_DEI Tx offload flags to support packet marking. When packet marking feature in Traffic manager is enabled, application has to the use the three new flags to indicate to PMD on whether packet marking needs to be enabled on the specific mbuf or not. By setting the three flags, it is assumed by PMD that application has already verified the applicability of marking on that specific packet and PMD need not perform further checks as per RFC. Signed-off-by: Krzysztof Kanas Signed-off-by: Nithin Dabilpuram --- doc/guides/nics/features.rst | 14 ++++++++++++++ lib/librte_mbuf/rte_mbuf.c | 6 ++++++ lib/librte_mbuf/rte_mbuf_core.h | 36 ++++++++++++++++++++++++++++++++++-- 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index edd21c4..bc978fb 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -913,6 +913,20 @@ Supports to get Rx/Tx packet burst mode information. * **[implements] eth_dev_ops**: ``rx_burst_mode_get``, ``tx_burst_mode_get``. * **[related] API**: ``rte_eth_rx_burst_mode_get()``, ``rte_eth_tx_burst_mode_get()``. +.. _nic_features_traffic_manager_packet_marking_offload: + +Traffic Manager Packet marking offload +-------------------------------------- + +Supports enabling a packet marking offload specific mbuf. + +* **[uses] mbuf**: ``mbuf.ol_flags:PKT_TX_MARK_IP_DSCP``, + ``mbuf.ol_flags:PKT_TX_MARK_IP_ECN``, ``mbuf.ol_flags:PKT_TX_MARK_VLAN_DEI``, + ``mbuf.ol_flags:PKT_TX_IPV4``, ``mbuf.ol_flags:PKT_TX_IPV6``. +* **[uses] mbuf**: ``mbuf.l2_len``. +* **[related] API**: ``rte_tm_mark_ip_dscp()``, ``rte_tm_mark_ip_ecn()``, + ``rte_tm_mark_vlan_dei()``. + .. _nic_features_other: Other dev ops not represented by a Feature diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index cd5794d..5c6896d 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -880,6 +880,9 @@ const char *rte_get_tx_ol_flag_name(uint64_t mask) case PKT_TX_SEC_OFFLOAD: return "PKT_TX_SEC_OFFLOAD"; case PKT_TX_UDP_SEG: return "PKT_TX_UDP_SEG"; case PKT_TX_OUTER_UDP_CKSUM: return "PKT_TX_OUTER_UDP_CKSUM"; + case PKT_TX_MARK_VLAN_DEI: return "PKT_TX_MARK_VLAN_DEI"; + case PKT_TX_MARK_IP_DSCP: return "PKT_TX_MARK_IP_DSCP"; + case PKT_TX_MARK_IP_ECN: return "PKT_TX_MARK_IP_ECN"; default: return NULL; } } @@ -916,6 +919,9 @@ rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_t buflen) { PKT_TX_SEC_OFFLOAD, PKT_TX_SEC_OFFLOAD, NULL }, { PKT_TX_UDP_SEG, PKT_TX_UDP_SEG, NULL }, { PKT_TX_OUTER_UDP_CKSUM, PKT_TX_OUTER_UDP_CKSUM, NULL }, + { PKT_TX_MARK_VLAN_DEI, PKT_TX_MARK_VLAN_DEI, NULL }, + { PKT_TX_MARK_IP_DSCP, PKT_TX_MARK_IP_DSCP, NULL }, + { PKT_TX_MARK_IP_ECN, PKT_TX_MARK_IP_ECN, NULL }, }; const char *name; unsigned int i; diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h index b9a59c8..d9f1290 100644 --- a/lib/librte_mbuf/rte_mbuf_core.h +++ b/lib/librte_mbuf/rte_mbuf_core.h @@ -187,11 +187,40 @@ extern "C" { /* add new RX flags here, don't forget to update PKT_FIRST_FREE */ #define PKT_FIRST_FREE (1ULL << 23) -#define PKT_LAST_FREE (1ULL << 40) +#define PKT_LAST_FREE (1ULL << 37) /* add new TX flags here, don't forget to update PKT_LAST_FREE */ /** + * Packet marking offload flags. These flags indicated what kind + * of packet marking needs to be applied on a given mbuf when + * appropriate Traffic Manager configuration is in place. + * When user set's these flags on a mbuf, below assumptions are made + * 1) When PKT_TX_MARK_VLAN_DEI is set, + * a) PMD assumes pkt to be a 802.1q packet. + * b) Application should also set mbuf.l2_len where 802.1Q header is + * at (mbuf.l2_len - 6) offset. + * 2) When PKT_TX_MARK_IP_DSCP is set, + * a) Application should also set either PKT_TX_IPV4 or PKT_TX_IPV6 + * to indicate whether if it is IPv4 packet or IPv6 packet + * for DSCP marking. It should also set PKT_TX_IP_CKSUM if it is + * IPv4 pkt. + * b) Application should also set mbuf.l2_len that indicates + * start offset of L3 header. + * 3) When PKT_TX_MARK_IP_ECN is set, + * a) Application should also set either PKT_TX_IPV4 or PKT_TX_IPV6. + * It should also set PKT_TX_IP_CKSUM if it is IPv4 pkt. + * b) PMD will assume pkt L4 protocol is either TCP or SCTP and + * ECN is set to 2'b01 or 2'b10 as per RFC 3168 and hence HW + * can mark the packet for a configured color. + * c) Application should also set mbuf.l2_len that indicates + * start offset of L3 header. + */ +#define PKT_TX_MARK_VLAN_DEI (1ULL << 38) +#define PKT_TX_MARK_IP_DSCP (1ULL << 39) +#define PKT_TX_MARK_IP_ECN (1ULL << 40) + +/** * Outer UDP checksum offload flag. This flag is used for enabling * outer UDP checksum in PMD. To use outer UDP checksum, the user needs to * 1) Enable the following in mbuf, @@ -384,7 +413,10 @@ extern "C" { PKT_TX_MACSEC | \ PKT_TX_SEC_OFFLOAD | \ PKT_TX_UDP_SEG | \ - PKT_TX_OUTER_UDP_CKSUM) + PKT_TX_OUTER_UDP_CKSUM | \ + PKT_TX_MARK_VLAN_DEI | \ + PKT_TX_MARK_IP_DSCP | \ + PKT_TX_MARK_IP_ECN) /** * Mbuf having an external buffer attached. shinfo in mbuf must be filled. -- 2.8.4