[dpdk-dev] net/liquidio: add support for promiscuous mode
Checks
Commit Message
From: Intiyaz Basha <intiyaz.basha@caviumnetworks.com>
Signed-off-by: Intiyaz Basha <intiyaz.basha@caviumnetworks.com>
Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>
---
doc/guides/nics/features/liquidio.ini | 1 +
doc/guides/nics/liquidio.rst | 8 ++++++
drivers/net/liquidio/base/lio_hw_defs.h | 3 +++
drivers/net/liquidio/lio_ethdev.c | 47 +++++++++++++++++++++++++++++++++
drivers/net/liquidio/lio_struct.h | 1 +
5 files changed, 60 insertions(+)
Comments
On 10/11/2017 12:47 AM, Shijith Thotton wrote:
> From: Intiyaz Basha <intiyaz.basha@caviumnetworks.com>
>
> Signed-off-by: Intiyaz Basha <intiyaz.basha@caviumnetworks.com>
> Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>
Applied to dpdk-next-net/master, thanks.
@@ -10,6 +10,7 @@ Link status event = Y
MTU update = Y
Jumbo frame = Y
Scattered Rx = Y
+Promiscuous mode = Y
Allmulticast mode = Y
RSS hash = Y
RSS key update = Y
@@ -195,6 +195,14 @@ This section provides instructions to configure SR-IOV with Linux OS.
Done
testpmd>
+#. Enabling VF promiscuous mode
+
+ One VF per PF can be marked as trusted for promiscuous mode.
+
+ .. code-block:: console
+
+ ip link set dev <PF iface> vf <VF id> trust on
+
Limitations
-----------
@@ -106,6 +106,8 @@ enum lio_card_type {
#define LIO_FW_VERSION_LENGTH 32
+#define LIO_VF_TRUST_MIN_VERSION "1.7.1"
+
/** Tag types used by Octeon cores in its work. */
enum octeon_tag_type {
OCTEON_ORDERED_TAG = 0,
@@ -185,6 +187,7 @@ enum octeon_tag_type {
/* Interface flags communicated between host driver and core app. */
enum lio_ifflags {
+ LIO_IFFLAG_PROMISC = 0x01,
LIO_IFFLAG_ALLMULTI = 0x02,
LIO_IFFLAG_UNICAST = 0x10
};
@@ -1049,6 +1049,48 @@ struct rte_lio_xstats_name_off {
}
static void
+lio_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+{
+ struct lio_device *lio_dev = LIO_DEV(eth_dev);
+
+ if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
+ lio_dev_err(lio_dev, "Require firmware version >= %s\n",
+ LIO_VF_TRUST_MIN_VERSION);
+ return;
+ }
+
+ if (!lio_dev->intf_open) {
+ lio_dev_err(lio_dev, "Port %d down, can't enable promiscuous\n",
+ lio_dev->port_id);
+ return;
+ }
+
+ lio_dev->ifflags |= LIO_IFFLAG_PROMISC;
+ lio_change_dev_flag(eth_dev);
+}
+
+static void
+lio_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+{
+ struct lio_device *lio_dev = LIO_DEV(eth_dev);
+
+ if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
+ lio_dev_err(lio_dev, "Require firmware version >= %s\n",
+ LIO_VF_TRUST_MIN_VERSION);
+ return;
+ }
+
+ if (!lio_dev->intf_open) {
+ lio_dev_err(lio_dev, "Port %d down, can't disable promiscuous\n",
+ lio_dev->port_id);
+ return;
+ }
+
+ lio_dev->ifflags &= ~LIO_IFFLAG_PROMISC;
+ lio_change_dev_flag(eth_dev);
+}
+
+static void
lio_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
{
struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -1748,6 +1790,9 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev)
goto nic_config_fail;
}
+ snprintf(lio_dev->firmware_version, LIO_FW_VERSION_LENGTH, "%s",
+ resp->cfg_info.lio_firmware_version);
+
lio_swap_8B_data((uint64_t *)(&resp->cfg_info),
sizeof(struct octeon_if_cfg_info) >> 3);
@@ -1851,6 +1896,8 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev)
.dev_set_link_up = lio_dev_set_link_up,
.dev_set_link_down = lio_dev_set_link_down,
.dev_close = lio_dev_close,
+ .promiscuous_enable = lio_dev_promiscuous_enable,
+ .promiscuous_disable = lio_dev_promiscuous_disable,
.allmulticast_enable = lio_dev_allmulticast_enable,
.allmulticast_disable = lio_dev_allmulticast_disable,
.link_update = lio_dev_link_update,
@@ -685,5 +685,6 @@ struct lio_device {
uint8_t port_configured;
struct lio_rss_ctx rss_state;
uint8_t port_id;
+ char firmware_version[LIO_FW_VERSION_LENGTH];
};
#endif /* _LIO_STRUCT_H_ */