The final parameter to rte_pmd_ixgbe_set_vf_vlan_insert is uint8_t
and treated as a binary flag when it needs to be a uint16_t
and treated as a VLAN id. The data sheet (sect 8.2.3.27.13) describes
the right most 16 bits as the VLAN id that is to be inserted; the
16.11 code is accepting only a 1 or 0 thus effectively only
allowing the VLAN id 1 to be inserted (0 disables the insertion
setting).
This patch changes the final parm name to represent the data that
is being accepted (vlan_id), changes the type to permit all valid
VLAN ids, and validates the parameter based on the range of 0 to
4095. Corresponding changes to prototype and documentation in the
.h file.
Fixes:
49e248223e9f71 ("net/ixgbe: add API for VF management")
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
"set vf vlan stripq (port_id) (vf_id) (on|off)\n"
" Set the VLAN strip for all queues in a pool for a VF from the PF.\n\n"
"set vf vlan stripq (port_id) (vf_id) (on|off)\n"
" Set the VLAN strip for all queues in a pool for a VF from the PF.\n\n"
- "set vf vlan insert (port_id) (vf_id) (on|off)\n"
+ "set vf vlan insert (port_id) (vf_id) (vlan_id)\n"
" Set VLAN insert for a VF from the PF.\n\n"
"set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
" Set VLAN insert for a VF from the PF.\n\n"
"set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
cmdline_fixed_string_t insert;
uint8_t port_id;
uint16_t vf_id;
cmdline_fixed_string_t insert;
uint8_t port_id;
uint16_t vf_id;
- cmdline_fixed_string_t on_off;
};
/* Common CLI fields for vf vlan insert enable disable */
};
/* Common CLI fields for vf vlan insert enable disable */
TOKEN_NUM_INITIALIZER
(struct cmd_vf_vlan_insert_result,
vf_id, UINT16);
TOKEN_NUM_INITIALIZER
(struct cmd_vf_vlan_insert_result,
vf_id, UINT16);
-cmdline_parse_token_string_t cmd_vf_vlan_insert_on_off =
- TOKEN_STRING_INITIALIZER
+cmdline_parse_token_num_t cmd_vf_vlan_insert_vlan_id =
+ TOKEN_NUM_INITIALIZER
(struct cmd_vf_vlan_insert_result,
(struct cmd_vf_vlan_insert_result,
static void
cmd_set_vf_vlan_insert_parsed(
static void
cmd_set_vf_vlan_insert_parsed(
{
struct cmd_vf_vlan_insert_result *res = parsed_result;
int ret;
{
struct cmd_vf_vlan_insert_result *res = parsed_result;
int ret;
- int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
- ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, is_on);
+ ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, res->vlan_id);
switch (ret) {
case 0:
break;
case -EINVAL:
switch (ret) {
case 0:
break;
case -EINVAL:
- printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+ printf("invalid vf_id %d or vlan_id %d\n", res->vf_id, res->vlan_id);
break;
case -ENODEV:
printf("invalid port_id %d\n", res->port_id);
break;
case -ENODEV:
printf("invalid port_id %d\n", res->port_id);
cmdline_parse_inst_t cmd_set_vf_vlan_insert = {
.f = cmd_set_vf_vlan_insert_parsed,
.data = NULL,
cmdline_parse_inst_t cmd_set_vf_vlan_insert = {
.f = cmd_set_vf_vlan_insert_parsed,
.data = NULL,
- .help_str = "set vf vlan insert port_id vf_id on|off",
+ .help_str = "set vf vlan insert port_id vf_id vlan_id",
.tokens = {
(void *)&cmd_vf_vlan_insert_set,
(void *)&cmd_vf_vlan_insert_vf,
.tokens = {
(void *)&cmd_vf_vlan_insert_set,
(void *)&cmd_vf_vlan_insert_vf,
(void *)&cmd_vf_vlan_insert_insert,
(void *)&cmd_vf_vlan_insert_port_id,
(void *)&cmd_vf_vlan_insert_vf_id,
(void *)&cmd_vf_vlan_insert_insert,
(void *)&cmd_vf_vlan_insert_port_id,
(void *)&cmd_vf_vlan_insert_vf_id,
- (void *)&cmd_vf_vlan_insert_on_off,
+ (void *)&cmd_vf_vlan_insert_vlan_id,
Set VLAN insert for a VF from the PF::
Set VLAN insert for a VF from the PF::
- testpmd> set vf vlan insert (port_id) (vf_id) (on|off)
+ testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
vlan set antispoof (for VF)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
vlan set antispoof (for VF)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on)
+rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t vlan_id)
{
struct ixgbe_hw *hw;
uint32_t ctrl;
{
struct ixgbe_hw *hw;
uint32_t ctrl;
if (vf >= dev_info.max_vfs)
return -EINVAL;
if (vf >= dev_info.max_vfs)
return -EINVAL;
return -EINVAL;
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf));
return -EINVAL;
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf));
+ if (vlan_id) {
+ ctrl = vlan_id;
ctrl |= IXGBE_VMVIR_VLANA_DEFAULT;
} else {
ctrl = 0;
ctrl |= IXGBE_VMVIR_VLANA_DEFAULT;
} else {
ctrl = 0;
* The port identifier of the Ethernet device.
* @param vf
* ID specifying VF.
* The port identifier of the Ethernet device.
* @param vf
* ID specifying VF.
- * @param on
- * 1 - Enable VF's vlan insert.
- * 0 - Disable VF's vlan insert
+ * @param vlan_id
+ * 0 - Disable VF's vlan insert.
+ * n - Enable; n is inserted as the vlan id.
*
* @return
* - (0) if successful.
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
*
* @return
* - (0) if successful.
* - (-ENODEV) if *port* invalid.
* - (-EINVAL) if bad parameter.
*/
-int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on);
+int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf,
+ uint16_t vlan_id);
/**
* Enable/Disable tx loopback
/**
* Enable/Disable tx loopback