"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"
cmdline_fixed_string_t insert;
uint8_t port_id;
uint16_t vf_id;
- cmdline_fixed_string_t on_off;
+ uint16_t vlan_id;
};
/* Common CLI fields for vf vlan insert enable disable */
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,
- on_off, "on#off");
+ vlan_id, UINT16);
static void
cmd_set_vf_vlan_insert_parsed(
{
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:
- 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);
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,
(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,
NULL,
},
};
}
int
-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;
if (vf >= dev_info.max_vfs)
return -EINVAL;
- if (on > 1)
+ if (vlan_id > 4095)
return -EINVAL;
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf));
- if (on) {
- ctrl = on;
+ if (vlan_id) {
+ ctrl = vlan_id;
ctrl |= IXGBE_VMVIR_VLANA_DEFAULT;
} else {
ctrl = 0;
* 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.
*/
-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