summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2021-02-10 12:03:53 +0100
committerDamjan Marion <dmarion@me.com>2021-03-19 14:30:50 +0000
commit5b3f523918932793254b6313f78659fe0ed6320e (patch)
tree26241978a6669b4a466e09d598cc0e83cb00825c /src/plugins
parent34c54dff5c66f9a4aef77daf08219301e15cc1fa (diff)
interface: add capabilities flags
Type: improvement This patch adds flags to represent the modern NICs capabilities. Change-Id: I96d38d9ab7eac55974d72795cd100d8337168e1e Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/af_xdp/device.c2
-rw-r--r--src/plugins/avf/device.c9
-rw-r--r--src/plugins/dpdk/device/common.c4
-rw-r--r--src/plugins/dpdk/device/init.c18
-rw-r--r--src/plugins/lldp/lldp_cli.c4
-rw-r--r--src/plugins/memif/memif.c2
-rw-r--r--src/plugins/rdma/device.c4
-rw-r--r--src/plugins/vmxnet3/vmxnet3.c9
8 files changed, 29 insertions, 23 deletions
diff --git a/src/plugins/af_xdp/device.c b/src/plugins/af_xdp/device.c
index 48e61dd03d1..fabf85adfa6 100644
--- a/src/plugins/af_xdp/device.c
+++ b/src/plugins/af_xdp/device.c
@@ -420,7 +420,7 @@ af_xdp_create_if (vlib_main_t * vm, af_xdp_create_if_args_t * args)
sw = vnet_get_hw_sw_interface (vnm, ad->hw_if_index);
hw = vnet_get_hw_interface (vnm, ad->hw_if_index);
args->sw_if_index = ad->sw_if_index = sw->sw_if_index;
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
vnet_hw_if_set_input_node (vnm, ad->hw_if_index, af_xdp_input_node.index);
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index fd173980ba1..aec7efaee6f 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -1649,10 +1649,9 @@ avf_create_if (vlib_main_t * vm, avf_create_if_args_t * args)
/* Indicate ability to support L3 DMAC filtering and
* initialize interface to L3 non-promisc mode */
vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, ad->hw_if_index);
- hi->flags |=
- VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER |
- VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD |
- VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO;
+ hi->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO;
ethernet_set_flags (vnm, ad->hw_if_index,
ETHERNET_INTERFACE_FLAG_DEFAULT_L3);
@@ -1660,7 +1659,7 @@ avf_create_if (vlib_main_t * vm, avf_create_if_args_t * args)
args->sw_if_index = ad->sw_if_index = sw->sw_if_index;
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, ad->hw_if_index);
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
vnet_hw_if_set_input_node (vnm, ad->hw_if_index, avf_input_node.index);
for (i = 0; i < ad->n_rx_queues; i++)
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c
index 2ae0096ad32..89046d1a8c0 100644
--- a/src/plugins/dpdk/device/common.c
+++ b/src/plugins/dpdk/device/common.c
@@ -210,7 +210,7 @@ dpdk_setup_interrupts (dpdk_device_t *xd)
if (xd->flags & DPDK_DEVICE_FLAG_INT_SUPPORTED)
{
- hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+ hi->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
for (int q = 0; q < xd->rx_q_used; q++)
{
dpdk_rx_queue_t *rxq = vec_elt_at_index (xd->rx_queues, q);
@@ -219,7 +219,7 @@ dpdk_setup_interrupts (dpdk_device_t *xd)
if (rxq->efd < 0)
{
xd->flags &= ~DPDK_DEVICE_FLAG_INT_SUPPORTED;
- hi->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+ hi->caps &= ~VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
break;
}
f.read_function = dpdk_rx_read_ready;
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index bf1683b2096..2834a3196e4 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -773,24 +773,28 @@ dpdk_lib_init (dpdk_main_t * dm)
/* Indicate ability to support L3 DMAC filtering and
* initialize interface to L3 non-promisc mode */
- hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER;
+ hi->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER;
ethernet_set_flags (dm->vnet_main, xd->hw_if_index,
ETHERNET_INTERFACE_FLAG_DEFAULT_L3);
}
if (dm->conf->no_tx_checksum_offload == 0)
if (xd->flags & DPDK_DEVICE_FLAG_TX_OFFLOAD && hi != NULL)
- hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
-
+ {
+ hi->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM;
+ }
if (devconf->tso == DPDK_DEVICE_TSO_ON && hi != NULL)
{
/*tcp_udp checksum must be enabled*/
if ((dm->conf->enable_tcp_udp_checksum) &&
- (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD))
+ (hi->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TX_CKSUM))
{
- hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO;
- xd->port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_TSO |
- DEV_TX_OFFLOAD_UDP_TSO;
+ hi->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_UDP_GSO;
+ xd->port_conf.txmode.offloads |=
+ DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_UDP_TSO;
}
else
clib_warning ("%s: TCP/UDP checksum offload must be enabled",
diff --git a/src/plugins/lldp/lldp_cli.c b/src/plugins/lldp/lldp_cli.c
index 583804d121c..e77d699393c 100644
--- a/src/plugins/lldp/lldp_cli.c
+++ b/src/plugins/lldp/lldp_cli.c
@@ -103,7 +103,7 @@ lldp_cfg_intf_set (u32 hw_if_index, u8 ** port_desc, u8 ** mgmt_ip4,
}
/* Add MAC address to an interface's filter */
- if (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER)
+ if (hi->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER)
{
error =
vnet_hw_interface_add_del_mac_address (lm->vnet_main,
@@ -130,7 +130,7 @@ lldp_cfg_intf_set (u32 hw_if_index, u8 ** port_desc, u8 ** mgmt_ip4,
lldp_intf_t *n = lldp_get_intf (lm, hi->sw_if_index);
lldp_delete_intf (lm, n);
/* Remove MAC address from the interface's filter */
- if ((n) && (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER))
+ if ((n) && (hi->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER))
{
error =
vnet_hw_interface_add_del_mac_address (lm->vnet_main,
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c
index 6bfb7b37163..80cd9026c83 100644
--- a/src/plugins/memif/memif.c
+++ b/src/plugins/memif/memif.c
@@ -1048,7 +1048,7 @@ memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args)
}
hw = vnet_get_hw_interface (vnm, mif->hw_if_index);
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
vnet_hw_if_set_input_node (vnm, mif->hw_if_index, memif_input_node.index);
mhash_set (&msf->dev_instance_by_id, &mif->id, mif->dev_instance, 0);
diff --git a/src/plugins/rdma/device.c b/src/plugins/rdma/device.c
index 63c521f2992..a85686270f9 100644
--- a/src/plugins/rdma/device.c
+++ b/src/plugins/rdma/device.c
@@ -363,7 +363,7 @@ rdma_register_interface (vnet_main_t * vnm, rdma_device_t * rd)
/* Indicate ability to support L3 DMAC filtering and
* initialize interface to L3 non-promisc mode */
vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, rd->hw_if_index);
- hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER;
+ hi->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER;
ethernet_set_flags (vnm, rd->hw_if_index,
ETHERNET_INTERFACE_FLAG_DEFAULT_L3);
return err;
@@ -984,7 +984,7 @@ are explicitly disabled, and if the interface supports it.*/
/*
* FIXME: add support for interrupt mode
* vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, rd->hw_if_index);
- * hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+ * hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
*/
vnet_hw_if_set_input_node (vnm, rd->hw_if_index, rdma_input_node.index);
diff --git a/src/plugins/vmxnet3/vmxnet3.c b/src/plugins/vmxnet3/vmxnet3.c
index 2c7b970d58f..aeb2af36d0a 100644
--- a/src/plugins/vmxnet3/vmxnet3.c
+++ b/src/plugins/vmxnet3/vmxnet3.c
@@ -808,10 +808,13 @@ vmxnet3_create_if (vlib_main_t * vm, vmxnet3_create_if_args_t * args)
args->sw_if_index = sw->sw_if_index;
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vd->hw_if_index);
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
if (vd->gso_enable)
- hw->flags |= (VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
- VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
+ {
+ hw->caps |= (VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM);
+ }
vnet_hw_if_set_input_node (vnm, vd->hw_if_index, vmxnet3_input_node.index);
/* Disable interrupts */