From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0053.outbound.protection.outlook.com [104.47.2.53]) by dpdk.org (Postfix) with ESMTP id 816A21AEEB for ; Sun, 10 Sep 2017 14:08:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=aPij40JjLz/0IfY2g3EU2MtBxDgQHWSZm0kgTiK2xTk=; b=YrUuqrOLSv7pQQDSfGfhvrVHE8gK64pgmigimPguPe+KtKIEwvq2fcT9JLwk8aOeVSn/fn1uIChCATFi1qdWYkNfNPE4t1iFUqaXdH/god7+tc9cG/tu/PQHhjs0ap7G6ZxmFjAl7HpqOaPjaPPfXdX6U7nWEHYXy6AUcwttBbs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; Received: from mellanox.com (82.166.227.17) by AM4PR05MB3140.eurprd05.prod.outlook.com (2603:10a6:205:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Sun, 10 Sep 2017 12:08:00 +0000 From: Shahaf Shuler To: thomas@monjalon.net Cc: dev@dpdk.org Date: Sun, 10 Sep 2017 15:07:49 +0300 Message-Id: X-Mailer: git-send-email 2.12.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: VI1PR0502CA0025.eurprd05.prod.outlook.com (2603:10a6:803:1::38) To AM4PR05MB3140.eurprd05.prod.outlook.com (2603:10a6:205:3::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 86d033b2-bc73-49e7-8139-08d4f84494e5 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:AM4PR05MB3140; X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3140; 3:d8d9uFZJBKi1bGf2vz4d81y64xvrs1Wp5U/hEwHNryvLD1wYNMZHAyVwarpEa9JwpamMYwQwVZFXzUd+PGt3XVOqPGvexrxa4xz06BIMJCmq3J3/NXqPiemptDYybjewxZT6eueDqZdTBsLFaJ8yMnZxAknp0SN1kDiRetw8AVoO8Ave1qzb2fEsw8TnCmJqaCHAXCyZa19dhLDTExJuXbylJnz+2JL5Z59UhSWfua2fNpzsgGr3RSiml0VQGsmX; 25:oTUv789oFb896EQvvec41sLkEtzOQ5lu4NYdqPzojB3bBzJqEd8eU4GtwTRqYeszOFeR9bslQUr5fAZawB7iRCuoRgQw/FPARKuke1gd17OdinX5K7k6UWN6nKGcyNBywqT27/3crQXunGF8jUVAJdI2fc9zqGyIol8bKHZe5hPOSxgBo7Hf1squl7g11ILOG9Mb8yGK3ytCZGI1cHogLSt1QxOwFwOy4pMdlkR0LRur/kCM58EOyGvqPKCJCrYKF5ktXCQAeiE0qRS3bd3KnRo7N50ImNKZ29/y0e0QHRxzn7eogPdBwY/j+GqD8uNQpLa54jXbJy3xz2erJs4gZg==; 31:j0DOXtrk0GfVybbPbRo2Ag2bpOuMNV/tUTOjD7WJjiBanslELk1puWtOlSitSQA0NBLyXuO6cC41SsiA+9ZMVV/24wPixkkrypJ+vrS2VjbcmVlouN2M1n5eQUEYL8KO8Qi5adAFVF7uKcbPXihkUI0HT0i+e7Sey2lsczbB0jgA0w/OXkrbzBybH4CMv4LO5lCeFs0MNJj3eAQszWoM/SygpEoKS6XBWHWxn9926IU= X-MS-TrafficTypeDiagnostic: AM4PR05MB3140: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3140; 20:G/niF/HZoZZaOeRDfhZr+c/4RjxScz4+Wu1MCHQz7D2bIhXGL//2IGm3/5e6M7GEKGZTbnDUjnyNtKKRne7o87vOZz9Ze4P0wSUqykCXjGxllPegrhys2hiR32VVkE1av5wGhiIr025DQ7dlrq8FeHUEuTIAEME0wzBzygiBqZh8RdEi1O9WsZnvMJxD+i3M314tn48Bl5cCrK3ckVZ51BVwPaLb4tvNNLFt3XzRIIpmrEMuaBaU4fCzUgGkvatcFCUzSdLtC2BwmxkdehB/eBzT7ZAM+FtFjcQpdW7uAsllcvaezaBTSEf5g29rmr2PHCsQRvUgsi0XYOC6Yb9rHyTeii49KWzmlpeZltjdS909nNMtRKxL4QKou28nyhIOuY9e/ZnlCxSUNyH5eRKkEbqL5UmGRd0pbgDtegS3bxpqcAKTjxs+e17mC0r9oUtxy2zaJ9/4xbJTWo1Mzbf6N0PcqtEOoy7zypEsV5GW0R0++0lX7jk6FmF+dSVxvW89; 4:FmqxDXYjz5opsgTcCpF96juikvIw1DfKWSps/h7YG+zfQSzYTepll+XtWZnfKOJHgfQKWI/z5RDkvdt+m9D19TMPTGBDMEC6sc1GYUzWJULzT0Qv+yM8sXDBQXXmjlvFksg0Lm6XxQ79L3HqokPOwzKCdAU/ozy1Yz/alsSkyE80Lxahqmm7SmA/bvKYSLkQtnA/36v7dEx9KZgDYhHyiuQuW6QDhfNxHgsUT2cRVOHinzKknCQR6wgNWYBoyuWdwqsOndw2D81M+yNRYppKzFN80knBBCr3NGZSEzRh2MQhPVkDNEmLtjitJit1VCdzrWfLpgt6SyChiLPCnn/HeA== X-Exchange-Antispam-Report-Test: UriScan:(20558992708506)(278428928389397); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123560025)(20161123555025)(20161123564025)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM4PR05MB3140; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM4PR05MB3140; X-Forefront-PRVS: 04267075BD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(39860400002)(189002)(199003)(305945005)(50466002)(48376002)(50226002)(189998001)(2906002)(8676002)(21086003)(5660300001)(25786009)(66066001)(3846002)(69596002)(42186005)(47776003)(6116002)(7736002)(478600001)(7350300001)(81156014)(81166006)(4326008)(50986999)(55016002)(101416001)(53936002)(6666003)(86362001)(68736007)(6916009)(2950100002)(76176999)(105586002)(2351001)(2361001)(118296001)(106356001)(36756003)(110136004)(5003940100001)(97736004)(33646002)(33026002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3140; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR05MB3140; 23:TF1D5nyxEW9lyX1Wmf/T1kd2Tcwg99F8lcG+A5z0A?= =?us-ascii?Q?GL3pC10AqkNPsKHKqb+5FFXxZ/HKL0PmChuPQFuqHOmxuTu4lW/NnubvADPp?= =?us-ascii?Q?xQ7CMwq8QRkuSsRfxdTNFsAWEN0GQIZQ3xtYKMOqKnQbZVbVFwTUjoHI7/72?= =?us-ascii?Q?CmzF6z5g7Mo47tCEnjICqicY0iU+cYTZ+IJWh0bFCPZKiDLO7LPgER/jsxMn?= =?us-ascii?Q?s+f5fvUxJgwgylZpZpXJ0wJngB8m6M3PcNw5CVLWst54NtV1dchSE0CBO+1g?= =?us-ascii?Q?CcNOKS2VGN5vE7+9lhEF90o2MLtarz0OYtsGSKV+/HqjE82ThsYfagVnQsw9?= =?us-ascii?Q?PJ6Lb+k9qChfoURD0LbKUqmf5SZv1cMzcxrgb9lIxkxHs0K+m70jX65Xssp/?= =?us-ascii?Q?XZNGT8zRPKv5cAdNz/k0v+k1LxgmyNotSZZXIGJ9LCoZcNQa9YqZomH5mvMO?= =?us-ascii?Q?m9cB6Re/xgn9AYp6kCNYAVB/E2KCKrteQpG7f/kdumE8v3tcVnZmTGrqEn4S?= =?us-ascii?Q?O0wXys4thGwV2rNRneQ+M2Melgf1iODLLZexjqKag9ZKWizk0ECKZ2yLrZhA?= =?us-ascii?Q?29y8J3G2ZIGK7TgTU9aTWn5neOxVMMPyfUwDlrSSYhRFx2gzILolcLwa+XHu?= =?us-ascii?Q?klEG1AY+TKZ23PnMg1wArWmXa5drEwB/4l5bOcvPETQBFadhAUozLLmZLi+3?= =?us-ascii?Q?LyMR6ywaHvnqZTdi8hfdl6uQF9e530bZgDdWPCin+RgRIojDBAGcEsBokGBk?= =?us-ascii?Q?hyFt8Fq+PbxWmx5LRbh4bVbqei7Y5oEDICBJlAi0HtWChO/ZrKTxG1UEKpDF?= =?us-ascii?Q?/Haw+24+Ii0pR9JwQulypVujSq6FUZjiZv4A/0ifETrOqTJgWTRtHBVheccs?= =?us-ascii?Q?BKaXANAjpFdbwe29XqXRxX2PVl1UTnVPs+vepqjeKjYagaDuGi8hVSm+th4l?= =?us-ascii?Q?KL3sNXS9Ig9BURWz8UJo6Py9blyWcDQZKczZhIkPUPmUH0XOQOf0W0+V6B34?= =?us-ascii?Q?Aw/iLp3jmbWxYpeBKDelAv/Z16fB/+YaaF0v4aolugsey4le9s5797UK3Yt6?= =?us-ascii?Q?VxOEhUX5edy9Aza9745fhsI1pQi/UeWp5PRDcqzhIu3NHjv8MhpiEJPkAI4N?= =?us-ascii?Q?l65zWDjTL6Se6Dzd61zDIJkeDTkYDZdfoI6jD/EhCerzOLnc0xFPzG/CZYt1?= =?us-ascii?Q?AWXTnwc/RV5K6x9bPSg/TH365rgM9emEUkb?= X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3140; 6:EnBW5FBo/E2Wp6pgWTq/5MzOHh0wxH3vIdeAVFb9L9+tmpQC8AJe4bnv+M1dheGR+pJHUimT2IUjb3U7NdXr7pBZ0ygGkV0MyRoSScqsZ2UCn/omr4ZmP4e0D7zsiJz45oY14CFTawDz3Qjkb9OY3KQuuYD5f9hzbEC1hsxapPL4slAHwR5JwneMQEgSdcOq9pu/O09orknCZbq1yS86REQD75m+KP9hHajDTxJCLtmhPLQdb68vWvZrsbFiLq/ZskwGHlpO1RT7hT1m1Dx/DG3qsCZY5mLgth3Pg7m2fK1bzFT+MjZDcbfxXEW4sBFEGdMGLQK0dGjCvWfoCb5hjA==; 5:3WE5d+aKTIU1gq2+b0x4pfFz2Q/1PDnu0NzTjlnrOm4GZxy6PCtd8G1NU14N+zgKWSv5M7bDro4megd7j6juM5miwF9zXt2L/WB7yU4+H1lR2FHCRESCsFZutW01hoXBdvp48d2HIi8OYddzBYESIg==; 24:Jp+ZzVYK1JlRq+Jin1SIIpptdRdIt5abltulEZX6Pe5azu1TDXUJoNOUPpbZCtoCOusZ6gzt66pQh+pza5CsDbfPfgIA1sXCBkmV6po+AjY=; 7:0+cPXvriFYO1Yu9P7KOYZgKhoRMZaxEiNzoZIcpDYc2DMkLByCiI6HSd1qoQfBHASLnRlR7xXBGjjo0ksyz3XPxuiGoj/VRQx5AYgI88WxEyNdF71/DIAt7HzD4MeUJBn1utg8Z0xOBxExxQlIYbWKSdkoFGSlBvxFDXlTIShtLI1QGE4pBZzBuzlL0X1vbLTlurCRCY98HQ6iEK9Gn+TVj4AwrheU0joqnvObek2TQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2017 12:08:00.1084 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3140 Subject: [dpdk-dev] [PATCH v2 2/2] ethdev: introduce Tx queue offloads API 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: , X-List-Received-Date: Sun, 10 Sep 2017 12:08:03 -0000 Introduce a new API to configure Tx offloads. In the new API, offloads are divided into per-port and per-queue offloads. The PMD reports capability for each of them. Offloads are enabled using the existing DEV_TX_OFFLOAD_* flags. To enable per-port offload, the offload should be set on both device configuration and queue configuration. To enable per-queue offload, the offloads can be set only on queue configuration. In addition the Tx offloads will be disabled by default and be enabled per application needs. This will much simplify PMD management of the different offloads. The new API does not have an equivalent for the below, benchmark specific, flags: - ETH_TXQ_FLAGS_NOREFCOUNT - ETH_TXQ_FLAGS_NOMULTMEMP Applications should set the ETH_TXQ_FLAGS_IGNORE flag on txq_flags field in order to move to the new API. The old Tx offloads API is kept for the meanwhile, in order to enable a smooth transition for PMDs and application to the new API. Signed-off-by: Shahaf Shuler --- Note: In the special case were application is using the old API and the PMD has allready converted to the new one. If there are Tx offloads which can be set only per-port the queue setup may fail. I choose to treat this case as an exception considering all Tx offloads are currently defined to be per-queue. New ones to be added should require from the application to move to the new API as well. --- doc/guides/nics/features.rst | 8 ++++++ lib/librte_ether/rte_ethdev.c | 59 +++++++++++++++++++++++++++++++++++++- lib/librte_ether/rte_ethdev.h | 32 ++++++++++++++++++++- 3 files changed, 97 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index f2c8497c2..bb25a1cee 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -131,6 +131,7 @@ Lock-free Tx queue If a PMD advertises DEV_TX_OFFLOAD_MT_LOCKFREE capable, multiple threads can invoke rte_eth_tx_burst() concurrently on the same Tx queue without SW lock. +* **[uses] rte_eth_txq_conf**: ``offloads:DEV_TX_OFFLOAD_MT_LOCKFREE``. * **[provides] rte_eth_dev_info**: ``tx_offload_capa:DEV_TX_OFFLOAD_MT_LOCKFREE``. * **[related] API**: ``rte_eth_tx_burst()``. @@ -220,6 +221,7 @@ TSO Supports TCP Segmentation Offloading. +* **[uses] rte_eth_txq_conf**: ``offloads:DEV_TX_OFFLOAD_TCP_TSO``. * **[uses] rte_eth_desc_lim**: ``nb_seg_max``, ``nb_mtu_seg_max``. * **[uses] mbuf**: ``mbuf.ol_flags:PKT_TX_TCP_SEG``. * **[uses] mbuf**: ``mbuf.tso_segsz``, ``mbuf.l2_len``, ``mbuf.l3_len``, ``mbuf.l4_len``. @@ -510,6 +512,7 @@ VLAN offload Supports VLAN offload to hardware. * **[uses] rte_eth_rxq_conf**: ``offloads:DEV_RX_OFFLOAD_VLAN_STRIP,DEV_RX_OFFLOAD_VLAN_FILTER,DEV_RX_OFFLOAD_VLAN_EXTEND``. +* **[uses] rte_eth_txq_conf**: ``offloads:DEV_TX_OFFLOAD_VLAN_INSERT``. * **[implements] eth_dev_ops**: ``vlan_offload_set``. * **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_VLAN_STRIPPED``, ``mbuf.vlan_tci``. * **[provides] rte_eth_dev_info**: ``rx_offload_capa:DEV_RX_OFFLOAD_VLAN_STRIP``, @@ -526,6 +529,7 @@ QinQ offload Supports QinQ (queue in queue) offload. * **[uses] rte_eth_rxq_conf**: ``offloads:DEV_RX_OFFLOAD_QINQ_STRIP``. +* **[uses] rte_eth_txq_conf**: ``offloads:DEV_TX_OFFLOAD_QINQ_INSERT``. * **[uses] mbuf**: ``mbuf.ol_flags:PKT_TX_QINQ_PKT``. * **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_QINQ_STRIPPED``, ``mbuf.vlan_tci``, ``mbuf.vlan_tci_outer``. @@ -541,6 +545,7 @@ L3 checksum offload Supports L3 checksum offload. * **[uses] rte_eth_rxq_conf**: ``offloads:DEV_RX_OFFLOAD_IPV4_CKSUM``. +* **[uses] rte_eth_txq_conf**: ``offloads:DEV_TX_OFFLOAD_IPV4_CKSUM``. * **[uses] mbuf**: ``mbuf.ol_flags:PKT_TX_IP_CKSUM``, ``mbuf.ol_flags:PKT_TX_IPV4`` | ``PKT_TX_IPV6``. * **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_IP_CKSUM_UNKNOWN`` | @@ -558,6 +563,7 @@ L4 checksum offload Supports L4 checksum offload. * **[uses] rte_eth_rxq_conf**: ``offloads:DEV_RX_OFFLOAD_UDP_CKSUM,DEV_RX_OFFLOAD_TCP_CKSUM``. +* **[uses] rte_eth_txq_conf**: ``offloads:DEV_TX_OFFLOAD_UDP_CKSUM,DEV_TX_OFFLOAD_TCP_CKSUM,DEV_TX_OFFLOAD_SCTP_CKSUM``. * **[uses] mbuf**: ``mbuf.ol_flags:PKT_TX_IPV4`` | ``PKT_TX_IPV6``, ``mbuf.ol_flags:PKT_TX_L4_NO_CKSUM`` | ``PKT_TX_TCP_CKSUM`` | ``PKT_TX_SCTP_CKSUM`` | ``PKT_TX_UDP_CKSUM``. @@ -576,6 +582,7 @@ MACsec offload Supports MACsec. * **[uses] rte_eth_rxq_conf**: ``offloads:DEV_RX_OFFLOAD_MACSEC_STRIP``. +* **[uses] rte_eth_txq_conf**: ``offloads:DEV_TX_OFFLOAD_MACSEC_INSERT``. * **[uses] mbuf**: ``mbuf.ol_flags:PKT_TX_MACSEC``. * **[provides] rte_eth_dev_info**: ``rx_offload_capa:DEV_RX_OFFLOAD_MACSEC_STRIP``, ``tx_offload_capa:DEV_TX_OFFLOAD_MACSEC_INSERT``. @@ -589,6 +596,7 @@ Inner L3 checksum Supports inner packet L3 checksum. * **[uses] rte_eth_rxq_conf**: ``offloads:DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM``. +* **[uses] rte_eth_txq_conf**: ``offloads:DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM``. * **[uses] mbuf**: ``mbuf.ol_flags:PKT_TX_IP_CKSUM``, ``mbuf.ol_flags:PKT_TX_IPV4`` | ``PKT_TX_IPV6``, ``mbuf.ol_flags:PKT_TX_OUTER_IP_CKSUM``, diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index b3c10701e..cd79cb1c9 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1186,6 +1186,50 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, return ret; } +/** + * A conversion function from txq_flags API. + */ +static void +rte_eth_convert_txq_flags(const uint32_t txq_flags, uint64_t *tx_offloads) +{ + uint64_t offloads = 0; + + if (!(txq_flags & ETH_TXQ_FLAGS_NOMULTSEGS)) + offloads |= DEV_TX_OFFLOAD_MULTI_SEGS; + if (!(txq_flags & ETH_TXQ_FLAGS_NOVLANOFFL)) + offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; + if (!(txq_flags & ETH_TXQ_FLAGS_NOXSUMSCTP)) + offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + if (!(txq_flags & ETH_TXQ_FLAGS_NOXSUMUDP)) + offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + if (!(txq_flags & ETH_TXQ_FLAGS_NOXSUMTCP)) + offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + + *tx_offloads = offloads; +} + +/** + * A conversion function from offloads API. + */ +static void +rte_eth_convert_txq_offloads(const uint64_t tx_offloads, uint32_t *txq_flags) +{ + uint32_t flags = 0; + + if (!(tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS)) + flags |= ETH_TXQ_FLAGS_NOMULTSEGS; + if (!(tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT)) + flags |= ETH_TXQ_FLAGS_NOVLANOFFL; + if (!(tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM)) + flags |= ETH_TXQ_FLAGS_NOXSUMSCTP; + if (!(tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM)) + flags |= ETH_TXQ_FLAGS_NOXSUMUDP; + if (!(tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM)) + flags |= ETH_TXQ_FLAGS_NOXSUMTCP; + + *txq_flags = flags; +} + int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, @@ -1193,6 +1237,7 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + struct rte_eth_txconf local_conf; void **txq; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); @@ -1237,8 +1282,20 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, if (tx_conf == NULL) tx_conf = &dev_info.default_txconf; + /* + * Convert between the offloads API to enable PMDs to support + * only one of them. + */ + local_conf = *tx_conf; + if (tx_conf->txq_flags & ETH_TXQ_FLAGS_IGNORE) + rte_eth_convert_txq_offloads(tx_conf->offloads, + &local_conf.txq_flags); + else + rte_eth_convert_txq_flags(tx_conf->txq_flags, + &local_conf.offloads); + return (*dev->dev_ops->tx_queue_setup)(dev, tx_queue_id, nb_tx_desc, - socket_id, tx_conf); + socket_id, &local_conf); } void diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index f424cba04..4ad7dd059 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -692,6 +692,12 @@ struct rte_eth_vmdq_rx_conf { */ struct rte_eth_txmode { enum rte_eth_tx_mq_mode mq_mode; /**< TX multi-queues mode. */ + uint64_t offloads; + /** + * Per-port Tx offloads to be set using DEV_TX_OFFLOAD_* flags. + * Only offloads set on tx_offload_capa field on rte_eth_dev_info + * structure are allowed to be set. + */ /* For i40e specifically */ uint16_t pvid; @@ -733,6 +739,14 @@ struct rte_eth_rxconf { #define ETH_TXQ_FLAGS_NOXSUMS \ (ETH_TXQ_FLAGS_NOXSUMSCTP | ETH_TXQ_FLAGS_NOXSUMUDP | \ ETH_TXQ_FLAGS_NOXSUMTCP) +#define ETH_TXQ_FLAGS_IGNORE 0x8000 + /** + * When set the txq_flags should be ignored, + * instead per-queue Tx offloads will be set on offloads field + * located on rte_eth_txq_conf struct. + * This flag is temporary till the rte_eth_txq_conf.txq_flags + * API will be deprecated. + */ /** * A structure used to configure a TX ring of an Ethernet port. @@ -745,6 +759,12 @@ struct rte_eth_txconf { uint32_t txq_flags; /**< Set flags for the Tx queue */ uint8_t tx_deferred_start; /**< Do not start queue with rte_eth_dev_start(). */ + uint64_t offloads; + /** + * Per-queue Tx offloads to be set using DEV_TX_OFFLOAD_* flags. + * Only offloads set on tx_queue_offload_capa field on rte_eth_dev_info + * structure are allowed to be set. + */ }; /** @@ -969,6 +989,8 @@ struct rte_eth_conf { /**< Multiple threads can invoke rte_eth_tx_burst() concurrently on the same * tx queue without SW lock. */ +#define DEV_TX_OFFLOAD_MULTI_SEGS 0x00008000 +/**< multi segment send is supported. */ struct rte_pci_device; @@ -991,9 +1013,12 @@ struct rte_eth_dev_info { uint16_t max_vmdq_pools; /**< Maximum number of VMDq pools. */ uint64_t rx_offload_capa; /**< Device per port RX offload capabilities. */ - uint32_t tx_offload_capa; /**< Device TX offload capabilities. */ + uint64_t tx_offload_capa; + /**< Device per port TX offload capabilities. */ uint64_t rx_queue_offload_capa; /**< Device per queue RX offload capabilities. */ + uint64_t tx_queue_offload_capa; + /**< Device per queue TX offload capabilities. */ uint16_t reta_size; /**< Device redirection table size, the total number of entries. */ uint8_t hash_key_size; /**< Hash key size in bytes */ @@ -2024,6 +2049,11 @@ int rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, * - The *txq_flags* member contains flags to pass to the TX queue setup * function to configure the behavior of the TX queue. This should be set * to 0 if no special configuration is required. + * This API is obsolete and will be deprecated. Applications + * should set it to ETH_TXQ_FLAGS_IGNORE and use + * the offloads field below. + * - The *offloads* member contains Tx offloads to be enabled. + * Offloads which are not set cannot be used on the datapath. * * Note that setting *tx_free_thresh* or *tx_rs_thresh* value to 0 forces * the transmit function to use default values. -- 2.12.0