dpdk: add intf tag to dev{} subinput 05/35805/4
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>
Mon, 28 Mar 2022 16:39:58 +0000 (18:39 +0200)
committerDamjan Marion <dmarion@0xa5.net>
Thu, 26 Jan 2023 15:21:02 +0000 (15:21 +0000)
This patch allows to pass a tag when specifying
the dpdk `dev {  }` interface configuration.

It allows a control plane generating a vpp.conf
file to retreive the resulting mapping between
dpdk interfaces & sw_if_indices in VPP without
having to change the interface name exposed
to the user.

Type: feature

Change-Id: I55907417de0083b82d4a127172816cec3459acf3
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
src/plugins/dpdk/device/dpdk.h
src/plugins/dpdk/device/init.c

index 7569fc6..7238ecf 100644 (file)
@@ -243,6 +243,7 @@ typedef struct
   };
   dpdk_device_addr_type_t dev_addr_type;
   u8 *name;
+  u8 *tag;
   u8 is_blacklisted;
 
 #define _(x) uword x;
index 83ce2dc..d611500 100644 (file)
@@ -449,6 +449,9 @@ dpdk_lib_init (dpdk_main_t * dm)
       xd->sw_if_index = sw->sw_if_index;
       dpdk_log_debug ("[%u] interface %s created", port_id, hi->name);
 
+      if (devconf->tag)
+       vnet_set_sw_interface_tag (vnm, devconf->tag, sw->sw_if_index);
+
       ethernet_set_flags (vnm, xd->hw_if_index,
                          ETHERNET_INTERFACE_FLAG_DEFAULT_L3);
 
@@ -877,6 +880,8 @@ dpdk_device_config (dpdk_config_main_t *conf, void *addr,
        ;
       else if (unformat (input, "name %v", &devconf->name))
        ;
+      else if (unformat (input, "tag %s", &devconf->tag))
+       ;
       else if (unformat (input, "workers %U", unformat_bitmap_list,
                         &devconf->workers))
        ;