> -----Original Message-----
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:55 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo...@intel.com>
> Subject: [dpdk-dev] [PATCH v7 19/27] app/testpmd: use unicast promiscuous
> mode on i40e
> 
> Add testpmd CLI to set VF unicast promiscuous mode on i40e.
> 
> Signed-off-by: Wenzhuo Lu <wenzhuo...@intel.com>
> ---
>  app/test-pmd/cmdline.c                      | 93 
> +++++++++++++++++++++++++++++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  9 +++
>  2 files changed, 102 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 9a44b4f..affe9d1 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -400,6 +400,9 @@ static void cmd_help_long_parsed(void *parsed_result,
>                       "set allmulti (port_id|all) (on|off)\n"
>                       "    Set the allmulti mode on port_id, or all.\n\n"
> 
> +                     "set vf promisc (port_id) (vf_id) (on|off)\n"
> +                     "    Set unicast promiscuous mode for a VF from the
> PF.\n\n"
> +
>                       "set flow_ctrl rx (on|off) tx (on|off) (high_water)"
>                       " (low_water) (pause_time) (send_xon)
> mac_ctrl_frame_fwd"
>                       " (on|off) autoneg (on|off) (port_id)\n"
> @@ -11559,6 +11562,95 @@ struct cmd_set_vf_mac_addr_result {
>       },
>  };
> 
> +/* VF unicast promiscuous mode configuration */
> +
> +/* Common result structure for VF unicast promiscuous mode */ struct
> +cmd_vf_promisc_result {
> +     cmdline_fixed_string_t set;
> +     cmdline_fixed_string_t vf;
> +     cmdline_fixed_string_t promisc;
> +     uint8_t port_id;
> +     uint32_t vf_id;
> +     cmdline_fixed_string_t on_off;
> +};
> +
> +/* Common CLI fields for VF unicast promiscuous mode enable disable */
> +cmdline_parse_token_string_t cmd_vf_promisc_set =
> +     TOKEN_STRING_INITIALIZER
> +             (struct cmd_vf_promisc_result,
> +              set, "set");
> +cmdline_parse_token_string_t cmd_vf_promisc_vf =
> +     TOKEN_STRING_INITIALIZER
> +             (struct cmd_vf_promisc_result,
> +              vf, "vf");
> +cmdline_parse_token_string_t cmd_vf_promisc_promisc =
> +     TOKEN_STRING_INITIALIZER
> +             (struct cmd_vf_promisc_result,
> +              promisc, "promisc");
> +cmdline_parse_token_num_t cmd_vf_promisc_port_id =
> +     TOKEN_NUM_INITIALIZER
> +             (struct cmd_vf_promisc_result,
> +              port_id, UINT8);
> +cmdline_parse_token_num_t cmd_vf_promisc_vf_id =
> +     TOKEN_NUM_INITIALIZER
> +             (struct cmd_vf_promisc_result,
> +              vf_id, UINT32);
> +cmdline_parse_token_string_t cmd_vf_promisc_on_off =
> +     TOKEN_STRING_INITIALIZER
> +             (struct cmd_vf_promisc_result,
> +              on_off, "on#off");
> +
> +static void
> +cmd_set_vf_promisc_parsed(
> +     void *parsed_result,
> +     __attribute__((unused)) struct cmdline *cl,
> +     __attribute__((unused)) void *data)
> +{
> +     struct cmd_vf_promisc_result *res = parsed_result;
> +     int ret = -ENOTSUP;
> +
> +     __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
> +
> +     if (port_id_is_invalid(res->port_id, ENABLED_WARN))
> +             return;
> +
> +#ifdef RTE_LIBRTE_I40E_PMD
> +     ret = rte_pmd_i40e_set_vf_unicast_promisc(res->port_id,
> +                     res->vf_id, is_on);
> +#endif
> +

It's better to wrap the command by +#ifdef RTE_LIBRTE_I40E_PMD #endif
Or at least, need to check if the port is handled i40e pmd.

Reply via email to