From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Ivan Malov <ivan.malov@oktetlabs.ru>,
Thomas Monjalon <thomas@monjalon.net>,
Ferruh Yigit <ferruh.yigit@intel.com>,
Shahaf Shuler <shahafs@mellanox.com>
Subject: [dpdk-dev] [PATCH v2 2/6] ethdev: add a function to look up Tx offload names
Date: Thu, 18 Jan 2018 07:02:27 +0000 [thread overview]
Message-ID: <1516258951-5897-3-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1516258951-5897-1-git-send-email-arybchenko@solarflare.com>
From: Ivan Malov <ivan.malov@oktetlabs.ru>
Commonly, drivers converted to the new offload API
may need to log unsupported offloads as a response
to wrong settings. From this perspective, it would
be convenient to have generic functions to look up
offload names. The patch adds such a helper for Tx.
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Cc: Thomas Monjalon <thomas@monjalon.net>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Shahaf Shuler <shahafs@mellanox.com>
---
lib/librte_ether/rte_ethdev.c | 45 +++++++++++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.h | 18 +++++++++++++
lib/librte_ether/rte_ethdev_version.map | 1 +
3 files changed, 64 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 9e9ef83..cd4a3ed 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -116,6 +116,35 @@ static const struct {
#undef RTE_RX_OFFLOAD_BIT2STR
+#define RTE_TX_OFFLOAD_BIT2STR(_name) \
+ { DEV_TX_OFFLOAD_##_name, #_name }
+
+static const struct {
+ uint64_t offload;
+ const char *name;
+} rte_tx_offload_names[] = {
+ RTE_TX_OFFLOAD_BIT2STR(VLAN_INSERT),
+ RTE_TX_OFFLOAD_BIT2STR(IPV4_CKSUM),
+ RTE_TX_OFFLOAD_BIT2STR(UDP_CKSUM),
+ RTE_TX_OFFLOAD_BIT2STR(TCP_CKSUM),
+ RTE_TX_OFFLOAD_BIT2STR(SCTP_CKSUM),
+ RTE_TX_OFFLOAD_BIT2STR(TCP_TSO),
+ RTE_TX_OFFLOAD_BIT2STR(UDP_TSO),
+ RTE_TX_OFFLOAD_BIT2STR(OUTER_IPV4_CKSUM),
+ RTE_TX_OFFLOAD_BIT2STR(QINQ_INSERT),
+ RTE_TX_OFFLOAD_BIT2STR(VXLAN_TNL_TSO),
+ RTE_TX_OFFLOAD_BIT2STR(GRE_TNL_TSO),
+ RTE_TX_OFFLOAD_BIT2STR(IPIP_TNL_TSO),
+ RTE_TX_OFFLOAD_BIT2STR(GENEVE_TNL_TSO),
+ RTE_TX_OFFLOAD_BIT2STR(MACSEC_INSERT),
+ RTE_TX_OFFLOAD_BIT2STR(MT_LOCKFREE),
+ RTE_TX_OFFLOAD_BIT2STR(MULTI_SEGS),
+ RTE_TX_OFFLOAD_BIT2STR(MBUF_FAST_FREE),
+ RTE_TX_OFFLOAD_BIT2STR(SECURITY),
+};
+
+#undef RTE_TX_OFFLOAD_BIT2STR
+
/**
* The user application callback description.
*
@@ -788,6 +817,22 @@ rte_eth_dev_rx_offload_name(uint64_t offload)
return name;
}
+const char *
+rte_eth_dev_tx_offload_name(uint64_t offload)
+{
+ const char *name = "UNKNOWN";
+ unsigned int i;
+
+ for (i = 0; i < RTE_DIM(rte_tx_offload_names); ++i) {
+ if (offload == rte_tx_offload_names[i].offload) {
+ name = rte_tx_offload_names[i].name;
+ break;
+ }
+ }
+
+ return name;
+}
+
int
rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
const struct rte_eth_conf *dev_conf)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 0396465..5fab553 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -981,6 +981,11 @@ struct rte_eth_conf {
*/
#define DEV_TX_OFFLOAD_SECURITY 0x00020000
+/*
+ * If new Tx offload capabilities are defined, they also must be
+ * mentioned in rte_tx_offload_names in rte_ethdev.c file.
+ */
+
struct rte_pci_device;
/**
@@ -1941,6 +1946,19 @@ uint32_t rte_eth_speed_bitflag(uint32_t speed, int duplex);
const char *rte_eth_dev_rx_offload_name(uint64_t offload);
/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Get DEV_TX_OFFLOAD_* flag name
+ *
+ * @param offload
+ * Offload flag
+ * @return
+ * Offload name or 'UNKNOWN' if the flag cannot be recognised
+ */
+const char *rte_eth_dev_tx_offload_name(uint64_t offload);
+
+/**
* Configure an Ethernet device.
* This function must be invoked first before any other function in the
* Ethernet API. This function can also be re-invoked when a device is in the
diff --git a/lib/librte_ether/rte_ethdev_version.map b/lib/librte_ether/rte_ethdev_version.map
index 94d348f..4239e8a 100644
--- a/lib/librte_ether/rte_ethdev_version.map
+++ b/lib/librte_ether/rte_ethdev_version.map
@@ -214,5 +214,6 @@ EXPERIMENTAL {
rte_mtr_stats_read;
rte_mtr_stats_update;
rte_eth_dev_rx_offload_name;
+ rte_eth_dev_tx_offload_name;
} DPDK_17.11;
--
2.7.4
next prev parent reply other threads:[~2018-01-18 7:02 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-11 8:12 [dpdk-dev] [PATCH 0/6] net/sfc: convert to the new offload API Andrew Rybchenko
2018-01-11 8:12 ` [dpdk-dev] [PATCH 1/6] ethdev: add a function to look up Rx offload names Andrew Rybchenko
2018-01-17 16:55 ` Ferruh Yigit
2018-01-17 17:06 ` Thomas Monjalon
2018-01-17 17:33 ` Thomas Monjalon
2018-01-18 6:32 ` Shahaf Shuler
2018-01-18 7:16 ` Andrew Rybchenko
2018-01-18 7:52 ` Andrew Rybchenko
2018-01-18 9:24 ` Thomas Monjalon
2018-01-11 8:12 ` [dpdk-dev] [PATCH 2/6] ethdev: add a function to look up Tx " Andrew Rybchenko
2018-01-11 8:12 ` [dpdk-dev] [PATCH 3/6] net/sfc: factor out function to report Rx capabilities Andrew Rybchenko
2018-01-11 8:12 ` [dpdk-dev] [PATCH 4/6] net/sfc: convert to the new Rx offload API Andrew Rybchenko
2018-01-11 8:12 ` [dpdk-dev] [PATCH 5/6] net/sfc: factor out function to report Tx capabilities Andrew Rybchenko
2018-01-11 8:12 ` [dpdk-dev] [PATCH 6/6] net/sfc: convert to the new Tx offload API Andrew Rybchenko
2018-01-17 16:55 ` [dpdk-dev] [PATCH 0/6] net/sfc: convert to the new " Ferruh Yigit
2018-01-18 7:02 ` [dpdk-dev] [PATCH v2 " Andrew Rybchenko
2018-01-18 7:02 ` [dpdk-dev] [PATCH v2 1/6] ethdev: add a function to look up Rx offload names Andrew Rybchenko
2018-01-18 7:02 ` Andrew Rybchenko [this message]
2018-01-18 7:02 ` [dpdk-dev] [PATCH v2 3/6] net/sfc: factor out function to report Rx capabilities Andrew Rybchenko
2018-01-18 7:02 ` [dpdk-dev] [PATCH v2 4/6] net/sfc: convert to the new Rx offload API Andrew Rybchenko
2018-01-18 7:02 ` [dpdk-dev] [PATCH v2 5/6] net/sfc: factor out function to report Tx capabilities Andrew Rybchenko
2018-01-18 7:02 ` [dpdk-dev] [PATCH v2 6/6] net/sfc: convert to the new Tx offload API Andrew Rybchenko
2018-01-18 7:07 ` [dpdk-dev] [PATCH v3 0/6] net/sfc: convert to the new " Andrew Rybchenko
2018-01-18 7:07 ` [dpdk-dev] [PATCH v3 1/6] ethdev: add a function to look up Rx offload names Andrew Rybchenko
2018-01-18 9:26 ` Thomas Monjalon
2018-01-18 9:47 ` Andrew Rybchenko
2018-01-18 7:07 ` [dpdk-dev] [PATCH v3 2/6] ethdev: add a function to look up Tx " Andrew Rybchenko
2018-01-18 7:07 ` [dpdk-dev] [PATCH v3 3/6] net/sfc: factor out function to report Rx capabilities Andrew Rybchenko
2018-01-18 7:07 ` [dpdk-dev] [PATCH v3 4/6] net/sfc: convert to the new Rx offload API Andrew Rybchenko
2018-01-18 7:07 ` [dpdk-dev] [PATCH v3 5/6] net/sfc: factor out function to report Tx capabilities Andrew Rybchenko
2018-01-18 7:07 ` [dpdk-dev] [PATCH v3 6/6] net/sfc: convert to the new Tx offload API Andrew Rybchenko
2018-01-18 9:44 ` [dpdk-dev] [PATCH v4 0/6] net/sfc: convert to the new " Andrew Rybchenko
2018-01-18 9:44 ` [dpdk-dev] [PATCH v4 1/6] ethdev: add a function to look up Rx offload names Andrew Rybchenko
2018-01-18 10:29 ` Thomas Monjalon
2018-01-18 9:44 ` [dpdk-dev] [PATCH v4 2/6] ethdev: add a function to look up Tx " Andrew Rybchenko
2018-01-18 10:30 ` Thomas Monjalon
2018-01-18 9:44 ` [dpdk-dev] [PATCH v4 3/6] net/sfc: factor out function to report Rx capabilities Andrew Rybchenko
2018-01-18 9:44 ` [dpdk-dev] [PATCH v4 4/6] net/sfc: convert to the new Rx offload API Andrew Rybchenko
2018-01-18 9:44 ` [dpdk-dev] [PATCH v4 5/6] net/sfc: factor out function to report Tx capabilities Andrew Rybchenko
2018-01-18 9:44 ` [dpdk-dev] [PATCH v4 6/6] net/sfc: convert to the new Tx offload API Andrew Rybchenko
2018-01-18 15:40 ` [dpdk-dev] [PATCH v4 0/6] net/sfc: convert to the new " Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1516258951-5897-3-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=ivan.malov@oktetlabs.ru \
--cc=shahafs@mellanox.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).