From patchwork Wed Sep 13 06:37:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shahaf Shuler X-Patchwork-Id: 28645 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 1156F1B199; Wed, 13 Sep 2017 08:37:30 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20061.outbound.protection.outlook.com [40.107.2.61]) by dpdk.org (Postfix) with ESMTP id 38F3D7D4E for ; Wed, 13 Sep 2017 08:37:25 +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=BBA0uHdGsfKyrMz2lL985cNjl/2voGPIF/82JPz+HDc=; b=tVWyq/uedz6w3Xr6NaNMy9Lr/iWty6KRBo/eazLJas5mfWu06FNWHRpeSteSUky5ZG6ivMKyG7ELbvY9+Ol/h1t2/Seu6nCA0OZwPY9wkDccZ4x9W134HxnqOpQMShr7ctY/iaVSg8RL73+f1wZmpPggj7y6mA8Rq6pBK3GxtR0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; Received: from mellanox.com (82.166.227.17) by AM4PR05MB3138.eurprd05.prod.outlook.com (2603:10a6:205:3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Wed, 13 Sep 2017 06:37:23 +0000 From: Shahaf Shuler To: thomas@monjalon.net Cc: dev@dpdk.org Date: Wed, 13 Sep 2017 09:37:16 +0300 Message-Id: X-Mailer: git-send-email 2.12.0 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: AM5PR0602CA0010.eurprd06.prod.outlook.com (2603:10a6:203:a3::20) To AM4PR05MB3138.eurprd05.prod.outlook.com (2603:10a6:205:3::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 192c3538-3ada-4ba7-e1bb-08d4fa71e4c0 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:AM4PR05MB3138; X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3138; 3:Jvb/+aPqhbheJgWR6ufZSi2OUVHpEjKEV9BAIiu+RyWGp5osXjhZdfJPj8/kHQ+EERe8vf84nsqwTpCB3roZM8uKR+dH+VW8QTtbMHtnja9wilH31hThVFnr7xSYzxzzfgZWtcnE0xI3JumDdB2QEa1icrwON/C4MjqUvrEwvOm0qkYF3mxpmWOH1hM3d/CA9MCGXQ5nAR2ao164JA0WVMgDPaWsG3rw8Pg+EvUvUdeIGy+8fiGIZiFZaILZ3hHj; 25:z4D4O9o8Q8pKKUCxCAiYR+Ay6e2Qvs2/SSODwpD9l22+eG++jb4eGysq+XPVAcGh4x932bBalLjBj+/qKtwUFWYFRyV+1Cy+f3NhTUzUYN6+3T3MHxmiQMGIMlj63CDEmyK2hBZlo//DGByawgPvw5ghDSHdmeKrIcxf3rpcXkr17qnGsUZFQH38L8AN0iJwBj+vl6ZV1ABfdoREAhxlJFNwR5BRLknFGGUENY11EkZhcr5pm0FDCpspCEDbjbD3Jea5WbnrU9GnDC8Z7wOsCeXiCdw1QgOOWTFGS5NP+YLswwETeu3Sl+HMcAfJWOK/awnGiM4zSi3MxwQe50NuHg==; 31:XOx9qtPGUnTUm+7+NYJIElwEZgb2Zu+X5R/IBKFNwcvqonPwi8TuTFavntxY3ZaMX2vpTX5vPSZu9pMck13lH9Cjb3l+v5D0FcSVlf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52TkXuX1DjPJAGn6OGhzso61xg== 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)(10201501046)(100000703101)(100105400095)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123562025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM4PR05MB3138; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM4PR05MB3138; X-Forefront-PRVS: 042957ACD7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(346002)(366002)(376002)(39860400002)(199003)(189002)(81156014)(2906002)(36756003)(478600001)(2950100002)(189998001)(50466002)(68736007)(81166006)(316002)(5660300001)(48376002)(6666003)(21086003)(8676002)(66066001)(4326008)(5003940100001)(47776003)(305945005)(86362001)(69596002)(3846002)(6916009)(7736002)(6116002)(53936002)(50986999)(55016002)(76176999)(106356001)(110136004)(7350300001)(50226002)(33026002)(105586002)(118296001)(25786009)(97736004)(101416001)(2351001)(33646002)(2361001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3138; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; AM4PR05MB3138; 23:lS4Gm4UA1b7Cd/Z1lfO7e1YdPMCTpNaUuu2WYRXNR?= rmCMOvDiTVCsRQUPGBjohDHRE7mfhdEDSdDsD1NoNduHdgFypQAJ95XATpl741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3Kr9npANgpq5KSX127JpCwTzsTWXlrqP/Xj9m7NrU4JA8wGXcTvZAI5ZPNjyS1l8qpPpAGyC84ptDxGtqU= X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3138; 6:+imcZQrZdwMAOamrU6LVjETW51tvVL1jLks6Ifc7V+ERmrr7hFs+/ts54R5q6LVZN+bUxmFtb3ArMhchHSUxtU/Xn2VWoVvoQAFCvgwoaLU3q6gsQl/kcmp43ziM3WP4bTQu0F1GvCA3tHtJW6veu2uulTBwWnEtcm6jnNvlFNdYltZxrt7+9/urqdog8VXMGnoATV8C8M6U5GQOgRlOLFTrHsbW0b5ftVAFyA/IJqr6WoktJ0fPG523p716VjniNJGOTvYIom/EmG2zo/lVz4dJadXvnSmo+G7KE4E6SO8dFoVe6I8TAyTV6KGuMSC63O2MnyMjNmIwROnfl1kClQ==; 5:q7TTTmCLSs0ogz4iUVstMnK2sIuIwn41+jx6zxo/eoTDELBbxkMVJ2JsMX54g3+BBOGk3gFaYgss8lsF7GQR4RPDbBvk9Ef4vPMAOPHIhQBry807BODQGeyyqxIPy7Gqnu1Eu+x4daGkddBMKKILpw==; 24:hdxZLv7rHq+gdbTrs3ZX5zqo50uKXJN/bDE7o1iVzro8HXpVbNtLDvZWrhDqhGLDwQr0h8Udsm/dbAt1GtSpzuQC7lpDpf4Dv4lF8GuGbu8=; 7:r/S2x+DbzKBDOv4F6cEaRZuqkRKpQ72C/o/BCT8TJzxH0dwknZ33EiOStMWb3Z2n/8pLFlFpeV1sSltzcqRlbqHN+bZXa7VtzNNc4vczf2j4KGWyF83vGixUt6lRI7PBZavj5PWfOzccC6QyKRZpdaO8omScvOgcivm817xVyKAdqgIAEEt1x1MJJVywBeKw+OXFvolNPOBNk/UipeQ9kS24hWG7SLTQb8VejcdDn5I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2017 06:37:23.9364 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3138 Subject: [dpdk-dev] [PATCH v3 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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. 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 --- doc/guides/nics/features.rst | 33 +++++++++++++++----- lib/librte_ether/rte_ethdev.c | 64 +++++++++++++++++++++++++++++++++++++- lib/librte_ether/rte_ethdev.h | 38 +++++++++++++++++++++- 3 files changed, 125 insertions(+), 10 deletions(-) diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index 4e68144ef..1a8af473b 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -131,7 +131,8 @@ 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. -* **[provides] rte_eth_dev_info**: ``tx_offload_capa:DEV_TX_OFFLOAD_MT_LOCKFREE``. +* **[uses] rte_eth_txconf,rte_eth_txmode**: ``offloads:DEV_TX_OFFLOAD_MT_LOCKFREE``. +* **[provides] rte_eth_dev_info**: ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_MT_LOCKFREE``. * **[related] API**: ``rte_eth_tx_burst()``. @@ -220,11 +221,12 @@ TSO Supports TCP Segmentation Offloading. +* **[uses] rte_eth_txconf,rte_eth_txmode**: ``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``. * **[implements] datapath**: ``TSO functionality``. -* **[provides] rte_eth_dev_info**: ``tx_offload_capa:DEV_TX_OFFLOAD_TCP_TSO,DEV_TX_OFFLOAD_UDP_TSO``. +* **[provides] rte_eth_dev_info**: ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_TCP_TSO,DEV_TX_OFFLOAD_UDP_TSO``. .. _nic_features_promiscuous_mode: @@ -510,10 +512,11 @@ VLAN offload Supports VLAN offload to hardware. * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_VLAN_STRIP,DEV_RX_OFFLOAD_VLAN_FILTER,DEV_RX_OFFLOAD_VLAN_EXTEND``. +* **[uses] rte_eth_txconf,rte_eth_txmode**: ``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,rx_queue_offload_capa:DEV_RX_OFFLOAD_VLAN_STRIP``, - ``tx_offload_capa:DEV_TX_OFFLOAD_VLAN_INSERT``. + ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_VLAN_INSERT``. * **[related] API**: ``rte_eth_dev_set_vlan_offload()``, ``rte_eth_dev_get_vlan_offload()``. @@ -526,11 +529,12 @@ QinQ offload Supports QinQ (queue in queue) offload. * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_QINQ_STRIP``. +* **[uses] rte_eth_txconf,rte_eth_txmode**: ``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``. * **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_QINQ_STRIP``, - ``tx_offload_capa:DEV_TX_OFFLOAD_QINQ_INSERT``. + ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_QINQ_INSERT``. .. _nic_features_l3_checksum_offload: @@ -541,13 +545,14 @@ L3 checksum offload Supports L3 checksum offload. * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_IPV4_CKSUM``. +* **[uses] rte_eth_txconf,rte_eth_txmode**: ``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`` | ``PKT_RX_IP_CKSUM_BAD`` | ``PKT_RX_IP_CKSUM_GOOD`` | ``PKT_RX_IP_CKSUM_NONE``. * **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_IPV4_CKSUM``, - ``tx_offload_capa:DEV_TX_OFFLOAD_IPV4_CKSUM``. + ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_IPV4_CKSUM``. .. _nic_features_l4_checksum_offload: @@ -558,6 +563,7 @@ L4 checksum offload Supports L4 checksum offload. * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_UDP_CKSUM,DEV_RX_OFFLOAD_TCP_CKSUM``. +* **[uses] rte_eth_txconf,rte_eth_txmode**: ``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``. @@ -565,7 +571,7 @@ Supports L4 checksum offload. ``PKT_RX_L4_CKSUM_BAD`` | ``PKT_RX_L4_CKSUM_GOOD`` | ``PKT_RX_L4_CKSUM_NONE``. * **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_UDP_CKSUM,DEV_RX_OFFLOAD_TCP_CKSUM``, - ``tx_offload_capa:DEV_TX_OFFLOAD_UDP_CKSUM,DEV_TX_OFFLOAD_TCP_CKSUM,DEV_TX_OFFLOAD_SCTP_CKSUM``. + ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_UDP_CKSUM,DEV_TX_OFFLOAD_TCP_CKSUM,DEV_TX_OFFLOAD_SCTP_CKSUM``. .. _nic_features_macsec_offload: @@ -576,9 +582,10 @@ MACsec offload Supports MACsec. * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_MACSEC_STRIP``. +* **[uses] rte_eth_txconf,rte_eth_txmode**: ``offloads:DEV_TX_OFFLOAD_MACSEC_INSERT``. * **[uses] mbuf**: ``mbuf.ol_flags:PKT_TX_MACSEC``. * **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_MACSEC_STRIP``, - ``tx_offload_capa:DEV_TX_OFFLOAD_MACSEC_INSERT``. + ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_MACSEC_INSERT``. .. _nic_features_inner_l3_checksum: @@ -589,6 +596,7 @@ Inner L3 checksum Supports inner packet L3 checksum. * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM``. +* **[uses] rte_eth_txconf,rte_eth_txmode**: ``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``, @@ -596,7 +604,7 @@ Supports inner packet L3 checksum. * **[uses] mbuf**: ``mbuf.outer_l2_len``, ``mbuf.outer_l3_len``. * **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_EIP_CKSUM_BAD``. * **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM``, - ``tx_offload_capa:DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM``. + ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM``. .. _nic_features_inner_l4_checksum: @@ -620,6 +628,15 @@ Supports packet type parsing and returns a list of supported types. .. _nic_features_timesync: +Mbuf fast free +-------------- + +Supports optimization for fast release of mbufs following successful Tx. +Requires all mbufs to come from the same mempool and has refcnt = 1. + +* **[uses] rte_eth_txconf,rte_eth_txmode**: ``offloads:DEV_TX_OFFLOAD_MBUF_FAST_FREE``. +* **[provides] rte_eth_dev_info**: ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_MBUF_FAST_FREE``. + Timesync -------- diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index b3c10701e..85b99588f 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1186,6 +1186,55 @@ 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; + if ((txq_flags & ETH_TXQ_FLAGS_NOREFCOUNT) && + (txq_flags & ETH_TXQ_FLAGS_NOMULTMEMP)) + offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE; + + *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; + if (tx_offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) + flags |= (ETH_TXQ_FLAGS_NOREFCOUNT | ETH_TXQ_FLAGS_NOMULTMEMP); + + *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 +1242,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 +1287,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 ba7a2b2dc..d4a00a760 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. */ + /** + * 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. + */ + uint64_t offloads; /* For i40e specifically */ uint16_t pvid; @@ -734,6 +740,15 @@ struct rte_eth_rxconf { (ETH_TXQ_FLAGS_NOXSUMSCTP | ETH_TXQ_FLAGS_NOXSUMUDP | \ ETH_TXQ_FLAGS_NOXSUMTCP) /** + * 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. + */ +#define ETH_TXQ_FLAGS_IGNORE 0x8000 + +/** * A structure used to configure a TX ring of an Ethernet port. */ struct rte_eth_txconf { @@ -744,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(). */ + /** + * 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. + */ + uint64_t offloads; }; /** @@ -968,6 +989,13 @@ 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 +/**< Device supports multi segment send. */ +#define DEV_TX_OFFLOAD_MBUF_FAST_FREE 0x00010000 +/**< Device supports optimization for fast release of mbufs. + * When set application must guarantee that all mbufs comes from a single + * mempool and has refcnt = 1. + */ struct rte_pci_device; @@ -990,9 +1018,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 */ @@ -2023,6 +2054,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.