diff options
author | Stanislav Zaikin <stanislav.zaikin@46labs.com> | 2024-10-04 17:43:55 +0200 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2024-10-28 09:22:42 +0000 |
commit | 0dd47bcf2b0e265c3d27fdc60b49e41be804f78a (patch) | |
tree | 6b99b645736e51774594d53cb9fe6f0491014b3c /src/plugins | |
parent | 8987d3a4cafb5128fe26154f106c1971967dd72c (diff) |
af_xdp: api cleanup
remove deprecated api handlers
Type: improvement
Change-Id: Id53d94f9d5fe46eba3ed809e4c16136c0eb2befc
Signed-off-by: Stanislav Zaikin <stanislav.zaikin@46labs.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/af_xdp/af_xdp.api | 90 | ||||
-rw-r--r-- | src/plugins/af_xdp/api.c | 59 | ||||
-rw-r--r-- | src/plugins/af_xdp/test_api.c | 110 |
3 files changed, 3 insertions, 256 deletions
diff --git a/src/plugins/af_xdp/af_xdp.api b/src/plugins/af_xdp/af_xdp.api index 4c2908e2037..20aa20b4d7d 100644 --- a/src/plugins/af_xdp/af_xdp.api +++ b/src/plugins/af_xdp/af_xdp.api @@ -33,96 +33,6 @@ enumflag af_xdp_flag : u8 /** \brief @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request - @param host_if - Linux netdev interface name - @param name - new af_xdp interface name (optional) - @param rxq_num - number of receive queues. 65535 can be used as special value to request all available queues (optional) - @param rxq_size - receive queue size (optional) - @param txq_size - transmit queue size (optional) - @param mode - operation mode (optional) - @param flags - flags (optional) - @param prog - eBPF program path (optional) -*/ - -define af_xdp_create -{ - u32 client_index; - u32 context; - - string host_if[64]; - string name[64]; - u16 rxq_num [default=1]; - u16 rxq_size [default=0]; - u16 txq_size [default=0]; - vl_api_af_xdp_mode_t mode [default=0]; - vl_api_af_xdp_flag_t flags [default=0]; - string prog[256]; - option vat_help = "<host-if linux-ifname> [name ifname] [rx-queue-size size] [tx-queue-size size] [num-rx-queues <num|all>] [prog pathname] [zero-copy|no-zero-copy] [no-syscall-lock]"; - option deprecated; -}; - -/** \brief - @param client_index - opaque cookie to identify the sender - @param context - sender context, to match reply w/ request - @param host_if - Linux netdev interface name - @param name - new af_xdp interface name (optional) - @param rxq_num - number of receive queues. 65535 can be used as special value to request all available queues (optional) - @param rxq_size - receive queue size (optional) - @param txq_size - transmit queue size (optional) - @param mode - operation mode (optional) - @param flags - flags (optional) - @param prog - eBPF program path (optional) - @param namespace - netns of nic (optional) -*/ - -define af_xdp_create_v2 -{ - u32 client_index; - u32 context; - - string host_if[64]; - string name[64]; - u16 rxq_num [default=1]; - u16 rxq_size [default=0]; - u16 txq_size [default=0]; - vl_api_af_xdp_mode_t mode [default=0]; - vl_api_af_xdp_flag_t flags [default=0]; - string prog[256]; - string namespace[64]; - option vat_help = "<host-if linux-ifname> [name ifname] [rx-queue-size size] [tx-queue-size size] [num-rx-queues <num|all>] [prog pathname] [netns ns] [zero-copy|no-zero-copy] [no-syscall-lock]"; - option deprecated; -}; - -/** \brief - @param context - sender context, to match reply w/ request - @param retval - return value for request - @param sw_if_index - software index for the new af_xdp interface -*/ - -define af_xdp_create_reply -{ - u32 context; - i32 retval; - vl_api_interface_index_t sw_if_index; - option deprecated; -}; - -/** \brief - @param context - sender context, to match reply w/ request - @param retval - return value for request - @param sw_if_index - software index for the new af_xdp interface -*/ - -define af_xdp_create_v2_reply -{ - u32 context; - i32 retval; - vl_api_interface_index_t sw_if_index; - option deprecated; -}; - -/** \brief - @param client_index - opaque cookie to identify the sender - @param context - sender context, to match reply w/ request @param sw_if_index - interface index */ diff --git a/src/plugins/af_xdp/api.c b/src/plugins/af_xdp/api.c index 3e9a3fe2578..9ead9856ff5 100644 --- a/src/plugins/af_xdp/api.c +++ b/src/plugins/af_xdp/api.c @@ -57,65 +57,6 @@ af_xdp_api_flags (vl_api_af_xdp_flag_t flags) } static void -vl_api_af_xdp_create_t_handler (vl_api_af_xdp_create_t * mp) -{ - vlib_main_t *vm = vlib_get_main (); - af_xdp_main_t *rm = &af_xdp_main; - vl_api_af_xdp_create_reply_t *rmp; - af_xdp_create_if_args_t args; - int rv; - - clib_memset (&args, 0, sizeof (af_xdp_create_if_args_t)); - - args.linux_ifname = mp->host_if[0] ? (char *) mp->host_if : 0; - args.name = mp->name[0] ? (char *) mp->name : 0; - args.prog = mp->prog[0] ? (char *) mp->prog : 0; - args.mode = af_xdp_api_mode (mp->mode); - args.flags = af_xdp_api_flags (mp->flags); - args.rxq_size = ntohs (mp->rxq_size); - args.txq_size = ntohs (mp->txq_size); - args.rxq_num = ntohs (mp->rxq_num); - - af_xdp_create_if (vm, &args); - rv = args.rv; - - REPLY_MACRO2 (VL_API_AF_XDP_CREATE_REPLY, - ({ rmp->sw_if_index = ntohl (args.sw_if_index); })); -} - -static void -vl_api_af_xdp_create_v2_t_handler (vl_api_af_xdp_create_v2_t *mp) -{ - vlib_main_t *vm = vlib_get_main (); - af_xdp_main_t *rm = &af_xdp_main; - vl_api_af_xdp_create_v2_reply_t *rmp; - af_xdp_create_if_args_t args; - int rv; - - clib_memset (&args, 0, sizeof (af_xdp_create_if_args_t)); - - args.linux_ifname = mp->host_if[0] ? (char *) mp->host_if : 0; - args.name = mp->name[0] ? (char *) mp->name : 0; - args.prog = mp->prog[0] ? (char *) mp->prog : 0; - args.netns = mp->namespace[0] ? (char *) mp->namespace : 0; - args.mode = af_xdp_api_mode (mp->mode); - args.flags = af_xdp_api_flags (mp->flags); - args.rxq_size = ntohs (mp->rxq_size); - args.txq_size = ntohs (mp->txq_size); - args.rxq_num = ntohs (mp->rxq_num); - - af_xdp_create_if (vm, &args); - rv = args.rv; - - /* clang-format off */ - REPLY_MACRO2 (VL_API_AF_XDP_CREATE_V2_REPLY, - ({ - rmp->sw_if_index = ntohl (args.sw_if_index); - })); - /* clang-format on */ -} - -static void vl_api_af_xdp_create_v3_t_handler (vl_api_af_xdp_create_v3_t *mp) { vlib_main_t *vm = vlib_get_main (); diff --git a/src/plugins/af_xdp/test_api.c b/src/plugins/af_xdp/test_api.c index 581697e341d..5f622adcb04 100644 --- a/src/plugins/af_xdp/test_api.c +++ b/src/plugins/af_xdp/test_api.c @@ -58,75 +58,7 @@ api_af_xdp_mode (af_xdp_mode_t mode) return ~0; } -/* af_xdp create API */ -static int -api_af_xdp_create (vat_main_t * vam) -{ - vl_api_af_xdp_create_t *mp; - af_xdp_create_if_args_t args; - int ret; - - if (!unformat_user (vam->input, unformat_af_xdp_create_if_args, &args)) - { - clib_warning ("unknown input `%U'", format_unformat_error, vam->input); - return -99; - } - - M (AF_XDP_CREATE, mp); - - snprintf ((char *) mp->host_if, sizeof (mp->host_if), "%s", - args.linux_ifname ? : ""); - snprintf ((char *) mp->name, sizeof (mp->name), "%s", args.name ? : ""); - mp->rxq_num = clib_host_to_net_u16 (args.rxq_num); - mp->rxq_size = clib_host_to_net_u16 (args.rxq_size); - mp->txq_size = clib_host_to_net_u16 (args.txq_size); - mp->mode = api_af_xdp_mode (args.mode); - if (args.flags & AF_XDP_CREATE_FLAGS_NO_SYSCALL_LOCK) - mp->flags |= AF_XDP_API_FLAGS_NO_SYSCALL_LOCK; - snprintf ((char *) mp->prog, sizeof (mp->prog), "%s", args.prog ? : ""); - - S (mp); - W (ret); - - return ret; -} - -/* af_xdp create v2 API */ -static int -api_af_xdp_create_v2 (vat_main_t *vam) -{ - vl_api_af_xdp_create_v2_t *mp; - af_xdp_create_if_args_t args; - int ret; - - if (!unformat_user (vam->input, unformat_af_xdp_create_if_args, &args)) - { - clib_warning ("unknown input `%U'", format_unformat_error, vam->input); - return -99; - } - - M (AF_XDP_CREATE, mp); - - snprintf ((char *) mp->host_if, sizeof (mp->host_if), "%s", - args.linux_ifname ?: ""); - snprintf ((char *) mp->name, sizeof (mp->name), "%s", args.name ?: ""); - snprintf ((char *) mp->namespace, sizeof (mp->namespace), "%s", - args.netns ?: ""); - mp->rxq_num = clib_host_to_net_u16 (args.rxq_num); - mp->rxq_size = clib_host_to_net_u16 (args.rxq_size); - mp->txq_size = clib_host_to_net_u16 (args.txq_size); - mp->mode = api_af_xdp_mode (args.mode); - if (args.flags & AF_XDP_CREATE_FLAGS_NO_SYSCALL_LOCK) - mp->flags |= AF_XDP_API_FLAGS_NO_SYSCALL_LOCK; - snprintf ((char *) mp->prog, sizeof (mp->prog), "%s", args.prog ?: ""); - - S (mp); - W (ret); - - return ret; -} - -/* af_xdp create v2 API */ +/* af_xdp create v3 API */ static int api_af_xdp_create_v3 (vat_main_t *vam) { @@ -140,7 +72,7 @@ api_af_xdp_create_v3 (vat_main_t *vam) return -99; } - M (AF_XDP_CREATE, mp); + M (AF_XDP_CREATE_V3, mp); snprintf ((char *) mp->host_if, sizeof (mp->host_if), "%s", args.linux_ifname ?: ""); @@ -160,45 +92,9 @@ api_af_xdp_create_v3 (vat_main_t *vam) return ret; } -/* af_xdp-create reply handler */ -static void -vl_api_af_xdp_create_reply_t_handler (vl_api_af_xdp_create_reply_t * mp) -{ - vat_main_t *vam = af_xdp_test_main.vat_main; - i32 retval = ntohl (mp->retval); - - if (retval == 0) - { - fformat (vam->ofp, "created af_xdp with sw_if_index %d\n", - ntohl (mp->sw_if_index)); - } - - vam->retval = retval; - vam->result_ready = 1; - vam->regenerate_interface_table = 1; -} - -/* af_xdp-create v2 reply handler */ -static void -vl_api_af_xdp_create_v2_reply_t_handler (vl_api_af_xdp_create_v2_reply_t *mp) -{ - vat_main_t *vam = af_xdp_test_main.vat_main; - i32 retval = ntohl (mp->retval); - - if (retval == 0) - { - fformat (vam->ofp, "created af_xdp with sw_if_index %d\n", - ntohl (mp->sw_if_index)); - } - - vam->retval = retval; - vam->result_ready = 1; - vam->regenerate_interface_table = 1; -} - /* af_xdp-create v3 reply handler */ static void -vl_api_af_xdp_create_v3_reply_t_handler (vl_api_af_xdp_create_v2_reply_t *mp) +vl_api_af_xdp_create_v3_reply_t_handler (vl_api_af_xdp_create_v3_reply_t *mp) { vat_main_t *vam = af_xdp_test_main.vat_main; i32 retval = mp->retval; |