net/ixgbe: move set VF functions.
cover net/ixgbe: move set VF functions.
This patchset implements the following deprecation notice:
[PATCH v1] doc: announce API and ABI change for librte_ether
The following functions from eth_dev_ops have been moved to the ixgbe PMD and renamed:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limit
Renamed the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limit
Testpmd has been modified to use the following functions:rte_pmd_ixgbe_set_vf_rxmode rte_pmd_ixgbe_set_vf_rate_limit
New testpmd commands have been added to test the following functions:rte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filter
The testpmd user guide has been updated for the new commands.
Bernard Iremonger (5):
net/ixgbe: move set VF functions from the ethdev app/testpmd: use ixgbe public functions app/testpmd: add command for set VF VLAN filter app/testpmd: add command for set VF receive app/testpmd: add command for set VF transmit
app/test-pmd/cmdline.c | 270 +++++++++++++++++++++++++++- app/test-pmd/config.c | 31 ++-- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 +++ drivers/net/ixgbe/ixgbe_ethdev.c | 263 +++++++++++++++++++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe.h | 104 +++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 10 ++ 6 files changed, 678 insertions(+), 21 deletions(-)
Signature · 1 line
2.10.1
PATCH 1/5 net/ixgbe: move set VF functions from the ethdev
Move the following functions from eth_dev_ops to the ixgbe PMD and rename:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limit
Rename the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limit
--- drivers/net/ixgbe/ixgbe_ethdev.c | 263 ++++++++++++++++++++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe.h | 104 +++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 10 ++ 3 files changed, 377 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +263 -0
@@ -4883,6 +4883,269 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)return 0 ; } +int +rte_pmd_ixgbe_set_vf_rxmode (uint8_t port,uint16_t vf,uint16_t rx_mask,uint8_t on) +{ +int val =0 ; +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct ixgbe_hw *hw; +uint32_t vmolr; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + vmolr =IXGBE_READ_REG (hw,IXGBE_VMOLR (vf)); + +if (hw->mac.type == ixgbe_mac_82598EB) { +PMD_INIT_LOG (ERR ,"setting VF receive mode set should be done" +" on 82599 hardware and newer" ); +return -ENOTSUP ; + } +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + + val =ixgbe_convert_vm_rx_mask_to_val (rx_mask, val); + +if (on) + vmolr |= val; +else + vmolr &= ~val; + +IXGBE_WRITE_REG (hw,IXGBE_VMOLR (vf), vmolr); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_rx (uint8_t port,uint16_t vf,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +uint32_t reg, addr; +uint32_t val; +const uint8_t bit1 =0x1 ; +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +/* for vf >= 32, set bit in PFVFRE[1], otherwise PFVFRE[0] */ +if (vf >=32 ) { + addr =IXGBE_VFRE (1 ); + val = bit1 << (vf -32 ); + }else { + addr =IXGBE_VFRE (0 ); + val = bit1 << vf; + } + + reg =IXGBE_READ_REG (hw, addr); + +if (on) + reg |= val; +else + reg &= ~val; + +IXGBE_WRITE_REG (hw, addr, reg); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_tx (uint8_t port,uint16_t vf,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +uint32_t reg, addr; +uint32_t val; +const uint8_t bit1 =0x1 ; + +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +/* for vf >= 32, set bit in PFVFTE[1], otherwise PFVFTE[0] */ +if (vf >=32 ) { + addr =IXGBE_VFTE (1 ); + val = bit1 << (vf -32 ); + }else { + addr =IXGBE_VFTE (0 ); + val = bit1 << vf; + } + + reg =IXGBE_READ_REG (hw, addr); + +if (on) + reg |= val; +else + reg &= ~val; + +IXGBE_WRITE_REG (hw, addr, reg); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_vlan_filter (uint8_t port,uint16_t vlan, +uint64_t vf_mask,uint8_t vlan_on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +int ret =0 ; +uint16_t vf_idx; +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if ((vlan >ETHER_MAX_VLAN_ID ) || (vf_mask ==0 )) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +for (vf_idx =0 ; vf_idx <64 ; vf_idx++) { +if (vf_mask & ((uint64_t )(1ULL << vf_idx))) { + ret = hw->mac.ops.set_vfta (hw, vlan, vf_idx, + vlan_on, false); +if (ret <0 ) +return ret; + } + } + +return ret; +} + +int rte_pmd_ixgbe_set_vf_rate_limit (uint8_t port,uint16_t vf, +uint16_t tx_rate,uint64_t q_msk) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct ixgbe_hw *hw; +struct ixgbe_vf_info *vfinfo; +struct rte_eth_link link; +uint8_t nb_q_per_pool; +uint32_t queue_stride; +uint32_t queue_idx, idx =0 , vf_idx; +uint32_t queue_end; +uint16_t total_rate =0 ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); +rte_eth_link_get_nowait (port, &link); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (tx_rate > link.link_speed) +return -EINVAL ; + +if (q_msk ==0 ) +return 0 ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA (dev->data->dev_private)); + nb_q_per_pool =RTE_ETH_DEV_SRIOV (dev).nb_q_per_pool; + queue_stride =IXGBE_MAX_RX_QUEUE_NUM /RTE_ETH_DEV_SRIOV (dev).active; + queue_idx = vf * queue_stride; + queue_end = queue_idx + nb_q_per_pool -1 ; +if (queue_end >= hw->mac.max_tx_queues) +return -EINVAL ; + +if (vfinfo) { +for (vf_idx =0 ; vf_idx < dev->pci_dev->max_vfs; vf_idx++) { +if (vf_idx == vf) +continue ; +for (idx =0 ; idx <RTE_DIM (vfinfo[vf_idx].tx_rate); + idx++) + total_rate += vfinfo[vf_idx].tx_rate[idx]; + } + }else { +return -EINVAL ; + } + +/* Store tx_rate for this vf. */ +for (idx =0 ; idx < nb_q_per_pool; idx++) { +if (((uint64_t )0x1 << idx) & q_msk) { +if (vfinfo[vf].tx_rate[idx] != tx_rate) + vfinfo[vf].tx_rate[idx] = tx_rate; + total_rate += tx_rate; + } + } + +if (total_rate > dev->data->dev_link.link_speed) { +/* Reset stored TX rate of the VF if it causes exceed +* link speed. +*/ +memset (vfinfo[vf].tx_rate,0 ,sizeof (vfinfo[vf].tx_rate)); +return -EINVAL ; + } + +/* Set RTTBCNRC of each queue/pool for vf X */ +for (; queue_idx <= queue_end; queue_idx++) { +if (0x1 & q_msk) +ixgbe_set_queue_rate_limit (dev, queue_idx, tx_rate); + q_msk = q_msk >>1 ; + } + +return 0 ; +} +#define IXGBE_MRCTL_VPME 0x01/* Virtual Pool Mirroring. */ #define IXGBE_MRCTL_UPME 0x02/* Uplink Port Mirroring. */ #define IXGBE_MRCTL_DPME 0x04/* Downlink Port Mirroring. */
drivers/net/ixgbe/rte_pmd_ixgbe.h +104 -0
110 lines not on this page · raw message
drivers/net/ixgbe/rte_pmd_ixgbe_version.map +10 -0
@@ -15,3 +15,13 @@ DPDK_16.11 { rte_pmd_ixgbe_set_vf_vlan_insert; rte_pmd_ixgbe_set_vf_vlan_stripq; } DPDK_2.0; + +DPDK_17.02 { + global: + + rte_pmd_ixgbe_set_vf_rate_limit; + rte_pmd_ixgbe_set_vf_rx; + rte_pmd_ixgbe_set_vf_rxmode; + rte_pmd_ixgbe_set_vf_tx; + rte_pmd_ixgbe_set_vf_vlan_filter; +} DPDK_16.11;
Signature · 1 line
2.10.1
PATCH 2/5 app/testpmd: use ixgbe public functions
In reply to Bernard IremongerUse the the following ixgbe public functions:
rte_pmd_ixgbe_set_vf_rate_limitrte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filter
--- app/test-pmd/cmdline.c | 2 +- app/test-pmd/config.c | 31 +++++++++++-------------------- 2 files changed, 12 insertions(+), 21 deletions(-)
app/test-pmd/cmdline.c +1 -1
@@ -6708,7 +6708,7 @@ cmd_set_vf_rxmode_parsed(void *parsed_result, rx_mode |=ETH_VMDQ_ACCEPT_MULTICAST ; } - ret =rte_eth_dev_set_vf_rxmode (res->port_id,res->vf_id,rx_mode,(uint8_t )is_on); + ret =rte_pmd_ixgbe_set_vf_rxmode (res->port_id, res->vf_id, rx_mode, (uint8_t )is_on);if (ret <0 )printf ("bad VF receive mode parameter, return code = %d \n" , ret);
app/test-pmd/config.c +11 -20
@@ -92,6 +92,9 @@#include <rte_ethdev.h> #include <rte_string_fns.h> #include <rte_cycles.h> +#ifdef RTE_LIBRTE_IXGBE_PMD +#include <rte_pmd_ixgbe.h> +#endif #include "testpmd.h"
@@ -2332,16 +2335,16 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)if (port_id_is_invalid (port_id,ENABLED_WARN ))return ;if (is_rx) - diag =rte_eth_dev_set_vf_rx (port_id,vf,on); + diag =rte_pmd_ixgbe_set_vf_rx (port_id, vf, on);else - diag =rte_eth_dev_set_vf_tx (port_id,vf,on); + diag =rte_pmd_ixgbe_set_vf_tx (port_id, vf, on);if (diag ==0 )return ;if (is_rx) -printf ("rte_eth_dev_set_vf_rx for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed " "diag=%d\n" , port_id, diag);else -printf ("rte_eth_dev_set_vf_tx for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed " "diag=%d\n" , port_id, diag); }
@@ -2355,10 +2358,10 @@ set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)return ;if (vlan_id_is_invalid (vlan_id))return ; - diag =rte_eth_dev_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on); + diag =rte_pmd_ixgbe_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on);if (diag ==0 )return ; -printf ("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed " "diag=%d\n" , port_id, diag); }
@@ -2388,23 +2391,11 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk) { int diag; -struct rte_eth_link link; - -if (q_msk ==0 ) -return 0 ; -if (port_id_is_invalid (port_id,ENABLED_WARN )) -return 1 ; -rte_eth_link_get_nowait (port_id, &link); -if (rate > link.link_speed) { -printf ("Invalid rate value:%u bigger than link speed: %u\n" , - rate, link.link_speed); -return 1 ; - } - diag =rte_eth_set_vf_rate_limit (port_id, vf, rate, q_msk); + diag =rte_pmd_ixgbe_set_vf_rate_limit (port_id, vf, rate, q_msk);if (diag ==0 )return diag; -printf ("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n" , +printf ("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n" , port_id, diag);return diag; }
Signature · 1 line
2.10.1
PATCH 3/5 app/testpmd: add command for set VF VLAN filter
In reply to Bernard IremongerAdd the following command to testpmd:
set vf vlan filter <port_id> <vlan_id> <vf_mask> <on|off>
Add command to the testpmd user guide.
--- app/test-pmd/cmdline.c | 98 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 105 insertions(+)
app/test-pmd/cmdline.c +98 -0
@@ -291,6 +291,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf vlan antispoof (port_id) (vf_id) (on|off)\n" " Set VLAN antispoof for a VF from the PF.\n\n" + +"set vf vlan filter (port_id) (vlan_id) (vf_mask) (on|off)\n" + " Set VLAN filter for a VF pool from the PF.\n\n"#endif "vlan set filter (on|off) (port_id)\n"
@@ -11139,6 +11142,100 @@ cmdline_parse_inst_t cmd_set_vf_vlan_insert = { }, }; + +/* vf vlan filter configuration */ + +/* Common result structure for vf vlan filter */ +struct cmd_vf_vlan_filter_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t vlan; +cmdline_fixed_string_t filter; +uint8_t port_id; +uint16_t vlan_id; +uint16_t vf_mask; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf vlan filter enable disable */ +cmdline_parse_token_string_t cmd_vf_vlan_filter_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_vlan = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vlan,"vlan" ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_filter = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + filter,"filter" ); +cmdline_parse_token_num_t cmd_vf_vlan_filter_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_filter_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_vlan_filter_vlan_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vlan_id,UINT16 ); +cmdline_parse_token_num_t cmd_vf_vlan_filter_vf_mask = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vf_mask,UINT16 ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + on_off,"on#off" ); + +static void +cmd_set_vf_vlan_filter_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_vlan_filter_result *res = parsed_result; +int ret; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + + ret =rte_pmd_ixgbe_set_vf_vlan_filter (res->port_id, res->vlan_id, res->vf_mask, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_mask %d or vlan_id %d\n" , res->vf_mask, res->vlan_id); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("not supported on vf port %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_vlan_filter = { + .f = cmd_set_vf_vlan_filter_parsed, + .data =NULL , + .help_str ="set vf vlan filter <port_id> <vlan_id> <vf_mask> <on_off>" , + .tokens = { + (void *)&cmd_vf_vlan_filter_set, + (void *)&cmd_vf_vlan_filter_vf, + (void *)&cmd_vf_vlan_filter_vlan, + (void *)&cmd_vf_vlan_filter_filter, + (void *)&cmd_vf_vlan_filter_port_id, + (void *)&cmd_vf_vlan_filter_vlan_id, + (void *)&cmd_vf_vlan_filter_vf_mask, + (void *)&cmd_vf_vlan_filter_on_off, +NULL , + }, +}; +/* tx loopback configuration */ /* Common result structure for tx loopback */
@@ -11620,6 +11717,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_mac_anti_spoof, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_stripq, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_insert, + (cmdline_parse_inst_t *)&cmd_set_vf_vlan_filter, (cmdline_parse_inst_t *)&cmd_set_tx_loopback, (cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -535,6 +535,13 @@ Set VLAN insert for a VF from the PF:: testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id) +vlan set filter (for VF pool) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set VLAN filter for a VF pool from the PF:: + + testpmd> set vf vlan filter (port_id) (vlan_id) (vf_mask) (on|off) + vlan set antispoof (for VF) ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.10.1
PATCH 4/5 app/testpmd: add command for set VF receive
In reply to Bernard Iremongeradd the following command to testpmd:
set vf rx <port_id> <vf_id> <on|off>
add command to the testpmd user guide.
--- app/test-pmd/cmdline.c | 85 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 92 insertions(+)
app/test-pmd/cmdline.c +85 -0
@@ -274,6 +274,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf mac antispoof (port_id) (vf_id) (on|off).\n" " Set MAC antispoof for a VF from the PF.\n\n" + +"set vf rx (port_id) (vf_id) (on|off).\n" + " Enable or disable RX for a VF from the PF.\n\n"#endif "vlan set strip (on|off) (port_id)\n"
@@ -11236,6 +11239,87 @@ cmdline_parse_inst_t cmd_set_vf_vlan_filter = { }, }; +/* vf rx configuration */ + +/* Common result structure for vf rx */ +struct cmd_vf_rx_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t rx; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf rx enable disable */ +cmdline_parse_token_string_t cmd_vf_rx_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_rx_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_rx_rx = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + rx,"rx" ); +cmdline_parse_token_num_t cmd_vf_rx_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_rx_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_rx_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_rx_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_vf_rx_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + on_off,"on#off" ); + +static void +cmd_set_vf_rx_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_rx_result *res = parsed_result; +int ret =0 ; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + + ret =rte_pmd_ixgbe_set_vf_rx (res->port_id, res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("not supported on vf port %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_rx = { + .f = cmd_set_vf_rx_parsed, + .data =NULL , + .help_str ="set vf rx <port_id> <vf_id> <on|off>" , + .tokens = { + (void *)&cmd_vf_rx_set, + (void *)&cmd_vf_rx_vf, + (void *)&cmd_vf_rx_rx, + (void *)&cmd_vf_rx_port_id, + (void *)&cmd_vf_rx_vf_id, + (void *)&cmd_vf_rx_on_off, +NULL , + }, +}; +/* tx loopback configuration */ /* Common result structure for tx loopback */
@@ -11722,6 +11806,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, + (cmdline_parse_inst_t *)&cmd_set_vf_rx, #endif NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -507,6 +507,13 @@ Set mac antispoof for a VF from the PF:: testpmd> set vf mac antispoof (port_id) (vf_id) (on|off) +set rx (for VF) +~~~~~~~~~~~~~~~ + +Enable/disable rx for a VF from the PF:: + + testpmd> set vf rx (port_id) (vf_id) (on|off) + vlan set strip ~~~~~~~~~~~~~~
Signature · 1 line
2.10.1
PATCH 5/5 app/testpmd: add command for set VF transmit
In reply to Bernard Iremongeradd the following command to testpmd:
set vf tx <port_id> <vf_id> <on|off>
add command to the testpmd user guide.
--- app/test-pmd/cmdline.c | 85 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 92 insertions(+)
app/test-pmd/cmdline.c +85 -0
@@ -277,6 +277,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf rx (port_id) (vf_id) (on|off).\n" " Enable or disable RX for a VF from the PF.\n\n" + +"set vf tx (port_id) (vf_id) (on|off).\n" + " Enable or disable TX for a VF from the PF.\n\n"#endif "vlan set strip (on|off) (port_id)\n"
@@ -11320,6 +11323,87 @@ cmdline_parse_inst_t cmd_set_vf_rx = { }, }; +/* vf tx configuration */ + +/* Common result structure for vf tx */ +struct cmd_vf_tx_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t tx; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf tx enable disable */ +cmdline_parse_token_string_t cmd_vf_tx_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_tx_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_tx_tx = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + tx,"tx" ); +cmdline_parse_token_num_t cmd_vf_tx_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_tx_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_tx_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_tx_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_vf_tx_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + on_off,"on#off" ); + +static void +cmd_set_vf_tx_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_tx_result *res = parsed_result; +int ret =0 ; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + + ret =rte_pmd_ixgbe_set_vf_tx (res->port_id, res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("not supported on vf port %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_tx = { + .f = cmd_set_vf_tx_parsed, + .data =NULL , + .help_str ="set vf tx <port_id> <vf_id> <on|off>" , + .tokens = { + (void *)&cmd_vf_tx_set, + (void *)&cmd_vf_tx_vf, + (void *)&cmd_vf_tx_tx, + (void *)&cmd_vf_tx_port_id, + (void *)&cmd_vf_tx_vf_id, + (void *)&cmd_vf_tx_on_off, +NULL , + }, +}; +/* tx loopback configuration */ /* Common result structure for tx loopback */
@@ -11807,6 +11891,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, (cmdline_parse_inst_t *)&cmd_set_vf_rx, + (cmdline_parse_inst_t *)&cmd_set_vf_tx, #endif NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -514,6 +514,13 @@ Enable/disable rx for a VF from the PF:: testpmd> set vf rx (port_id) (vf_id) (on|off) +set tx (for VF) +~~~~~~~~~~~~~~~ + +Enable/disable tx for a VF from the PF:: + + testpmd> set vf tx (port_id) (vf_id) (on|off) + vlan set strip ~~~~~~~~~~~~~~
Signature · 1 line
2.10.1
Quoted 38 lines · Bernard Iremonger
This patchset implements the following deprecation notice:
[PATCH v1] doc: announce API and ABI change forlibrte_etherThe following functions from
eth_dev_opshave been moved to the ixgbe PMD and renamed:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limitRenamed the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limitTestpmd has been modified to use the following functions:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rate_limitNew testpmd commands have been added to test the following functions:
rte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterThe testpmd user guide has been updated for the new commands.
Bernard Iremonger (5):
net/ixgbe: move set VF functions from the ethdev app/testpmd: use ixgbe public functions app/testpmd: add command for set VF VLAN filter app/testpmd: add command for set VF receive app/testpmd: add command for set VF transmit
Quoted 8 lines
app/test-pmd/cmdline.c | 270 +++++++++++++++++++++++++++- app/test-pmd/config.c | 31 ++-- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 +++ drivers/net/ixgbe/ixgbe_ethdev.c | 263 +++++++++++++++++++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe.h | 104 +++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 10 ++ 6 files changed, 678 insertions(+), 21 deletions(-)
Why this patchset doesn't remove ethdev updates for these functions?
ixgbe is the only user for these eth-dev_ops, since code moved to ixgbe driver, they and relevant rte_eth_xx functions (and deprecation notice) can be removed in this patchset. Most probably after testpmd updated to prevent compilation errors.
Re: [PATCH v1 2/5] app/testpmd: use ixgbe public functions
In reply to Bernard IremongerQuoted 9 lines · Bernard Iremonger
Use the the following ixgbe public functions:
rte_pmd_ixgbe_set_vf_rate_limitrte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterSigned-off-by Bernard Iremonger <[email protected]>
<...>
Quoted 7 lines
app/test-pmd/config.c +0
-3@@ -2388,23 +2391,11 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk) { int diag; -struct rte_eth_link link; - -if (q_msk ==0 )
app/test-pmd/config.c int · line 2403
Quoted 10 lines
app/test-pmd/config.c +0
-9-return 0 ; -if (port_id_is_invalid (port_id,ENABLED_WARN )) -return 1 ; -rte_eth_link_get_nowait (port_id, &link); -if (rate > link.link_speed) { -printf ("Invalid rate value:%u bigger than link speed: %u\n" , - rate, link.link_speed); -return 1 ; - }
Why these changes required? Isn't only change is location and naming of the ...set_vf_rate_limit() ?
Quoted 10 lines
app/test-pmd/config.c +2
-2- diag =rte_eth_set_vf_rate_limit (port_id, vf, rate, q_msk); + diag =rte_pmd_ixgbe_set_vf_rate_limit (port_id, vf, rate, q_msk);if (diag ==0 )return diag; -printf ("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n" , +printf ("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n" , port_id, diag);return diag; }
Hi Ferruh,
Quoted 57 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, December 9, 2016 11:54 AM
To: Iremonger, Bernard <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v1 0/5] net/ixgbe: move set VF functions.Quoted 31 lines · Bernard Iremonger
This patchset implements the following deprecation notice:
[PATCH v1] doc: announce API and ABI change forlibrte_etherThe following functions from
eth_dev_opshave been moved to the ixgbe PMD and renamed:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limitRenamed the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limitTestpmd has been modified to use the following functions:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rate_limitNew testpmd commands have been added to test the following functions:
rte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterThe testpmd user guide has been updated for the new commands.
Quoted 8 lines
Bernard Iremonger (5):
net/ixgbe: move set VF functions from the ethdev app/testpmd: use ixgbe public functions app/testpmd: add command for set VF VLAN filter app/testpmd: add command for set VF receive app/testpmd: add command for set VF transmitapp/test-pmd/cmdline.c | 270+++++++++++++++++++++++++++-
Quoted 3 lines
app/test-pmd/config.c | 31 ++-- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 +++ drivers/net/ixgbe/ixgbe_ethdev.c | 263+++++++++++++++++++++++++++
Quoted 4 lines
drivers/net/ixgbe/rte_pmd_ixgbe.h | 104 +++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 10 ++ 6 files changed, 678 insertions(+), 21 deletions(-)
Quoted 6 lines
Why this patchset doesn't remove ethdev updates for these functions?
ixgbe is the only user for these eth-dev_ops, since code moved to ixgbe driver, they and relevant
rte_eth_xxfunctions (and deprecation notice) can be removed in this patchset. Most probably after testpmd updated to prevent compilation errors.
My understanding is that the functions should be copied and reworked before being removed from the ethdev, and that the removal should be done in a separate patch set.
Hi Thomas,
Could you clarify please.
Regards,
Bernard.
Re: [PATCH v1 3/5] app/testpmd: add command for set VF VLAN filter
In reply to Bernard IremongerQuoted 7 lines · Bernard Iremonger
Add the following command to testpmd:
set vf vlan filter <port_id> <vlan_id> <vf_mask> <on|off>Add command to the testpmd user guide.
Signed-off-by Bernard Iremonger <[email protected]>---
<...>
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_vf_vlan_insert = { · line 11225
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+ +cmdline_parse_inst_t cmd_set_vf_vlan_filter = { + .f = cmd_set_vf_vlan_filter_parsed, + .data =NULL , + .help_str ="set vf vlan filter <port_id> <vlan_id> <vf_mask> <on_off>" ,
s/<on_off>/on|off
Only variables should be wrapped with "<>", fixed string with options can be used as a|b|c .
similar issues in other testpmd patches.
Re: [PATCH v1 2/5] app/testpmd: use ixgbe public functions
In reply to Ferruh YigitHi Ferruh,
Quoted 30 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, December 9, 2016 11:57 AM
To: Iremonger, Bernard <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v1 2/5] app/testpmd: use ixgbe public functionsQuoted 9 lines · Bernard Iremonger
Use the the following ixgbe public functions:
rte_pmd_ixgbe_set_vf_rate_limitrte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterSigned-off-by Bernard Iremonger <[email protected]><...>
Quoted 9 lines
app/test-pmd/config.c +0
-4@@ -2388,23 +2391,11 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk) { int diag; -struct rte_eth_link link; - -if (q_msk ==0 ) -return 0 ;
Quoted 11 lines
app/test-pmd/config.c int · line 2403
Quoted 8 lines
app/test-pmd/config.c +0
-8-if (port_id_is_invalid (port_id,ENABLED_WARN )) -return 1 ; -rte_eth_link_get_nowait (port_id, &link); -if (rate > link.link_speed) { -printf ("Invalid rate value:%u bigger than link speed: %u\n" , - rate, link.link_speed); -return 1 ; - }Why these changes required? Isn't only change is location and naming of the ...set_vf_rate_limit() ?
This change is a cleanup as the parameter checking is now done in rte_pmd_ixgbe_set_vf_rate_limit().
It was not possible to test the parameter checking in rte_pmd_ixgbe_set_vf_rate_limit() if the parameters were checked in the set_vf_rate_limit() function.
Quoted 12 lines
app/test-pmd/config.c int · line 2401
Quoted 12 lines
app/test-pmd/config.c +3
-2- diag =rte_eth_set_vf_rate_limit (port_id, vf, rate, q_msk); + diag =rte_pmd_ixgbe_set_vf_rate_limit (port_id, vf, rate, q_msk);if (diag ==0 )return diag; -printf ("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n" , +printf ("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed +diag=%d\n", port_id, diag);return diag; }
Regards,
Bernard.
Re: [PATCH v1 3/5] app/testpmd: add command for set VF VLAN filter
In reply to Ferruh YigitHi Ferruh,
Quoted 28 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, December 9, 2016 12:03 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v1 3/5] app/testpmd: add command for set VF VLAN filterQuoted 7 lines · Bernard Iremonger
Add the following command to testpmd:
set vf vlan filter <port_id> <vlan_id> <vf_mask> <on|off>Add command to the testpmd user guide.
Signed-off-by Bernard Iremonger <[email protected]>---
<...>
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_vf_vlan_insert = {
Quoted 6 lines
app/test-pmd/cmdline.c +6
-0+ +cmdline_parse_inst_t cmd_set_vf_vlan_filter = { + .f = cmd_set_vf_vlan_filter_parsed, + .data =NULL , + .help_str = "set vf vlan filter <port_id> <vlan_id> <vf_mask> +<on_off>",s/<on_off>/on|off
Quoted 5 lines
Only variables should be wrapped with "<>", fixed string with options can be used as a|b|c .
similar issues in other testpmd patches.
I will fix in a v2.
Regards,
Bernard.
2016-12-09 12:00, Iremonger, Bernard:
Quoted 8 lines
From: Yigit, Ferruh
Quoted 6 lines
Why this patchset doesn't remove ethdev updates for these functions?
ixgbe is the only user for these eth-dev_ops, since code moved to ixgbe driver, they and relevant
rte_eth_xxfunctions (and deprecation notice) can be removed in this patchset. Most probably after testpmd updated to prevent compilation errors.
Quoted 5 lines
My understanding is that the functions should be copied and reworked before being removed from the ethdev, and that the removal should be done in a separate patch set.
Hi Thomas,
Could you clarify please.
It was announced that these functions will be removed,
so they can be safely removed in 17.02, right?
In this case, it is a code move: copy, rework and delete in the same patch. And yes, the deprecation notice must be removed at the same time.
Hi Thomas,
Quoted 20 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Friday, December 9, 2016 1:05 PM
To: Iremonger, Bernard <[email protected]>
Cc: Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v1 0/5] net/ixgbe: move set VF functions.2016-12-09 12:00, Iremonger, Bernard:
Quoted 9 lines
From: Yigit, Ferruh
Quoted 6 lines
Why this patchset doesn't remove ethdev updates for these functions?
ixgbe is the only user for these eth-dev_ops, since code moved to ixgbe driver, they and relevant
rte_eth_xxfunctions (and deprecation notice) can be removed in this patchset. Most probably after testpmd updated to prevent compilation errors.My understanding is that the functions should be copied and reworked
before being removed from the ethdev, and that the removal should be done in a separate patch set.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Hi Thomas,
Could you clarify please.
It was announced that these functions will be removed, so they can be safely removed in 17.02, right?
Yes, it was announced in 16.11 that these functions will be removed so I believe they can be safely removed in17.02.
Quoted 2 lines
In this case, it is a code move: copy, rework and delete in the same patch. And yes, the deprecation notice must be removed at the same time.
I will add the deletes in a v2 of the patchset.
Regards,
Bernard.
v2 cover net/ixgbe: move set VF functions.
In reply to Bernard IremongerThis patchset implements the following deprecation notice:
[PATCH v1] doc: announce API and ABI change for librte_ether
Changes in V2:
Update testpmd set vf commands help messages.
Updated ethtool to use the ixgbe public API's.
Removed the ixgbe_set_pool_* and ixgbe_set_vf_rate_limit functions. Removed the rte_eth_dev_set_vf_* API's
Removed the deprecation notice.
Changes in V1:
The following functions from eth_dev_ops have been moved to the ixgbe PMD and renamed:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limit
Renamed the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limit
Testpmd has been modified to use the following functions:rte_pmd_ixgbe_set_vf_rxmode rte_pmd_ixgbe_set_vf_rate_limit
New testpmd commands have been added to test the following functions:rte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filter
The testpmd user guide has been updated for the new commands.
Bernard Iremonger (9):
net/ixgbe: move set VF functions from the ethdev app/testpmd: use ixgbe public functions app/testpmd: add command for set VF VLAN filter app/testpmd: add command for set VF receive app/testpmd: add command for set VF transmit examples/ethtool: use ixgbe public function net/ixgbe: remove static set VF functions
librte_ether: remove the set VF API's
doc: remove deprecation notice
app/test-pmd/cmdline.c | 270 +++++++++++++++- app/test-pmd/config.c | 31 +- doc/guides/rel_notes/deprecation.rst | 13 - doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 ++ drivers/net/ixgbe/ixgbe_ethdev.c | 459 ++++++++++++++++------------ drivers/net/ixgbe/rte_pmd_ixgbe.h | 104 +++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 10 + examples/ethtool/lib/rte_ethtool.c | 5 +- lib/librte_ether/rte_ethdev.c | 129 -------- lib/librte_ether/rte_ethdev.h | 33 -- 10 files changed, 683 insertions(+), 392 deletions(-)
Signature · 1 line
2.10.1
PATCH v2 1/9 net/ixgbe: move set VF functions from the ethdev
In reply to Bernard IremongerMove the following functions from eth_dev_ops to the ixgbe PMD and rename:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limit
Rename the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limit
Use public function internally
--- drivers/net/ixgbe/ixgbe_ethdev.c | 266 +++++++++++++++++++++++++++- drivers/net/ixgbe/rte_pmd_ixgbe.h | 104 +++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 10 ++ 3 files changed, 379 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +265 -1
@@ -2294,7 +2294,8 @@ ixgbe_dev_start(struct rte_eth_dev *dev)for (vf =0 ; vf < dev->pci_dev->max_vfs; vf++)for (idx =0 ; idx <IXGBE_MAX_QUEUE_NUM_PER_VF ; idx++)if (vfinfo[vf].tx_rate[idx] !=0 ) -ixgbe_set_vf_rate_limit (dev, vf, +rte_pmd_ixgbe_set_vf_rate_limit ( + dev->data->port_id, vf, vfinfo[vf].tx_rate[idx],1 << idx); }
@@ -4883,6 +4884,269 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)return 0 ; } +int +rte_pmd_ixgbe_set_vf_rxmode (uint8_t port,uint16_t vf,uint16_t rx_mask,uint8_t on) +{ +int val =0 ; +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct ixgbe_hw *hw; +uint32_t vmolr; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + vmolr =IXGBE_READ_REG (hw,IXGBE_VMOLR (vf)); + +if (hw->mac.type == ixgbe_mac_82598EB) { +PMD_INIT_LOG (ERR ,"setting VF receive mode set should be done" +" on 82599 hardware and newer" ); +return -ENOTSUP ; + } +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + + val =ixgbe_convert_vm_rx_mask_to_val (rx_mask, val); + +if (on) + vmolr |= val; +else + vmolr &= ~val; + +IXGBE_WRITE_REG (hw,IXGBE_VMOLR (vf), vmolr); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_rx (uint8_t port,uint16_t vf,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +uint32_t reg, addr; +uint32_t val; +const uint8_t bit1 =0x1 ; +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +/* for vf >= 32, set bit in PFVFRE[1], otherwise PFVFRE[0] */ +if (vf >=32 ) { + addr =IXGBE_VFRE (1 ); + val = bit1 << (vf -32 ); + }else { + addr =IXGBE_VFRE (0 ); + val = bit1 << vf; + } + + reg =IXGBE_READ_REG (hw, addr); + +if (on) + reg |= val; +else + reg &= ~val; + +IXGBE_WRITE_REG (hw, addr, reg); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_tx (uint8_t port,uint16_t vf,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +uint32_t reg, addr; +uint32_t val; +const uint8_t bit1 =0x1 ; + +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +/* for vf >= 32, set bit in PFVFTE[1], otherwise PFVFTE[0] */ +if (vf >=32 ) { + addr =IXGBE_VFTE (1 ); + val = bit1 << (vf -32 ); + }else { + addr =IXGBE_VFTE (0 ); + val = bit1 << vf; + } + + reg =IXGBE_READ_REG (hw, addr); + +if (on) + reg |= val; +else + reg &= ~val; + +IXGBE_WRITE_REG (hw, addr, reg); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_vlan_filter (uint8_t port,uint16_t vlan, +uint64_t vf_mask,uint8_t vlan_on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +int ret =0 ; +uint16_t vf_idx; +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if ((vlan >ETHER_MAX_VLAN_ID ) || (vf_mask ==0 )) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +for (vf_idx =0 ; vf_idx <64 ; vf_idx++) { +if (vf_mask & ((uint64_t )(1ULL << vf_idx))) { + ret = hw->mac.ops.set_vfta (hw, vlan, vf_idx, + vlan_on, false); +if (ret <0 ) +return ret; + } + } + +return ret; +} + +int rte_pmd_ixgbe_set_vf_rate_limit (uint8_t port,uint16_t vf, +uint16_t tx_rate,uint64_t q_msk) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct ixgbe_hw *hw; +struct ixgbe_vf_info *vfinfo; +struct rte_eth_link link; +uint8_t nb_q_per_pool; +uint32_t queue_stride; +uint32_t queue_idx, idx =0 , vf_idx; +uint32_t queue_end; +uint16_t total_rate =0 ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); +rte_eth_link_get_nowait (port, &link); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (tx_rate > link.link_speed) +return -EINVAL ; + +if (q_msk ==0 ) +return 0 ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA (dev->data->dev_private)); + nb_q_per_pool =RTE_ETH_DEV_SRIOV (dev).nb_q_per_pool; + queue_stride =IXGBE_MAX_RX_QUEUE_NUM /RTE_ETH_DEV_SRIOV (dev).active; + queue_idx = vf * queue_stride; + queue_end = queue_idx + nb_q_per_pool -1 ; +if (queue_end >= hw->mac.max_tx_queues) +return -EINVAL ; + +if (vfinfo) { +for (vf_idx =0 ; vf_idx < dev->pci_dev->max_vfs; vf_idx++) { +if (vf_idx == vf) +continue ; +for (idx =0 ; idx <RTE_DIM (vfinfo[vf_idx].tx_rate); + idx++) + total_rate += vfinfo[vf_idx].tx_rate[idx]; + } + }else { +return -EINVAL ; + } + +/* Store tx_rate for this vf. */ +for (idx =0 ; idx < nb_q_per_pool; idx++) { +if (((uint64_t )0x1 << idx) & q_msk) { +if (vfinfo[vf].tx_rate[idx] != tx_rate) + vfinfo[vf].tx_rate[idx] = tx_rate; + total_rate += tx_rate; + } + } + +if (total_rate > dev->data->dev_link.link_speed) { +/* Reset stored TX rate of the VF if it causes exceed +* link speed. +*/ +memset (vfinfo[vf].tx_rate,0 ,sizeof (vfinfo[vf].tx_rate)); +return -EINVAL ; + } + +/* Set RTTBCNRC of each queue/pool for vf X */ +for (; queue_idx <= queue_end; queue_idx++) { +if (0x1 & q_msk) +ixgbe_set_queue_rate_limit (dev, queue_idx, tx_rate); + q_msk = q_msk >>1 ; + } + +return 0 ; +} +#define IXGBE_MRCTL_VPME 0x01/* Virtual Pool Mirroring. */ #define IXGBE_MRCTL_UPME 0x02/* Uplink Port Mirroring. */ #define IXGBE_MRCTL_DPME 0x04/* Downlink Port Mirroring. */
drivers/net/ixgbe/rte_pmd_ixgbe.h +104 -0
110 lines not on this page · raw message
drivers/net/ixgbe/rte_pmd_ixgbe_version.map +10 -0
@@ -15,3 +15,13 @@ DPDK_16.11 { rte_pmd_ixgbe_set_vf_vlan_insert; rte_pmd_ixgbe_set_vf_vlan_stripq; } DPDK_2.0; + +DPDK_17.02 { + global: + + rte_pmd_ixgbe_set_vf_rate_limit; + rte_pmd_ixgbe_set_vf_rx; + rte_pmd_ixgbe_set_vf_rxmode; + rte_pmd_ixgbe_set_vf_tx; + rte_pmd_ixgbe_set_vf_vlan_filter; +} DPDK_16.11;
Signature · 1 line
2.10.1
PATCH v2 2/9 app/testpmd: use ixgbe public functions
In reply to Bernard IremongerUse the the following ixgbe public functions:
rte_pmd_ixgbe_set_vf_rate_limitrte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filter
--- app/test-pmd/cmdline.c | 2 +- app/test-pmd/config.c | 31 +++++++++++-------------------- 2 files changed, 12 insertions(+), 21 deletions(-)
app/test-pmd/cmdline.c +1 -1
@@ -6708,7 +6708,7 @@ cmd_set_vf_rxmode_parsed(void *parsed_result, rx_mode |=ETH_VMDQ_ACCEPT_MULTICAST ; } - ret =rte_eth_dev_set_vf_rxmode (res->port_id,res->vf_id,rx_mode,(uint8_t )is_on); + ret =rte_pmd_ixgbe_set_vf_rxmode (res->port_id, res->vf_id, rx_mode, (uint8_t )is_on);if (ret <0 )printf ("bad VF receive mode parameter, return code = %d \n" , ret);
app/test-pmd/config.c +11 -20
@@ -92,6 +92,9 @@#include <rte_ethdev.h> #include <rte_string_fns.h> #include <rte_cycles.h> +#ifdef RTE_LIBRTE_IXGBE_PMD +#include <rte_pmd_ixgbe.h> +#endif #include "testpmd.h"
@@ -2332,16 +2335,16 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)if (port_id_is_invalid (port_id,ENABLED_WARN ))return ;if (is_rx) - diag =rte_eth_dev_set_vf_rx (port_id,vf,on); + diag =rte_pmd_ixgbe_set_vf_rx (port_id, vf, on);else - diag =rte_eth_dev_set_vf_tx (port_id,vf,on); + diag =rte_pmd_ixgbe_set_vf_tx (port_id, vf, on);if (diag ==0 )return ;if (is_rx) -printf ("rte_eth_dev_set_vf_rx for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed " "diag=%d\n" , port_id, diag);else -printf ("rte_eth_dev_set_vf_tx for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed " "diag=%d\n" , port_id, diag); }
@@ -2355,10 +2358,10 @@ set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)return ;if (vlan_id_is_invalid (vlan_id))return ; - diag =rte_eth_dev_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on); + diag =rte_pmd_ixgbe_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on);if (diag ==0 )return ; -printf ("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed " "diag=%d\n" , port_id, diag); }
@@ -2388,23 +2391,11 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk) { int diag; -struct rte_eth_link link; - -if (q_msk ==0 ) -return 0 ; -if (port_id_is_invalid (port_id,ENABLED_WARN )) -return 1 ; -rte_eth_link_get_nowait (port_id, &link); -if (rate > link.link_speed) { -printf ("Invalid rate value:%u bigger than link speed: %u\n" , - rate, link.link_speed); -return 1 ; - } - diag =rte_eth_set_vf_rate_limit (port_id, vf, rate, q_msk); + diag =rte_pmd_ixgbe_set_vf_rate_limit (port_id, vf, rate, q_msk);if (diag ==0 )return diag; -printf ("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n" , +printf ("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n" , port_id, diag);return diag; }
Signature · 1 line
2.10.1
PATCH v2 3/9 app/testpmd: add command for set VF VLAN filter
In reply to Bernard IremongerAdd the following command to testpmd:
set vf vlan filter <port_id> <vlan_id> <vf_mask> on|off
Add command to the testpmd user guide.
--- app/test-pmd/cmdline.c | 98 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 105 insertions(+)
app/test-pmd/cmdline.c +98 -0
@@ -291,6 +291,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf vlan antispoof (port_id) (vf_id) (on|off)\n" " Set VLAN antispoof for a VF from the PF.\n\n" + +"set vf vlan filter (port_id) (vlan_id) (vf_mask) (on|off)\n" + " Set VLAN filter for a VF pool from the PF.\n\n"#endif "vlan set filter (on|off) (port_id)\n"
@@ -11139,6 +11142,100 @@ cmdline_parse_inst_t cmd_set_vf_vlan_insert = { }, }; + +/* vf vlan filter configuration */ + +/* Common result structure for vf vlan filter */ +struct cmd_vf_vlan_filter_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t vlan; +cmdline_fixed_string_t filter; +uint8_t port_id; +uint16_t vlan_id; +uint16_t vf_mask; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf vlan filter enable disable */ +cmdline_parse_token_string_t cmd_vf_vlan_filter_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_vlan = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vlan,"vlan" ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_filter = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + filter,"filter" ); +cmdline_parse_token_num_t cmd_vf_vlan_filter_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_filter_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_vlan_filter_vlan_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vlan_id,UINT16 ); +cmdline_parse_token_num_t cmd_vf_vlan_filter_vf_mask = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vf_mask,UINT16 ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + on_off,"on#off" ); + +static void +cmd_set_vf_vlan_filter_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_vlan_filter_result *res = parsed_result; +int ret; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + + ret =rte_pmd_ixgbe_set_vf_vlan_filter (res->port_id, res->vlan_id, res->vf_mask, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_mask %d or vlan_id %d\n" , res->vf_mask, res->vlan_id); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("not supported on vf port %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_vlan_filter = { + .f = cmd_set_vf_vlan_filter_parsed, + .data =NULL , + .help_str ="set vf vlan filter <port_id> <vlan_id> <vf_mask> on|off" , + .tokens = { + (void *)&cmd_vf_vlan_filter_set, + (void *)&cmd_vf_vlan_filter_vf, + (void *)&cmd_vf_vlan_filter_vlan, + (void *)&cmd_vf_vlan_filter_filter, + (void *)&cmd_vf_vlan_filter_port_id, + (void *)&cmd_vf_vlan_filter_vlan_id, + (void *)&cmd_vf_vlan_filter_vf_mask, + (void *)&cmd_vf_vlan_filter_on_off, +NULL , + }, +}; +/* tx loopback configuration */ /* Common result structure for tx loopback */
@@ -11620,6 +11717,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_mac_anti_spoof, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_stripq, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_insert, + (cmdline_parse_inst_t *)&cmd_set_vf_vlan_filter, (cmdline_parse_inst_t *)&cmd_set_tx_loopback, (cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -535,6 +535,13 @@ Set VLAN insert for a VF from the PF:: testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id) +vlan set filter (for VF pool) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set VLAN filter for a VF pool from the PF:: + + testpmd> set vf vlan filter (port_id) (vlan_id) (vf_mask) (on|off) + vlan set antispoof (for VF) ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.10.1
PATCH v2 4/9 app/testpmd: add command for set VF receive
In reply to Bernard Iremongeradd the following command to testpmd:
set vf rx <port_id> <vf_id> on|off
add command to the testpmd user guide.
--- app/test-pmd/cmdline.c | 85 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 92 insertions(+)
app/test-pmd/cmdline.c +85 -0
@@ -274,6 +274,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf mac antispoof (port_id) (vf_id) (on|off).\n" " Set MAC antispoof for a VF from the PF.\n\n" + +"set vf rx (port_id) (vf_id) (on|off).\n" + " Enable or disable RX for a VF from the PF.\n\n"#endif "vlan set strip (on|off) (port_id)\n"
@@ -11236,6 +11239,87 @@ cmdline_parse_inst_t cmd_set_vf_vlan_filter = { }, }; +/* vf rx configuration */ + +/* Common result structure for vf rx */ +struct cmd_vf_rx_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t rx; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf rx enable disable */ +cmdline_parse_token_string_t cmd_vf_rx_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_rx_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_rx_rx = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + rx,"rx" ); +cmdline_parse_token_num_t cmd_vf_rx_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_rx_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_rx_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_rx_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_vf_rx_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + on_off,"on#off" ); + +static void +cmd_set_vf_rx_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_rx_result *res = parsed_result; +int ret =0 ; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + + ret =rte_pmd_ixgbe_set_vf_rx (res->port_id, res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("not supported on vf port %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_rx = { + .f = cmd_set_vf_rx_parsed, + .data =NULL , + .help_str ="set vf rx <port_id> <vf_id> on|off" , + .tokens = { + (void *)&cmd_vf_rx_set, + (void *)&cmd_vf_rx_vf, + (void *)&cmd_vf_rx_rx, + (void *)&cmd_vf_rx_port_id, + (void *)&cmd_vf_rx_vf_id, + (void *)&cmd_vf_rx_on_off, +NULL , + }, +}; +/* tx loopback configuration */ /* Common result structure for tx loopback */
@@ -11722,6 +11806,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, + (cmdline_parse_inst_t *)&cmd_set_vf_rx, #endif NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -507,6 +507,13 @@ Set mac antispoof for a VF from the PF:: testpmd> set vf mac antispoof (port_id) (vf_id) (on|off) +set rx (for VF) +~~~~~~~~~~~~~~~ + +Enable/disable rx for a VF from the PF:: + + testpmd> set vf rx (port_id) (vf_id) (on|off) + vlan set strip ~~~~~~~~~~~~~~
Signature · 1 line
2.10.1
PATCH v2 5/9 app/testpmd: add command for set VF transmit
In reply to Bernard Iremongeradd the following command to testpmd:
set vf tx <port_id> <vf_id> on|off
add command to the testpmd user guide.
--- app/test-pmd/cmdline.c | 85 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 92 insertions(+)
app/test-pmd/cmdline.c +85 -0
@@ -277,6 +277,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf rx (port_id) (vf_id) (on|off).\n" " Enable or disable RX for a VF from the PF.\n\n" + +"set vf tx (port_id) (vf_id) (on|off).\n" + " Enable or disable TX for a VF from the PF.\n\n"#endif "vlan set strip (on|off) (port_id)\n"
@@ -11320,6 +11323,87 @@ cmdline_parse_inst_t cmd_set_vf_rx = { }, }; +/* vf tx configuration */ + +/* Common result structure for vf tx */ +struct cmd_vf_tx_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t tx; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf tx enable disable */ +cmdline_parse_token_string_t cmd_vf_tx_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_tx_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_tx_tx = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + tx,"tx" ); +cmdline_parse_token_num_t cmd_vf_tx_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_tx_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_tx_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_tx_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_vf_tx_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + on_off,"on#off" ); + +static void +cmd_set_vf_tx_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_tx_result *res = parsed_result; +int ret =0 ; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + + ret =rte_pmd_ixgbe_set_vf_tx (res->port_id, res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("not supported on vf port %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_tx = { + .f = cmd_set_vf_tx_parsed, + .data =NULL , + .help_str ="set vf tx <port_id> <vf_id> on|off" , + .tokens = { + (void *)&cmd_vf_tx_set, + (void *)&cmd_vf_tx_vf, + (void *)&cmd_vf_tx_tx, + (void *)&cmd_vf_tx_port_id, + (void *)&cmd_vf_tx_vf_id, + (void *)&cmd_vf_tx_on_off, +NULL , + }, +}; +/* tx loopback configuration */ /* Common result structure for tx loopback */
@@ -11807,6 +11891,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, (cmdline_parse_inst_t *)&cmd_set_vf_rx, + (cmdline_parse_inst_t *)&cmd_set_vf_tx, #endif NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -514,6 +514,13 @@ Enable/disable rx for a VF from the PF:: testpmd> set vf rx (port_id) (vf_id) (on|off) +set tx (for VF) +~~~~~~~~~~~~~~~ + +Enable/disable tx for a VF from the PF:: + + testpmd> set vf tx (port_id) (vf_id) (on|off) + vlan set strip ~~~~~~~~~~~~~~
Signature · 1 line
2.10.1
PATCH v2 6/9 examples/ethtool: use ixgbe public function
In reply to Bernard IremongerReplace rte_eth_dev_set_vf_rxmode with rte_pmd_ixgbe_set_vf_rx_mode.
--- examples/ethtool/lib/rte_ethtool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
examples/ethtool/lib/rte_ethtool.c +3 -2
@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,7 @@#include <rte_version.h> #include <rte_ethdev.h> #include <rte_ether.h> +#include <rte_pmd_ixgbe.h> #include "rte_ethtool.h" #define PKTPOOL_SIZE 512
@@ -354,7 +355,7 @@ rte_ethtool_net_set_rx_mode(uint8_t port_id)/* Set VF vf_rx_mode, VF unsupport status is discard */ for (vf =0 ; vf < num_vfs; vf++) -rte_eth_dev_set_vf_rxmode (port_id, vf, +rte_pmd_ixgbe_set_vf_rxmode (port_id, vf,ETH_VMDQ_ACCEPT_UNTAG ,0 );/* Enable Rx vlan filter, VF unspport status is discard */
Signature · 1 line
2.10.1
PATCH v2 7/9 net/ixgbe: remove static set VF functions
In reply to Bernard Iremongerremove the following static functions:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limit
--- drivers/net/ixgbe/ixgbe_ethdev.c | 193 --------------------------------------- 1 file changed, 193 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -193
@@ -276,12 +276,6 @@ static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);static int ixgbe_uc_hash_table_set (struct rte_eth_dev *dev,struct ether_addr * mac_addr,uint8_t on);static int ixgbe_uc_all_hash_table_set (struct rte_eth_dev *dev,uint8_t on); -static int ixgbe_set_pool_rx_mode (struct rte_eth_dev *dev,uint16_t pool, -uint16_t rx_mask,uint8_t on); -static int ixgbe_set_pool_rx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on); -static int ixgbe_set_pool_tx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on); -static int ixgbe_set_pool_vlan_filter (struct rte_eth_dev *dev,uint16_t vlan, -uint64_t pool_mask,uint8_t vlan_on);static int ixgbe_mirror_rule_set (struct rte_eth_dev *dev,struct rte_eth_mirror_conf *mirror_conf,uint8_t rule_id,uint8_t on);
@@ -297,8 +291,6 @@ static void ixgbe_configure_msix(struct rte_eth_dev *dev);static int ixgbe_set_queue_rate_limit (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t tx_rate); -static int ixgbe_set_vf_rate_limit (struct rte_eth_dev *dev,uint16_t vf, -uint16_t tx_rate,uint64_t q_msk); static void ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
@@ -568,12 +560,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .uc_all_hash_table_set = ixgbe_uc_all_hash_table_set, .mirror_rule_set = ixgbe_mirror_rule_set, .mirror_rule_reset = ixgbe_mirror_rule_reset, - .set_vf_rx_mode = ixgbe_set_pool_rx_mode, - .set_vf_rx = ixgbe_set_pool_rx, - .set_vf_tx = ixgbe_set_pool_tx, - .set_vf_vlan_filter = ixgbe_set_pool_vlan_filter, .set_queue_rate_limit = ixgbe_set_queue_rate_limit, - .set_vf_rate_limit = ixgbe_set_vf_rate_limit, .reta_update = ixgbe_dev_rss_reta_update, .reta_query = ixgbe_dev_rss_reta_query, #ifdef RTE_NIC_BYPASS
@@ -4547,132 +4534,6 @@ ixgbe_convert_vm_rx_mask_to_val(uint16_t rx_mask, uint32_t orig_val)return new_val; } -static int -ixgbe_set_pool_rx_mode (struct rte_eth_dev *dev,uint16_t pool, -uint16_t rx_mask,uint8_t on) -{ -int val =0 ; - -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -uint32_t vmolr =IXGBE_READ_REG (hw,IXGBE_VMOLR (pool)); - -if (hw->mac.type == ixgbe_mac_82598EB) { -PMD_INIT_LOG (ERR ,"setting VF receive mode set should be done" -" on 82599 hardware and newer" ); -return -ENOTSUP ; - } -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; - - val =ixgbe_convert_vm_rx_mask_to_val (rx_mask, val); - -if (on) - vmolr |= val; -else - vmolr &= ~val; - -IXGBE_WRITE_REG (hw,IXGBE_VMOLR (pool), vmolr); - -return 0 ; -} - -static int -ixgbe_set_pool_rx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on) -{ -uint32_t reg, addr; -uint32_t val; -const uint8_t bit1 =0x1 ; - -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; - -if (pool >=ETH_64_POOLS ) -return -EINVAL ; - -/* for pool >= 32, set bit in PFVFRE[1], otherwise PFVFRE[0] */ -if (pool >=32 ) { - addr =IXGBE_VFRE (1 ); - val = bit1 << (pool -32 ); - }else { - addr =IXGBE_VFRE (0 ); - val = bit1 << pool; - } - - reg =IXGBE_READ_REG (hw, addr); - -if (on) - reg |= val; -else - reg &= ~val; - -IXGBE_WRITE_REG (hw, addr, reg); - -return 0 ; -} - -static int -ixgbe_set_pool_tx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on) -{ -uint32_t reg, addr; -uint32_t val; -const uint8_t bit1 =0x1 ; - -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; - -if (pool >=ETH_64_POOLS ) -return -EINVAL ; - -/* for pool >= 32, set bit in PFVFTE[1], otherwise PFVFTE[0] */ -if (pool >=32 ) { - addr =IXGBE_VFTE (1 ); - val = bit1 << (pool -32 ); - }else { - addr =IXGBE_VFTE (0 ); - val = bit1 << pool; - } - - reg =IXGBE_READ_REG (hw, addr); - -if (on) - reg |= val; -else - reg &= ~val; - -IXGBE_WRITE_REG (hw, addr, reg); - -return 0 ; -} - -static int -ixgbe_set_pool_vlan_filter (struct rte_eth_dev *dev,uint16_t vlan, -uint64_t pool_mask,uint8_t vlan_on) -{ -int ret =0 ; -uint16_t pool_idx; -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; -for (pool_idx =0 ; pool_idx <ETH_64_POOLS ; pool_idx++) { -if (pool_mask & ((uint64_t )(1ULL << pool_idx))) { - ret = hw->mac.ops.set_vfta (hw, vlan, pool_idx, - vlan_on, false); -if (ret <0 ) -return ret; - } - } - -return ret; -}int rte_pmd_ixgbe_set_vf_vlan_anti_spoof (uint8_t port,uint16_t vf,uint8_t on)
@@ -5628,60 +5489,6 @@ static int ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev,return 0 ; } -static int ixgbe_set_vf_rate_limit (struct rte_eth_dev *dev,uint16_t vf, -uint16_t tx_rate,uint64_t q_msk) -{ -struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -struct ixgbe_vf_info *vfinfo = - *(IXGBE_DEV_PRIVATE_TO_P_VFDATA (dev->data->dev_private)); -uint8_t nb_q_per_pool =RTE_ETH_DEV_SRIOV (dev).nb_q_per_pool; -uint32_t queue_stride = -IXGBE_MAX_RX_QUEUE_NUM /RTE_ETH_DEV_SRIOV (dev).active; -uint32_t queue_idx = vf * queue_stride, idx =0 , vf_idx; -uint32_t queue_end = queue_idx + nb_q_per_pool -1 ; -uint16_t total_rate =0 ; - -if (queue_end >= hw->mac.max_tx_queues) -return -EINVAL ; - -if (vfinfo !=NULL ) { -for (vf_idx =0 ; vf_idx < dev->pci_dev->max_vfs; vf_idx++) { -if (vf_idx == vf) -continue ; -for (idx =0 ; idx <RTE_DIM (vfinfo[vf_idx].tx_rate); - idx++) - total_rate += vfinfo[vf_idx].tx_rate[idx]; - } - }else -return -EINVAL ; - -/* Store tx_rate for this vf. */ -for (idx =0 ; idx < nb_q_per_pool; idx++) { -if (((uint64_t )0x1 << idx) & q_msk) { -if (vfinfo[vf].tx_rate[idx] != tx_rate) - vfinfo[vf].tx_rate[idx] = tx_rate; - total_rate += tx_rate; - } - } - -if (total_rate > dev->data->dev_link.link_speed) { -/* -* Reset stored TX rate of the VF if it causes exceed -* link speed. -*/ -memset (vfinfo[vf].tx_rate,0 ,sizeof (vfinfo[vf].tx_rate)); -return -EINVAL ; - } - -/* Set RTTBCNRC of each queue/pool for vf X */ -for (; queue_idx <= queue_end; queue_idx++) { -if (0x1 & q_msk) -ixgbe_set_queue_rate_limit (dev, queue_idx, tx_rate); - q_msk = q_msk >>1 ; - } - -return 0 ; -} static void ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
Signature · 1 line
2.10.1
PATCH v2 8/9 librte_ether: remove the set VF API's
In reply to Bernard Iremongerremove the following API's:
rte_eth_dev_set_vf_rxmoderte_eth_dev_set_vf_rxrte_eth_dev_set_vf_txrte_eth_dev_set_vf_vlan_filterrte_eth_dev_set_vf_rate_limit
--- lib/librte_ether/rte_ethdev.c | 129 ------------------------------------------ lib/librte_ether/rte_ethdev.h | 33 ----------- 2 files changed, 162 deletions(-)
lib/librte_ether/rte_ethdev.c +0 -129
@@ -2137,32 +2137,6 @@ rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr *addr)return 0 ; } -int -rte_eth_dev_set_vf_rxmode (uint8_t port_id,uint16_t vf, -uint16_t rx_mode,uint8_t on) -{ -uint16_t num_vfs; -struct rte_eth_dev *dev; -struct rte_eth_dev_info dev_info; - -RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); - - dev = &rte_eth_devices[port_id]; -rte_eth_dev_info_get (port_id, &dev_info); - - num_vfs = dev_info.max_vfs; -if (vf > num_vfs) { -RTE_PMD_DEBUG_TRACE ("set VF RX mode:invalid VF id %d\n" , vf); -return -EINVAL ; - } - -if (rx_mode ==0 ) { -RTE_PMD_DEBUG_TRACE ("set VF RX mode:mode mask ca not be zero\n" ); -return -EINVAL ; - } -RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->set_vf_rx_mode, -ENOTSUP ); -return (*dev->dev_ops->set_vf_rx_mode)(dev, vf, rx_mode, on); -}/* * Returns index into MAC address array of addr. Use 00:00:00:00:00:00 to find
@@ -2252,76 +2226,6 @@ rte_eth_dev_uc_all_hash_table_set(uint8_t port_id, uint8_t on)return (*dev->dev_ops->uc_all_hash_table_set)(dev, on); } -int -rte_eth_dev_set_vf_rx (uint8_t port_id,uint16_t vf,uint8_t on) -{ -uint16_t num_vfs; -struct rte_eth_dev *dev; -struct rte_eth_dev_info dev_info; - -RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); - - dev = &rte_eth_devices[port_id]; -rte_eth_dev_info_get (port_id, &dev_info); - - num_vfs = dev_info.max_vfs; -if (vf > num_vfs) { -RTE_PMD_DEBUG_TRACE ("port %d: invalid vf id\n" , port_id); -return -EINVAL ; - } - -RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->set_vf_rx, -ENOTSUP ); -return (*dev->dev_ops->set_vf_rx)(dev, vf, on); -} - -int -rte_eth_dev_set_vf_tx (uint8_t port_id,uint16_t vf,uint8_t on) -{ -uint16_t num_vfs; -struct rte_eth_dev *dev; -struct rte_eth_dev_info dev_info; - -RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); - - dev = &rte_eth_devices[port_id]; -rte_eth_dev_info_get (port_id, &dev_info); - - num_vfs = dev_info.max_vfs; -if (vf > num_vfs) { -RTE_PMD_DEBUG_TRACE ("set pool tx:invalid pool id=%d\n" , vf); -return -EINVAL ; - } - -RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->set_vf_tx, -ENOTSUP ); -return (*dev->dev_ops->set_vf_tx)(dev, vf, on); -} - -int -rte_eth_dev_set_vf_vlan_filter (uint8_t port_id,uint16_t vlan_id, -uint64_t vf_mask,uint8_t vlan_on) -{ -struct rte_eth_dev *dev; - -RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); - - dev = &rte_eth_devices[port_id]; - -if (vlan_id >ETHER_MAX_VLAN_ID ) { -RTE_PMD_DEBUG_TRACE ("VF VLAN filter:invalid VLAN id=%d\n" , - vlan_id); -return -EINVAL ; - } - -if (vf_mask ==0 ) { -RTE_PMD_DEBUG_TRACE ("VF VLAN filter:pool_mask can not be 0\n" ); -return -EINVAL ; - } - -RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->set_vf_vlan_filter, -ENOTSUP ); -return (*dev->dev_ops->set_vf_vlan_filter)(dev, vlan_id, - vf_mask, vlan_on); -} -int rte_eth_set_queue_rate_limit (uint8_t port_id,uint16_t queue_idx,uint16_t tx_rate) {
@@ -2352,39 +2256,6 @@ int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx,return (*dev->dev_ops->set_queue_rate_limit)(dev, queue_idx, tx_rate); } -int rte_eth_set_vf_rate_limit (uint8_t port_id,uint16_t vf,uint16_t tx_rate, -uint64_t q_msk) -{ -struct rte_eth_dev *dev; -struct rte_eth_dev_info dev_info; -struct rte_eth_link link; - -if (q_msk ==0 ) -return 0 ; - -RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); - - dev = &rte_eth_devices[port_id]; -rte_eth_dev_info_get (port_id, &dev_info); - link = dev->data->dev_link; - -if (vf > dev_info.max_vfs) { -RTE_PMD_DEBUG_TRACE ("set VF rate limit:port %d: " -"invalid vf id=%d\n" , port_id, vf); -return -EINVAL ; - } - -if (tx_rate > link.link_speed) { -RTE_PMD_DEBUG_TRACE ("set VF rate limit:invalid tx_rate=%d, " -"bigger than link speed= %d\n" , - tx_rate, link.link_speed); -return -EINVAL ; - } - -RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->set_vf_rate_limit, -ENOTSUP ); -return (*dev->dev_ops->set_vf_rate_limit)(dev, vf, tx_rate, q_msk); -} - int rte_eth_mirror_rule_set(uint8_t port_id, struct rte_eth_mirror_conf *mirror_conf,
lib/librte_ether/rte_ethdev.h +0 -33
@@ -1249,39 +1249,11 @@ typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev, uint8_t on);/**< @internal Set all Unicast Hash bitmap */ -typedef int (*eth_set_vf_rx_mode_t )(struct rte_eth_dev *dev, -uint16_t vf, -uint16_t rx_mode, -uint8_t on); -/**< @internal Set a VF receive mode */ - -typedef int (*eth_set_vf_rx_t )(struct rte_eth_dev *dev, -uint16_t vf, -uint8_t on); -/**< @internal Set a VF receive mode */ - -typedef int (*eth_set_vf_tx_t )(struct rte_eth_dev *dev, -uint16_t vf, -uint8_t on); -/**< @internal Enable or disable a VF transmit */ - -typedef int (*eth_set_vf_vlan_filter_t )(struct rte_eth_dev *dev, -uint16_t vlan, -uint64_t vf_mask, -uint8_t vlan_on); -/**< @internal Set VF VLAN pool filter */ -typedef int (*eth_set_queue_rate_limit_t )(struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t tx_rate);/**< @internal Set queue TX rate */ -typedef int (*eth_set_vf_rate_limit_t )(struct rte_eth_dev *dev, -uint16_t vf, -uint16_t tx_rate, -uint64_t q_msk); -/**< @internal Set VF TX rate */ - typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev, struct rte_eth_mirror_conf *mirror_conf, uint8_t rule_id,
@@ -1479,16 +1451,11 @@ struct eth_dev_ops {eth_uc_all_hash_table_set_t uc_all_hash_table_set;/**< Set Unicast hash bitmap */ eth_mirror_rule_set_t mirror_rule_set;/**< Add a traffic mirror rule.*/ eth_mirror_rule_reset_t mirror_rule_reset;/**< reset a traffic mirror rule.*/ -eth_set_vf_rx_mode_t set_vf_rx_mode;/**< Set VF RX mode */ -eth_set_vf_rx_t set_vf_rx;/**< enable/disable a VF receive */ -eth_set_vf_tx_t set_vf_tx;/**< enable/disable a VF transmit */ -eth_set_vf_vlan_filter_t set_vf_vlan_filter;/**< Set VF VLAN filter */ /** Add UDP tunnel port. */ eth_udp_tunnel_port_add_t udp_tunnel_port_add;/** Del UDP tunnel port. */ eth_udp_tunnel_port_del_t udp_tunnel_port_del;eth_set_queue_rate_limit_t set_queue_rate_limit;/**< Set queue rate limit */ -eth_set_vf_rate_limit_t set_vf_rate_limit;/**< Set VF rate limit */ /** Update redirection table. */ reta_update_t reta_update;/** Query redirection table. */
Signature · 1 line
2.10.1
PATCH v2 9/9 doc: remove deprecation notice
In reply to Bernard Iremongerremove deprecation notice for removing rte_eth_dev_set_vf_* API's.
--- doc/guides/rel_notes/deprecation.rst | 13 ------------- 1 file changed, 13 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -13
@@ -38,19 +38,6 @@ Deprecation Notices ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int`` instead of ``void`` and a fourth parameter ``void *ret_param`` will be added. -* ethdev: for 17.02 it is planned to deprecate the following five functions - and move them in ixgbe: - - ``rte_eth_dev_set_vf_rxmode`` - - ``rte_eth_dev_set_vf_rx`` - - ``rte_eth_dev_set_vf_tx`` - - ``rte_eth_dev_set_vf_vlan_filter`` - - ``rte_eth_set_vf_rate_limit`` - * ABI changes are planned for 17.02 in the ``rte_mbuf`` structure: some fields may be reordered to facilitate the writing of ``data_off``, ``refcnt``, and ``nb_segs`` in one operation, because some platforms have an overhead if the
Signature · 1 line
2.10.1
Re: [PATCH v2 8/9] librte_ether: remove the set VF API's
In reply to Bernard IremongerQuoted 7 lines · Bernard Iremonger
remove the following API's:
rte_eth_dev_set_vf_rxmoderte_eth_dev_set_vf_rxrte_eth_dev_set_vf_txrte_eth_dev_set_vf_vlan_filterrte_eth_dev_set_vf_rate_limit
This patch should also remove above function definitions from rte_ethdev.h and rte_ether_version.map too.
And it may be good to squash next patch (remove deprecation notice) to this one to show what caused to notice removal.
Also need to increase LIBABIVER, and update release notes for ABI breakage, somewhere in this patchset, I would do in this patch but not quite sure.
Quoted 7 lines
Signed-off-by Bernard Iremonger <[email protected]>--- lib/librte_ether/rte_ethdev.c | 129 ------------------------------------------ lib/librte_ether/rte_ethdev.h | 33 ----------- 2 files changed, 162 deletions(-)
<...>
v3 cover net/ixgbe: move set VF functions.
In reply to Bernard IremongerThis patchset implements the following deprecation notice:
[PATCH v1] doc: announce API and ABI change for librte_ether
Changes in V3:
Updated LIBABIVER in Makefile in librte_ether patch. Updated rte_ethdev.h and ret_ether_version.map in librte_ether patch. Squashed deprecation notice patch into librte_ether patch. Added release_note patch.
Changes in V2:
Update testpmd set vf commands help messages.
Updated ethtool to use the ixgbe public API's.
Removed the ixgbe_set_pool_* and ixgbe_set_vf_rate_limit functions. Removed the rte_eth_dev_set_vf_* API's
Removed the deprecation notice.
Changes in V1:
The following functions from eth_dev_ops have been moved to the ixgbe PMD and renamed:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limit
Renamed the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limit
Testpmd has been modified to use the following functions:rte_pmd_ixgbe_set_vf_rxmode rte_pmd_ixgbe_set_vf_rate_limit
New testpmd commands have been added to test the following functions:rte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filter
The testpmd user guide has been updated for the new commands.
Bernard Iremonger (9):
net/ixgbe: move set VF functions from the ethdev app/testpmd: use ixgbe public functions app/testpmd: add command for set VF VLAN filter app/testpmd: add command for set VF receive app/testpmd: add command for set VF transmit examples/ethtool: use ixgbe public function net/ixgbe: remove static set VF functions
librte_ether: remove the set VF API's
doc: update release notes
app/test-pmd/cmdline.c | 270 +++++++++++++++- app/test-pmd/config.c | 31 +- doc/guides/rel_notes/deprecation.rst | 13 - doc/guides/rel_notes/release_17_02.rst | 20 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 ++ drivers/net/ixgbe/ixgbe_ethdev.c | 459 ++++++++++++++++------------ drivers/net/ixgbe/rte_pmd_ixgbe.h | 104 +++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 10 + examples/ethtool/lib/rte_ethtool.c | 5 +- lib/librte_ether/Makefile | 4 +- lib/librte_ether/rte_ethdev.c | 129 -------- lib/librte_ether/rte_ethdev.h | 140 --------- lib/librte_ether/rte_ether_version.map | 7 +- 13 files changed, 706 insertions(+), 507 deletions(-)
Signature · 1 line
2.10.1
PATCH v3 1/9 net/ixgbe: move set VF functions from the ethdev
In reply to Bernard IremongerMove the following functions from eth_dev_ops to the ixgbe PMD and rename:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limit
Rename the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limit
Use public function internally
--- drivers/net/ixgbe/ixgbe_ethdev.c | 266 +++++++++++++++++++++++++++- drivers/net/ixgbe/rte_pmd_ixgbe.h | 104 +++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 10 ++ 3 files changed, 379 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +265 -1
@@ -2294,7 +2294,8 @@ ixgbe_dev_start(struct rte_eth_dev *dev)for (vf =0 ; vf < dev->pci_dev->max_vfs; vf++)for (idx =0 ; idx <IXGBE_MAX_QUEUE_NUM_PER_VF ; idx++)if (vfinfo[vf].tx_rate[idx] !=0 ) -ixgbe_set_vf_rate_limit (dev, vf, +rte_pmd_ixgbe_set_vf_rate_limit ( + dev->data->port_id, vf, vfinfo[vf].tx_rate[idx],1 << idx); }
@@ -4883,6 +4884,269 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)return 0 ; } +int +rte_pmd_ixgbe_set_vf_rxmode (uint8_t port,uint16_t vf,uint16_t rx_mask,uint8_t on) +{ +int val =0 ; +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct ixgbe_hw *hw; +uint32_t vmolr; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + vmolr =IXGBE_READ_REG (hw,IXGBE_VMOLR (vf)); + +if (hw->mac.type == ixgbe_mac_82598EB) { +PMD_INIT_LOG (ERR ,"setting VF receive mode set should be done" +" on 82599 hardware and newer" ); +return -ENOTSUP ; + } +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + + val =ixgbe_convert_vm_rx_mask_to_val (rx_mask, val); + +if (on) + vmolr |= val; +else + vmolr &= ~val; + +IXGBE_WRITE_REG (hw,IXGBE_VMOLR (vf), vmolr); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_rx (uint8_t port,uint16_t vf,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +uint32_t reg, addr; +uint32_t val; +const uint8_t bit1 =0x1 ; +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +/* for vf >= 32, set bit in PFVFRE[1], otherwise PFVFRE[0] */ +if (vf >=32 ) { + addr =IXGBE_VFRE (1 ); + val = bit1 << (vf -32 ); + }else { + addr =IXGBE_VFRE (0 ); + val = bit1 << vf; + } + + reg =IXGBE_READ_REG (hw, addr); + +if (on) + reg |= val; +else + reg &= ~val; + +IXGBE_WRITE_REG (hw, addr, reg); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_tx (uint8_t port,uint16_t vf,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +uint32_t reg, addr; +uint32_t val; +const uint8_t bit1 =0x1 ; + +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +/* for vf >= 32, set bit in PFVFTE[1], otherwise PFVFTE[0] */ +if (vf >=32 ) { + addr =IXGBE_VFTE (1 ); + val = bit1 << (vf -32 ); + }else { + addr =IXGBE_VFTE (0 ); + val = bit1 << vf; + } + + reg =IXGBE_READ_REG (hw, addr); + +if (on) + reg |= val; +else + reg &= ~val; + +IXGBE_WRITE_REG (hw, addr, reg); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_vlan_filter (uint8_t port,uint16_t vlan, +uint64_t vf_mask,uint8_t vlan_on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +int ret =0 ; +uint16_t vf_idx; +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if ((vlan >ETHER_MAX_VLAN_ID ) || (vf_mask ==0 )) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +for (vf_idx =0 ; vf_idx <64 ; vf_idx++) { +if (vf_mask & ((uint64_t )(1ULL << vf_idx))) { + ret = hw->mac.ops.set_vfta (hw, vlan, vf_idx, + vlan_on, false); +if (ret <0 ) +return ret; + } + } + +return ret; +} + +int rte_pmd_ixgbe_set_vf_rate_limit (uint8_t port,uint16_t vf, +uint16_t tx_rate,uint64_t q_msk) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct ixgbe_hw *hw; +struct ixgbe_vf_info *vfinfo; +struct rte_eth_link link; +uint8_t nb_q_per_pool; +uint32_t queue_stride; +uint32_t queue_idx, idx =0 , vf_idx; +uint32_t queue_end; +uint16_t total_rate =0 ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); +rte_eth_link_get_nowait (port, &link); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (tx_rate > link.link_speed) +return -EINVAL ; + +if (q_msk ==0 ) +return 0 ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA (dev->data->dev_private)); + nb_q_per_pool =RTE_ETH_DEV_SRIOV (dev).nb_q_per_pool; + queue_stride =IXGBE_MAX_RX_QUEUE_NUM /RTE_ETH_DEV_SRIOV (dev).active; + queue_idx = vf * queue_stride; + queue_end = queue_idx + nb_q_per_pool -1 ; +if (queue_end >= hw->mac.max_tx_queues) +return -EINVAL ; + +if (vfinfo) { +for (vf_idx =0 ; vf_idx < dev->pci_dev->max_vfs; vf_idx++) { +if (vf_idx == vf) +continue ; +for (idx =0 ; idx <RTE_DIM (vfinfo[vf_idx].tx_rate); + idx++) + total_rate += vfinfo[vf_idx].tx_rate[idx]; + } + }else { +return -EINVAL ; + } + +/* Store tx_rate for this vf. */ +for (idx =0 ; idx < nb_q_per_pool; idx++) { +if (((uint64_t )0x1 << idx) & q_msk) { +if (vfinfo[vf].tx_rate[idx] != tx_rate) + vfinfo[vf].tx_rate[idx] = tx_rate; + total_rate += tx_rate; + } + } + +if (total_rate > dev->data->dev_link.link_speed) { +/* Reset stored TX rate of the VF if it causes exceed +* link speed. +*/ +memset (vfinfo[vf].tx_rate,0 ,sizeof (vfinfo[vf].tx_rate)); +return -EINVAL ; + } + +/* Set RTTBCNRC of each queue/pool for vf X */ +for (; queue_idx <= queue_end; queue_idx++) { +if (0x1 & q_msk) +ixgbe_set_queue_rate_limit (dev, queue_idx, tx_rate); + q_msk = q_msk >>1 ; + } + +return 0 ; +} +#define IXGBE_MRCTL_VPME 0x01/* Virtual Pool Mirroring. */ #define IXGBE_MRCTL_UPME 0x02/* Uplink Port Mirroring. */ #define IXGBE_MRCTL_DPME 0x04/* Downlink Port Mirroring. */
drivers/net/ixgbe/rte_pmd_ixgbe.h +104 -0
110 lines not on this page · raw message
drivers/net/ixgbe/rte_pmd_ixgbe_version.map +10 -0
@@ -15,3 +15,13 @@ DPDK_16.11 { rte_pmd_ixgbe_set_vf_vlan_insert; rte_pmd_ixgbe_set_vf_vlan_stripq; } DPDK_2.0; + +DPDK_17.02 { + global: + + rte_pmd_ixgbe_set_vf_rate_limit; + rte_pmd_ixgbe_set_vf_rx; + rte_pmd_ixgbe_set_vf_rxmode; + rte_pmd_ixgbe_set_vf_tx; + rte_pmd_ixgbe_set_vf_vlan_filter; +} DPDK_16.11;
Signature · 1 line
2.10.1
PATCH v3 2/9 app/testpmd: use ixgbe public functions
In reply to Bernard IremongerUse the the following ixgbe public functions:
rte_pmd_ixgbe_set_vf_rate_limitrte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filter
--- app/test-pmd/cmdline.c | 2 +- app/test-pmd/config.c | 31 +++++++++++-------------------- 2 files changed, 12 insertions(+), 21 deletions(-)
app/test-pmd/cmdline.c +1 -1
@@ -6708,7 +6708,7 @@ cmd_set_vf_rxmode_parsed(void *parsed_result, rx_mode |=ETH_VMDQ_ACCEPT_MULTICAST ; } - ret =rte_eth_dev_set_vf_rxmode (res->port_id,res->vf_id,rx_mode,(uint8_t )is_on); + ret =rte_pmd_ixgbe_set_vf_rxmode (res->port_id, res->vf_id, rx_mode, (uint8_t )is_on);if (ret <0 )printf ("bad VF receive mode parameter, return code = %d \n" , ret);
app/test-pmd/config.c +11 -20
@@ -92,6 +92,9 @@#include <rte_ethdev.h> #include <rte_string_fns.h> #include <rte_cycles.h> +#ifdef RTE_LIBRTE_IXGBE_PMD +#include <rte_pmd_ixgbe.h> +#endif #include "testpmd.h"
@@ -2332,16 +2335,16 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)if (port_id_is_invalid (port_id,ENABLED_WARN ))return ;if (is_rx) - diag =rte_eth_dev_set_vf_rx (port_id,vf,on); + diag =rte_pmd_ixgbe_set_vf_rx (port_id, vf, on);else - diag =rte_eth_dev_set_vf_tx (port_id,vf,on); + diag =rte_pmd_ixgbe_set_vf_tx (port_id, vf, on);if (diag ==0 )return ;if (is_rx) -printf ("rte_eth_dev_set_vf_rx for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed " "diag=%d\n" , port_id, diag);else -printf ("rte_eth_dev_set_vf_tx for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed " "diag=%d\n" , port_id, diag); }
@@ -2355,10 +2358,10 @@ set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)return ;if (vlan_id_is_invalid (vlan_id))return ; - diag =rte_eth_dev_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on); + diag =rte_pmd_ixgbe_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on);if (diag ==0 )return ; -printf ("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed " "diag=%d\n" , port_id, diag); }
@@ -2388,23 +2391,11 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk) { int diag; -struct rte_eth_link link; - -if (q_msk ==0 ) -return 0 ; -if (port_id_is_invalid (port_id,ENABLED_WARN )) -return 1 ; -rte_eth_link_get_nowait (port_id, &link); -if (rate > link.link_speed) { -printf ("Invalid rate value:%u bigger than link speed: %u\n" , - rate, link.link_speed); -return 1 ; - } - diag =rte_eth_set_vf_rate_limit (port_id, vf, rate, q_msk); + diag =rte_pmd_ixgbe_set_vf_rate_limit (port_id, vf, rate, q_msk);if (diag ==0 )return diag; -printf ("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n" , +printf ("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n" , port_id, diag);return diag; }
Signature · 1 line
2.10.1
PATCH v3 3/9 app/testpmd: add command for set VF VLAN filter
In reply to Bernard IremongerAdd the following command to testpmd:
set vf vlan filter <port_id> <vlan_id> <vf_mask> on|off
Add command to the testpmd user guide.
--- app/test-pmd/cmdline.c | 98 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 105 insertions(+)
app/test-pmd/cmdline.c +98 -0
@@ -291,6 +291,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf vlan antispoof (port_id) (vf_id) (on|off)\n" " Set VLAN antispoof for a VF from the PF.\n\n" + +"set vf vlan filter (port_id) (vlan_id) (vf_mask) (on|off)\n" + " Set VLAN filter for a VF pool from the PF.\n\n"#endif "vlan set filter (on|off) (port_id)\n"
@@ -11139,6 +11142,100 @@ cmdline_parse_inst_t cmd_set_vf_vlan_insert = { }, }; + +/* vf vlan filter configuration */ + +/* Common result structure for vf vlan filter */ +struct cmd_vf_vlan_filter_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t vlan; +cmdline_fixed_string_t filter; +uint8_t port_id; +uint16_t vlan_id; +uint16_t vf_mask; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf vlan filter enable disable */ +cmdline_parse_token_string_t cmd_vf_vlan_filter_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_vlan = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vlan,"vlan" ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_filter = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + filter,"filter" ); +cmdline_parse_token_num_t cmd_vf_vlan_filter_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_filter_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_vlan_filter_vlan_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vlan_id,UINT16 ); +cmdline_parse_token_num_t cmd_vf_vlan_filter_vf_mask = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_filter_result, + vf_mask,UINT16 ); +cmdline_parse_token_string_t cmd_vf_vlan_filter_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_filter_result, + on_off,"on#off" ); + +static void +cmd_set_vf_vlan_filter_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_vlan_filter_result *res = parsed_result; +int ret; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + + ret =rte_pmd_ixgbe_set_vf_vlan_filter (res->port_id, res->vlan_id, res->vf_mask, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_mask %d or vlan_id %d\n" , res->vf_mask, res->vlan_id); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("not supported on vf port %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_vlan_filter = { + .f = cmd_set_vf_vlan_filter_parsed, + .data =NULL , + .help_str ="set vf vlan filter <port_id> <vlan_id> <vf_mask> on|off" , + .tokens = { + (void *)&cmd_vf_vlan_filter_set, + (void *)&cmd_vf_vlan_filter_vf, + (void *)&cmd_vf_vlan_filter_vlan, + (void *)&cmd_vf_vlan_filter_filter, + (void *)&cmd_vf_vlan_filter_port_id, + (void *)&cmd_vf_vlan_filter_vlan_id, + (void *)&cmd_vf_vlan_filter_vf_mask, + (void *)&cmd_vf_vlan_filter_on_off, +NULL , + }, +}; +/* tx loopback configuration */ /* Common result structure for tx loopback */
@@ -11620,6 +11717,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_mac_anti_spoof, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_stripq, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_insert, + (cmdline_parse_inst_t *)&cmd_set_vf_vlan_filter, (cmdline_parse_inst_t *)&cmd_set_tx_loopback, (cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -535,6 +535,13 @@ Set VLAN insert for a VF from the PF:: testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id) +vlan set filter (for VF pool) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set VLAN filter for a VF pool from the PF:: + + testpmd> set vf vlan filter (port_id) (vlan_id) (vf_mask) (on|off) + vlan set antispoof (for VF) ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.10.1
PATCH v3 4/9 app/testpmd: add command for set VF receive
In reply to Bernard Iremongeradd the following command to testpmd:
set vf rx <port_id> <vf_id> on|off
add command to the testpmd user guide.
--- app/test-pmd/cmdline.c | 85 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 92 insertions(+)
app/test-pmd/cmdline.c +85 -0
@@ -274,6 +274,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf mac antispoof (port_id) (vf_id) (on|off).\n" " Set MAC antispoof for a VF from the PF.\n\n" + +"set vf rx (port_id) (vf_id) (on|off).\n" + " Enable or disable RX for a VF from the PF.\n\n"#endif "vlan set strip (on|off) (port_id)\n"
@@ -11236,6 +11239,87 @@ cmdline_parse_inst_t cmd_set_vf_vlan_filter = { }, }; +/* vf rx configuration */ + +/* Common result structure for vf rx */ +struct cmd_vf_rx_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t rx; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf rx enable disable */ +cmdline_parse_token_string_t cmd_vf_rx_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_rx_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_rx_rx = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + rx,"rx" ); +cmdline_parse_token_num_t cmd_vf_rx_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_rx_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_rx_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_rx_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_vf_rx_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_rx_result, + on_off,"on#off" ); + +static void +cmd_set_vf_rx_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_rx_result *res = parsed_result; +int ret =0 ; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + + ret =rte_pmd_ixgbe_set_vf_rx (res->port_id, res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("not supported on vf port %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_rx = { + .f = cmd_set_vf_rx_parsed, + .data =NULL , + .help_str ="set vf rx <port_id> <vf_id> on|off" , + .tokens = { + (void *)&cmd_vf_rx_set, + (void *)&cmd_vf_rx_vf, + (void *)&cmd_vf_rx_rx, + (void *)&cmd_vf_rx_port_id, + (void *)&cmd_vf_rx_vf_id, + (void *)&cmd_vf_rx_on_off, +NULL , + }, +}; +/* tx loopback configuration */ /* Common result structure for tx loopback */
@@ -11722,6 +11806,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, + (cmdline_parse_inst_t *)&cmd_set_vf_rx, #endif NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -507,6 +507,13 @@ Set mac antispoof for a VF from the PF:: testpmd> set vf mac antispoof (port_id) (vf_id) (on|off) +set rx (for VF) +~~~~~~~~~~~~~~~ + +Enable/disable rx for a VF from the PF:: + + testpmd> set vf rx (port_id) (vf_id) (on|off) + vlan set strip ~~~~~~~~~~~~~~
Signature · 1 line
2.10.1
PATCH v3 5/9 app/testpmd: add command for set VF transmit
In reply to Bernard Iremongeradd the following command to testpmd:
set vf tx <port_id> <vf_id> on|off
add command to the testpmd user guide.
--- app/test-pmd/cmdline.c | 85 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 92 insertions(+)
app/test-pmd/cmdline.c +85 -0
@@ -277,6 +277,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf rx (port_id) (vf_id) (on|off).\n" " Enable or disable RX for a VF from the PF.\n\n" + +"set vf tx (port_id) (vf_id) (on|off).\n" + " Enable or disable TX for a VF from the PF.\n\n"#endif "vlan set strip (on|off) (port_id)\n"
@@ -11320,6 +11323,87 @@ cmdline_parse_inst_t cmd_set_vf_rx = { }, }; +/* vf tx configuration */ + +/* Common result structure for vf tx */ +struct cmd_vf_tx_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t tx; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf tx enable disable */ +cmdline_parse_token_string_t cmd_vf_tx_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_tx_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_tx_tx = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + tx,"tx" ); +cmdline_parse_token_num_t cmd_vf_tx_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_tx_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_tx_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_tx_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_vf_tx_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_tx_result, + on_off,"on#off" ); + +static void +cmd_set_vf_tx_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_tx_result *res = parsed_result; +int ret =0 ; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + + ret =rte_pmd_ixgbe_set_vf_tx (res->port_id, res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("not supported on vf port %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_tx = { + .f = cmd_set_vf_tx_parsed, + .data =NULL , + .help_str ="set vf tx <port_id> <vf_id> on|off" , + .tokens = { + (void *)&cmd_vf_tx_set, + (void *)&cmd_vf_tx_vf, + (void *)&cmd_vf_tx_tx, + (void *)&cmd_vf_tx_port_id, + (void *)&cmd_vf_tx_vf_id, + (void *)&cmd_vf_tx_on_off, +NULL , + }, +}; +/* tx loopback configuration */ /* Common result structure for tx loopback */
@@ -11807,6 +11891,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, (cmdline_parse_inst_t *)&cmd_set_vf_rx, + (cmdline_parse_inst_t *)&cmd_set_vf_tx, #endif NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -514,6 +514,13 @@ Enable/disable rx for a VF from the PF:: testpmd> set vf rx (port_id) (vf_id) (on|off) +set tx (for VF) +~~~~~~~~~~~~~~~ + +Enable/disable tx for a VF from the PF:: + + testpmd> set vf tx (port_id) (vf_id) (on|off) + vlan set strip ~~~~~~~~~~~~~~
Signature · 1 line
2.10.1
PATCH v3 6/9 examples/ethtool: use ixgbe public function
In reply to Bernard IremongerReplace rte_eth_dev_set_vf_rxmode with rte_pmd_ixgbe_set_vf_rx_mode.
--- examples/ethtool/lib/rte_ethtool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
examples/ethtool/lib/rte_ethtool.c +3 -2
@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,7 @@#include <rte_version.h> #include <rte_ethdev.h> #include <rte_ether.h> +#include <rte_pmd_ixgbe.h> #include "rte_ethtool.h" #define PKTPOOL_SIZE 512
@@ -354,7 +355,7 @@ rte_ethtool_net_set_rx_mode(uint8_t port_id)/* Set VF vf_rx_mode, VF unsupport status is discard */ for (vf =0 ; vf < num_vfs; vf++) -rte_eth_dev_set_vf_rxmode (port_id, vf, +rte_pmd_ixgbe_set_vf_rxmode (port_id, vf,ETH_VMDQ_ACCEPT_UNTAG ,0 );/* Enable Rx vlan filter, VF unspport status is discard */
Signature · 1 line
2.10.1
PATCH v3 7/9 net/ixgbe: remove static set VF functions
In reply to Bernard Iremongerremove the following static functions:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limit
--- drivers/net/ixgbe/ixgbe_ethdev.c | 193 --------------------------------------- 1 file changed, 193 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -193
@@ -276,12 +276,6 @@ static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);static int ixgbe_uc_hash_table_set (struct rte_eth_dev *dev,struct ether_addr * mac_addr,uint8_t on);static int ixgbe_uc_all_hash_table_set (struct rte_eth_dev *dev,uint8_t on); -static int ixgbe_set_pool_rx_mode (struct rte_eth_dev *dev,uint16_t pool, -uint16_t rx_mask,uint8_t on); -static int ixgbe_set_pool_rx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on); -static int ixgbe_set_pool_tx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on); -static int ixgbe_set_pool_vlan_filter (struct rte_eth_dev *dev,uint16_t vlan, -uint64_t pool_mask,uint8_t vlan_on);static int ixgbe_mirror_rule_set (struct rte_eth_dev *dev,struct rte_eth_mirror_conf *mirror_conf,uint8_t rule_id,uint8_t on);
@@ -297,8 +291,6 @@ static void ixgbe_configure_msix(struct rte_eth_dev *dev);static int ixgbe_set_queue_rate_limit (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t tx_rate); -static int ixgbe_set_vf_rate_limit (struct rte_eth_dev *dev,uint16_t vf, -uint16_t tx_rate,uint64_t q_msk); static void ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
@@ -568,12 +560,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .uc_all_hash_table_set = ixgbe_uc_all_hash_table_set, .mirror_rule_set = ixgbe_mirror_rule_set, .mirror_rule_reset = ixgbe_mirror_rule_reset, - .set_vf_rx_mode = ixgbe_set_pool_rx_mode, - .set_vf_rx = ixgbe_set_pool_rx, - .set_vf_tx = ixgbe_set_pool_tx, - .set_vf_vlan_filter = ixgbe_set_pool_vlan_filter, .set_queue_rate_limit = ixgbe_set_queue_rate_limit, - .set_vf_rate_limit = ixgbe_set_vf_rate_limit, .reta_update = ixgbe_dev_rss_reta_update, .reta_query = ixgbe_dev_rss_reta_query, #ifdef RTE_NIC_BYPASS
@@ -4547,132 +4534,6 @@ ixgbe_convert_vm_rx_mask_to_val(uint16_t rx_mask, uint32_t orig_val)return new_val; } -static int -ixgbe_set_pool_rx_mode (struct rte_eth_dev *dev,uint16_t pool, -uint16_t rx_mask,uint8_t on) -{ -int val =0 ; - -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -uint32_t vmolr =IXGBE_READ_REG (hw,IXGBE_VMOLR (pool)); - -if (hw->mac.type == ixgbe_mac_82598EB) { -PMD_INIT_LOG (ERR ,"setting VF receive mode set should be done" -" on 82599 hardware and newer" ); -return -ENOTSUP ; - } -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; - - val =ixgbe_convert_vm_rx_mask_to_val (rx_mask, val); - -if (on) - vmolr |= val; -else - vmolr &= ~val; - -IXGBE_WRITE_REG (hw,IXGBE_VMOLR (pool), vmolr); - -return 0 ; -} - -static int -ixgbe_set_pool_rx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on) -{ -uint32_t reg, addr; -uint32_t val; -const uint8_t bit1 =0x1 ; - -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; - -if (pool >=ETH_64_POOLS ) -return -EINVAL ; - -/* for pool >= 32, set bit in PFVFRE[1], otherwise PFVFRE[0] */ -if (pool >=32 ) { - addr =IXGBE_VFRE (1 ); - val = bit1 << (pool -32 ); - }else { - addr =IXGBE_VFRE (0 ); - val = bit1 << pool; - } - - reg =IXGBE_READ_REG (hw, addr); - -if (on) - reg |= val; -else - reg &= ~val; - -IXGBE_WRITE_REG (hw, addr, reg); - -return 0 ; -} - -static int -ixgbe_set_pool_tx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on) -{ -uint32_t reg, addr; -uint32_t val; -const uint8_t bit1 =0x1 ; - -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; - -if (pool >=ETH_64_POOLS ) -return -EINVAL ; - -/* for pool >= 32, set bit in PFVFTE[1], otherwise PFVFTE[0] */ -if (pool >=32 ) { - addr =IXGBE_VFTE (1 ); - val = bit1 << (pool -32 ); - }else { - addr =IXGBE_VFTE (0 ); - val = bit1 << pool; - } - - reg =IXGBE_READ_REG (hw, addr); - -if (on) - reg |= val; -else - reg &= ~val; - -IXGBE_WRITE_REG (hw, addr, reg); - -return 0 ; -} - -static int -ixgbe_set_pool_vlan_filter (struct rte_eth_dev *dev,uint16_t vlan, -uint64_t pool_mask,uint8_t vlan_on) -{ -int ret =0 ; -uint16_t pool_idx; -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; -for (pool_idx =0 ; pool_idx <ETH_64_POOLS ; pool_idx++) { -if (pool_mask & ((uint64_t )(1ULL << pool_idx))) { - ret = hw->mac.ops.set_vfta (hw, vlan, pool_idx, - vlan_on, false); -if (ret <0 ) -return ret; - } - } - -return ret; -}int rte_pmd_ixgbe_set_vf_vlan_anti_spoof (uint8_t port,uint16_t vf,uint8_t on)
@@ -5628,60 +5489,6 @@ static int ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev,return 0 ; } -static int ixgbe_set_vf_rate_limit (struct rte_eth_dev *dev,uint16_t vf, -uint16_t tx_rate,uint64_t q_msk) -{ -struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -struct ixgbe_vf_info *vfinfo = - *(IXGBE_DEV_PRIVATE_TO_P_VFDATA (dev->data->dev_private)); -uint8_t nb_q_per_pool =RTE_ETH_DEV_SRIOV (dev).nb_q_per_pool; -uint32_t queue_stride = -IXGBE_MAX_RX_QUEUE_NUM /RTE_ETH_DEV_SRIOV (dev).active; -uint32_t queue_idx = vf * queue_stride, idx =0 , vf_idx; -uint32_t queue_end = queue_idx + nb_q_per_pool -1 ; -uint16_t total_rate =0 ; - -if (queue_end >= hw->mac.max_tx_queues) -return -EINVAL ; - -if (vfinfo !=NULL ) { -for (vf_idx =0 ; vf_idx < dev->pci_dev->max_vfs; vf_idx++) { -if (vf_idx == vf) -continue ; -for (idx =0 ; idx <RTE_DIM (vfinfo[vf_idx].tx_rate); - idx++) - total_rate += vfinfo[vf_idx].tx_rate[idx]; - } - }else -return -EINVAL ; - -/* Store tx_rate for this vf. */ -for (idx =0 ; idx < nb_q_per_pool; idx++) { -if (((uint64_t )0x1 << idx) & q_msk) { -if (vfinfo[vf].tx_rate[idx] != tx_rate) - vfinfo[vf].tx_rate[idx] = tx_rate; - total_rate += tx_rate; - } - } - -if (total_rate > dev->data->dev_link.link_speed) { -/* -* Reset stored TX rate of the VF if it causes exceed -* link speed. -*/ -memset (vfinfo[vf].tx_rate,0 ,sizeof (vfinfo[vf].tx_rate)); -return -EINVAL ; - } - -/* Set RTTBCNRC of each queue/pool for vf X */ -for (; queue_idx <= queue_end; queue_idx++) { -if (0x1 & q_msk) -ixgbe_set_queue_rate_limit (dev, queue_idx, tx_rate); - q_msk = q_msk >>1 ; - } - -return 0 ; -} static void ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
Signature · 1 line
2.10.1
PATCH v3 8/9 librte_ether: remove the set VF API's
In reply to Bernard Iremongerremove the following API's:
rte_eth_dev_set_vf_rxmoderte_eth_dev_set_vf_rxrte_eth_dev_set_vf_txrte_eth_dev_set_vf_vlan_filterrte_eth_dev_set_vf_rate_limit
Increment LIBABIVER in Makefile
Remove deprecation notice for removing rte_eth_dev_set_vf_* API's.
--- doc/guides/rel_notes/deprecation.rst | 13 --- lib/librte_ether/Makefile | 4 +- lib/librte_ether/rte_ethdev.c | 129 ------------------------------ lib/librte_ether/rte_ethdev.h | 140 --------------------------------- lib/librte_ether/rte_ether_version.map | 7 +- 5 files changed, 3 insertions(+), 290 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -13
@@ -38,19 +38,6 @@ Deprecation Notices ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int`` instead of ``void`` and a fourth parameter ``void *ret_param`` will be added. -* ethdev: for 17.02 it is planned to deprecate the following five functions - and move them in ixgbe: - - ``rte_eth_dev_set_vf_rxmode`` - - ``rte_eth_dev_set_vf_rx`` - - ``rte_eth_dev_set_vf_tx`` - - ``rte_eth_dev_set_vf_vlan_filter`` - - ``rte_eth_set_vf_rate_limit`` - * ABI changes are planned for 17.02 in the ``rte_mbuf`` structure: some fields may be reordered to facilitate the writing of ``data_off``, ``refcnt``, and ``nb_segs`` in one operation, because some platforms have an overhead if the
lib/librte_ether/Makefile +2 -2
@@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright(c) 2010-2016 Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@ CFLAGS += $(WERROR_FLAGS) EXPORT_MAP := rte_ether_version.map -LIBABIVER := 5 +LIBABIVER := 6 SRCS-y += rte_ethdev.c
lib/librte_ether/rte_ethdev.c +0 -129
147 lines not on this page · raw message
lib/librte_ether/rte_ethdev.h +0 -140
174 lines not on this page · raw message
lib/librte_ether/rte_ether_version.map +1 -6
@@ -61,10 +61,6 @@ DPDK_2.2 { rte_eth_dev_set_mtu; rte_eth_dev_set_rx_queue_stats_mapping; rte_eth_dev_set_tx_queue_stats_mapping; - rte_eth_dev_set_vf_rx; - rte_eth_dev_set_vf_rxmode; - rte_eth_dev_set_vf_tx; - rte_eth_dev_set_vf_vlan_filter; rte_eth_dev_set_vlan_offload; rte_eth_dev_set_vlan_pvid; rte_eth_dev_set_vlan_strip_on_queue;
@@ -94,7 +90,6 @@ DPDK_2.2 { rte_eth_rx_queue_info_get; rte_eth_rx_queue_setup; rte_eth_set_queue_rate_limit; - rte_eth_set_vf_rate_limit; rte_eth_stats; rte_eth_stats_get; rte_eth_stats_reset;
@@ -146,4 +141,4 @@ DPDK_16.11 { rte_eth_dev_pci_probe; rte_eth_dev_pci_remove; -} DPDK_16.07; +} DPDK_16.07;
Signature · 1 line
2.10.1
PATCH v3 9/9 doc: update release notes
In reply to Bernard IremongerAdd release note for removing set VF API's from the ethdev, renaming the API's and moving them to the ixgbe PMD.
--- doc/guides/rel_notes/release_17_02.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
doc/guides/rel_notes/release_17_02.rst +20 -0
@@ -38,6 +38,26 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Moved five APIs for VF management from the ethdev to the ixgbe PMD.** + + The following five APIs for VF management from the PF have been removed from the ethdev, + renamed and added to the ixgbe PMD:: + + rte_eth_dev_set_vf_rate_limit + rte_eth_dev_set_vf_rx + rte_eth_dev_set_vf_rxmode + rte_eth_dev_set_vf_tx + rte_eth_dev_set_vf_vlan_filter + + The API's have been renamed to the following:: + + rte_pmd_ixgbe_set_vf_rate_limit + rte_pmd_ixgbe_set_vf_rx + rte_pmd_ixgbe_set_vf_rxmode + rte_pmd_ixgbe_set_vf_tx + rte_pmd_ixgbe_set_vf_vlan_filter + + The declarations for the API’s can be found in ``rte_pmd_ixgbe.h``. Resolved Issues ---------------
Signature · 1 line
2.10.1
Re: [PATCH v3 9/9] doc: update release notes
Hi Bernard,
Quoted 2 lines · Bernard Iremonger
Add release note for removing set VF API's from the ethdev, renaming the API's and moving them to the ixgbe PMD.
Sorry, my bad, I wasn't clear enough.
I was thinking about updating "Shared Library Versions" section of the release notes, and increasing the librte_ethdev.so version (from 5 to 6) I believe new feature section does not require an update.
If you don't mind I can update library version with previous patch, and you don't need to send a new version of the patch. Please let me know.
Quoted 38 lines
Signed-off-by Bernard Iremonger <[email protected]>--- doc/guides/rel_notes/release_17_02.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)doc/guides/rel_notes/release_17_02.rst +20
-0@@ -38,6 +38,26 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Moved five APIs for VF management from the ethdev to the ixgbe PMD.** + + The following five APIs for VF management from the PF have been removed from the ethdev, + renamed and added to the ixgbe PMD:: + + rte_eth_dev_set_vf_rate_limit + rte_eth_dev_set_vf_rx + rte_eth_dev_set_vf_rxmode + rte_eth_dev_set_vf_tx + rte_eth_dev_set_vf_vlan_filter + + The API's have been renamed to the following:: + + rte_pmd_ixgbe_set_vf_rate_limit + rte_pmd_ixgbe_set_vf_rx + rte_pmd_ixgbe_set_vf_rxmode + rte_pmd_ixgbe_set_vf_tx + rte_pmd_ixgbe_set_vf_vlan_filter + + The declarations for the API’s can be found in ``rte_pmd_ixgbe.h``. Resolved Issues ---------------
Re: [PATCH v3 9/9] doc: update release notes
Hi Ferruh,
Quoted 13 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, December 12, 2016 3:52 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 9/9] doc: update release notesHi Bernard,
Quoted 2 lines · Bernard Iremonger
Add release note for removing set VF API's from the ethdev, renaming the API's and moving them to the ixgbe PMD.
Quoted 8 lines
Sorry, my bad, I wasn't clear enough.
I was thinking about updating "Shared Library Versions" section of the release notes, and increasing the librte_ethdev.so version (from 5 to 6) I believe new feature section does not require an update.
If you don't mind I can update library version with previous patch, and you don't need to send a new version of the patch. Please let me know.
Yes, that's fine with me.
Quoted 38 lines
Quoted 12 lines
Signed-off-by Bernard Iremonger <[email protected]>--- doc/guides/rel_notes/release_17_02.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)doc/guides/rel_notes/release_17_02.rst +0
-0doc/guides/rel_notes/release_17_02.rst New Features · line 39
Quoted 2 lines
doc/guides/rel_notes/release_17_02.rst +0
-0@@ -38,6 +38,26 @@ New Features Also, make sure to start the actual text at the margin.=========================================================
Quoted 23 lines
doc/guides/rel_notes/release_17_02.rst +21
-0+* **Moved five APIs for VF management from the ethdev to the ixgbe +PMD.** + + The following five APIs for VF management from the PF have been + removed from the ethdev, renamed and added to the ixgbe PMD:: + + rte_eth_dev_set_vf_rate_limit + rte_eth_dev_set_vf_rx + rte_eth_dev_set_vf_rxmode + rte_eth_dev_set_vf_tx + rte_eth_dev_set_vf_vlan_filter + + The API's have been renamed to the following:: + + rte_pmd_ixgbe_set_vf_rate_limit + rte_pmd_ixgbe_set_vf_rx + rte_pmd_ixgbe_set_vf_rxmode + rte_pmd_ixgbe_set_vf_tx + rte_pmd_ixgbe_set_vf_vlan_filter + + The declarations for the API’s can be found in ``rte_pmd_ixgbe.h``.
Quoted 3 lines
doc/guides/rel_notes/release_17_02.rst New Features · line 63
Quoted 3 lines
doc/guides/rel_notes/release_17_02.rst +0
-0Resolved Issues ---------------
Regards,
Bernard.
Re: [PATCH v3 9/9] doc: update release notes
Quoted 18 lines · Bernard
Hi Ferruh,
Quoted 15 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, December 12, 2016 3:52 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 9/9] doc: update release notesHi Bernard,
Quoted 2 lines · Bernard Iremonger
Add release note for removing set VF API's from the ethdev, renaming the API's and moving them to the ixgbe PMD.
Sorry, my bad, I wasn't clear enough.
Quoted 8 lines
Quoted 6 lines
I was thinking about updating "Shared Library Versions" section of the release notes, and increasing the librte_ethdev.so version (from 5 to 6) I believe new feature section does not require an update.
If you don't mind I can update library version with previous patch, and you don't need to send a new version of the patch. Please let me know.
Yes, that's fine with me.
It seems already increased for this release, by another patch, so no change required there.
I will move your release notes changes to "API Changes" section.
Quoted 47 lines
Quoted 40 lines
Quoted 14 lines
Signed-off-by Bernard Iremonger <[email protected]>--- doc/guides/rel_notes/release_17_02.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)doc/guides/rel_notes/release_17_02.rst +0
-0doc/guides/rel_notes/release_17_02.rst New Features · line 39
Quoted 2 lines
doc/guides/rel_notes/release_17_02.rst +0
-0@@ -38,6 +38,26 @@ New Features Also, make sure to start the actual text at the margin.=========================================================
Quoted 23 lines
doc/guides/rel_notes/release_17_02.rst +21
-0+* **Moved five APIs for VF management from the ethdev to the ixgbe +PMD.** + + The following five APIs for VF management from the PF have been + removed from the ethdev, renamed and added to the ixgbe PMD:: + + rte_eth_dev_set_vf_rate_limit + rte_eth_dev_set_vf_rx + rte_eth_dev_set_vf_rxmode + rte_eth_dev_set_vf_tx + rte_eth_dev_set_vf_vlan_filter + + The API's have been renamed to the following:: + + rte_pmd_ixgbe_set_vf_rate_limit + rte_pmd_ixgbe_set_vf_rx + rte_pmd_ixgbe_set_vf_rxmode + rte_pmd_ixgbe_set_vf_tx + rte_pmd_ixgbe_set_vf_vlan_filter + + The declarations for the API’s can be found in ``rte_pmd_ixgbe.h``.Quoted 3 lines
doc/guides/rel_notes/release_17_02.rst New Features · line 63
Quoted 3 lines
doc/guides/rel_notes/release_17_02.rst +0
-0Resolved Issues ---------------Regards,
Bernard.
Re: [PATCH v3 6/9] examples/ethtool: use ixgbe public function
In reply to Bernard IremongerQuoted 29 lines · Bernard Iremonger
Replace
rte_eth_dev_set_vf_rxmodewithrte_pmd_ixgbe_set_vf_rx_mode.Signed-off-by Bernard Iremonger <[email protected]>--- examples/ethtool/lib/rte_ethtool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)examples/ethtool/lib/rte_ethtool.c +2
-1@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,6 +36,7 @@#include <rte_version.h> #include <rte_ethdev.h> #include <rte_ether.h> +#include <rte_pmd_ixgbe.h> #include "rte_ethtool.h" #define PKTPOOL_SIZE 512
examples/ethtool/lib/rte_ethtool.c rte_ethtool_net_set_rx_mode(uint8_t port_id) · line 358
Quoted 5 lines
examples/ethtool/lib/rte_ethtool.c +1
-1@@ -354,7 +355,7 @@ rte_ethtool_net_set_rx_mode(uint8_t port_id)/* Set VF vf_rx_mode, VF unsupport status is discard */ for (vf =0 ; vf < num_vfs; vf++) - rte_eth_dev_set_vf_rxmode(port_id, vf, + rte_pmd_ixgbe_set_vf_rxmode(port_id, vf,
Will these cause a build error if IXGBE_PMD is not enabled?
Quoted 4 lines
examples/ethtool/lib/rte_ethtool.c +0
-0ETH_VMDQ_ACCEPT_UNTAG, 0);/* Enable Rx vlan filter, VF unspport status is discard */
Re: [PATCH v3 6/9] examples/ethtool: use ixgbe public function
Hi Ferruh,
Quoted 41 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, December 12, 2016 4:25 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 6/9] examples/ethtool: use ixgbe public functionQuoted 1 line · Bernard Iremonger
Replace
rte_eth_dev_set_vf_rxmodewith
rte_pmd_ixgbe_set_vf_rx_mode.Review
Quoted 7 lines
Signed-off-by Bernard Iremonger <[email protected]>--- examples/ethtool/lib/rte_ethtool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/examples/ethtool/lib/rte_ethtool.cQuoted 22 lines
index a1f91d4..0e539f7 100644
examples/ethtool/lib/rte_ethtool.c +2
-1@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,6 +36,7 @@#include <rte_version.h> #include <rte_ethdev.h> #include <rte_ether.h> +#include <rte_pmd_ixgbe.h> #include "rte_ethtool.h" #define PKTPOOL_SIZE 512@@ -354,7 +355,7 @@ rte_ethtool_net_set_rx_mode(uint8_t port_id)
Quoted 6 lines
examples/ethtool/lib/rte_ethtool.c rte_ethtool_net_set_rx_mode(uint8_t port_id) · line 358
Quoted 4 lines
examples/ethtool/lib/rte_ethtool.c +1
-1/* Set VF vf_rx_mode, VF unsupport status is discard */ for (vf =0 ; vf < num_vfs; vf++) - rte_eth_dev_set_vf_rxmode(port_id, vf, + rte_pmd_ixgbe_set_vf_rxmode(port_id, vf,Will these cause a build error if
IXGBE_PMDis not enabled?
Yes, I will send a v4.
Quoted 5 lines
examples/ethtool/lib/rte_ethtool.c rte_ethtool_net_set_rx_mode(uint8_t port_id) · line 361
Quoted 5 lines
examples/ethtool/lib/rte_ethtool.c +0
-0ETH_VMDQ_ACCEPT_UNTAG, 0);/* Enable Rx vlan filter, VF unspport status is discard */
Regards,
Bernard.
v4 cover net/ixgbe: move set VF functions.
In reply to Bernard IremongerThis patchset implements the following deprecation notice:
[PATCH v1] doc: announce API and ABI change for librte_ether
Changes in V4:
Fixed compile issues when ixgbe PMD is not present. Removed duplicate testpmd commands.
Added cleanup patch for testpmd.
Updated release note.
Changes in V3:
Updated LIBABIVER in Makefile in librte_ether patch. Updated rte_ethdev.h and ret_ether_version.map in librte_ether patch. Squashed deprecation notice patch into librte_ether patch. Added release_note patch.
Changes in V2:
Update testpmd set vf commands help messages.
Updated ethtool to use the ixgbe public API's.
Removed the ixgbe_set_pool_* and ixgbe_set_vf_rate_limit functions. Removed the rte_eth_dev_set_vf_* API's
Removed the deprecation notice.
Changes in V1:
The following functions from eth_dev_ops have been moved to the ixgbe PMD and renamed:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limit
Renamed the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limit
Testpmd has been modified to use the following functions:rte_pmd_ixgbe_set_vf_rxmode rte_pmd_ixgbe_set_vf_rate_limit
New testpmd commands have been added to test the following functions:rte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filter
The testpmd user guide has been updated for the new commands.
Bernard Iremonger (7):
net/ixgbe: move set VF functions from the ethdev app/testpmd: use ixgbe public functions app/testpmd: cleanup parameter checking examples/ethtool: use ixgbe public function net/ixgbe: remove static set VF functions
librte_ether: remove the set VF API's
doc: update release notes
app/test-pmd/cmdline.c | 18 +- app/test-pmd/config.c | 43 ++- doc/guides/rel_notes/deprecation.rst | 13 - doc/guides/rel_notes/release_17_02.rst | 23 +- drivers/net/ixgbe/ixgbe_ethdev.c | 459 ++++++++++++++++------------ drivers/net/ixgbe/rte_pmd_ixgbe.h | 104 +++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 10 + examples/ethtool/lib/rte_ethtool.c | 12 +- lib/librte_ether/Makefile | 4 +- lib/librte_ether/rte_ethdev.c | 129 -------- lib/librte_ether/rte_ethdev.h | 140 --------- lib/librte_ether/rte_ether_version.map | 7 +- 12 files changed, 442 insertions(+), 520 deletions(-)
Signature · 1 line
2.10.1
PATCH v4 1/7 net/ixgbe: move set VF functions from the ethdev
In reply to Bernard IremongerMove the following functions from eth_dev_ops to the ixgbe PMD and rename:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limit
Rename the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limit
Use public function internally
--- drivers/net/ixgbe/ixgbe_ethdev.c | 266 +++++++++++++++++++++++++++- drivers/net/ixgbe/rte_pmd_ixgbe.h | 104 +++++++++++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 10 ++ 3 files changed, 379 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +265 -1
@@ -2294,7 +2294,8 @@ ixgbe_dev_start(struct rte_eth_dev *dev)for (vf =0 ; vf < dev->pci_dev->max_vfs; vf++)for (idx =0 ; idx <IXGBE_MAX_QUEUE_NUM_PER_VF ; idx++)if (vfinfo[vf].tx_rate[idx] !=0 ) -ixgbe_set_vf_rate_limit (dev, vf, +rte_pmd_ixgbe_set_vf_rate_limit ( + dev->data->port_id, vf, vfinfo[vf].tx_rate[idx],1 << idx); }
@@ -4883,6 +4884,269 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on)return 0 ; } +int +rte_pmd_ixgbe_set_vf_rxmode (uint8_t port,uint16_t vf,uint16_t rx_mask,uint8_t on) +{ +int val =0 ; +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct ixgbe_hw *hw; +uint32_t vmolr; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + vmolr =IXGBE_READ_REG (hw,IXGBE_VMOLR (vf)); + +if (hw->mac.type == ixgbe_mac_82598EB) { +PMD_INIT_LOG (ERR ,"setting VF receive mode set should be done" +" on 82599 hardware and newer" ); +return -ENOTSUP ; + } +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + + val =ixgbe_convert_vm_rx_mask_to_val (rx_mask, val); + +if (on) + vmolr |= val; +else + vmolr &= ~val; + +IXGBE_WRITE_REG (hw,IXGBE_VMOLR (vf), vmolr); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_rx (uint8_t port,uint16_t vf,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +uint32_t reg, addr; +uint32_t val; +const uint8_t bit1 =0x1 ; +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +/* for vf >= 32, set bit in PFVFRE[1], otherwise PFVFRE[0] */ +if (vf >=32 ) { + addr =IXGBE_VFRE (1 ); + val = bit1 << (vf -32 ); + }else { + addr =IXGBE_VFRE (0 ); + val = bit1 << vf; + } + + reg =IXGBE_READ_REG (hw, addr); + +if (on) + reg |= val; +else + reg &= ~val; + +IXGBE_WRITE_REG (hw, addr, reg); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_tx (uint8_t port,uint16_t vf,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +uint32_t reg, addr; +uint32_t val; +const uint8_t bit1 =0x1 ; + +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +/* for vf >= 32, set bit in PFVFTE[1], otherwise PFVFTE[0] */ +if (vf >=32 ) { + addr =IXGBE_VFTE (1 ); + val = bit1 << (vf -32 ); + }else { + addr =IXGBE_VFTE (0 ); + val = bit1 << vf; + } + + reg =IXGBE_READ_REG (hw, addr); + +if (on) + reg |= val; +else + reg &= ~val; + +IXGBE_WRITE_REG (hw, addr, reg); + +return 0 ; +} + +int +rte_pmd_ixgbe_set_vf_vlan_filter (uint8_t port,uint16_t vlan, +uint64_t vf_mask,uint8_t vlan_on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +int ret =0 ; +uint16_t vf_idx; +struct ixgbe_hw *hw; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if ((vlan >ETHER_MAX_VLAN_ID ) || (vf_mask ==0 )) +return -EINVAL ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); +if (ixgbe_vmdq_mode_check (hw) <0 ) +return -ENOTSUP ; + +for (vf_idx =0 ; vf_idx <64 ; vf_idx++) { +if (vf_mask & ((uint64_t )(1ULL << vf_idx))) { + ret = hw->mac.ops.set_vfta (hw, vlan, vf_idx, + vlan_on, false); +if (ret <0 ) +return ret; + } + } + +return ret; +} + +int rte_pmd_ixgbe_set_vf_rate_limit (uint8_t port,uint16_t vf, +uint16_t tx_rate,uint64_t q_msk) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct ixgbe_hw *hw; +struct ixgbe_vf_info *vfinfo; +struct rte_eth_link link; +uint8_t nb_q_per_pool; +uint32_t queue_stride; +uint32_t queue_idx, idx =0 , vf_idx; +uint32_t queue_end; +uint16_t total_rate =0 ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); +rte_eth_link_get_nowait (port, &link); + +if (strstr (dev_info.driver_name,"ixgbe_vf" )) +return -ENOTSUP ; + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + +if (tx_rate > link.link_speed) +return -EINVAL ; + +if (q_msk ==0 ) +return 0 ; + + hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); + vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA (dev->data->dev_private)); + nb_q_per_pool =RTE_ETH_DEV_SRIOV (dev).nb_q_per_pool; + queue_stride =IXGBE_MAX_RX_QUEUE_NUM /RTE_ETH_DEV_SRIOV (dev).active; + queue_idx = vf * queue_stride; + queue_end = queue_idx + nb_q_per_pool -1 ; +if (queue_end >= hw->mac.max_tx_queues) +return -EINVAL ; + +if (vfinfo) { +for (vf_idx =0 ; vf_idx < dev->pci_dev->max_vfs; vf_idx++) { +if (vf_idx == vf) +continue ; +for (idx =0 ; idx <RTE_DIM (vfinfo[vf_idx].tx_rate); + idx++) + total_rate += vfinfo[vf_idx].tx_rate[idx]; + } + }else { +return -EINVAL ; + } + +/* Store tx_rate for this vf. */ +for (idx =0 ; idx < nb_q_per_pool; idx++) { +if (((uint64_t )0x1 << idx) & q_msk) { +if (vfinfo[vf].tx_rate[idx] != tx_rate) + vfinfo[vf].tx_rate[idx] = tx_rate; + total_rate += tx_rate; + } + } + +if (total_rate > dev->data->dev_link.link_speed) { +/* Reset stored TX rate of the VF if it causes exceed +* link speed. +*/ +memset (vfinfo[vf].tx_rate,0 ,sizeof (vfinfo[vf].tx_rate)); +return -EINVAL ; + } + +/* Set RTTBCNRC of each queue/pool for vf X */ +for (; queue_idx <= queue_end; queue_idx++) { +if (0x1 & q_msk) +ixgbe_set_queue_rate_limit (dev, queue_idx, tx_rate); + q_msk = q_msk >>1 ; + } + +return 0 ; +} +#define IXGBE_MRCTL_VPME 0x01/* Virtual Pool Mirroring. */ #define IXGBE_MRCTL_UPME 0x02/* Uplink Port Mirroring. */ #define IXGBE_MRCTL_DPME 0x04/* Downlink Port Mirroring. */
drivers/net/ixgbe/rte_pmd_ixgbe.h +104 -0
110 lines not on this page · raw message
drivers/net/ixgbe/rte_pmd_ixgbe_version.map +10 -0
@@ -15,3 +15,13 @@ DPDK_16.11 { rte_pmd_ixgbe_set_vf_vlan_insert; rte_pmd_ixgbe_set_vf_vlan_stripq; } DPDK_2.0; + +DPDK_17.02 { + global: + + rte_pmd_ixgbe_set_vf_rate_limit; + rte_pmd_ixgbe_set_vf_rx; + rte_pmd_ixgbe_set_vf_rxmode; + rte_pmd_ixgbe_set_vf_tx; + rte_pmd_ixgbe_set_vf_vlan_filter; +} DPDK_16.11;
Signature · 1 line
2.10.1
PATCH v4 2/7 app/testpmd: use ixgbe public functions
In reply to Bernard IremongerUse the the following ixgbe public functions:
rte_pmd_ixgbe_set_vf_rate_limitrte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filter
--- app/test-pmd/cmdline.c | 18 +++++++++++++----- app/test-pmd/config.c | 26 ++++++++++++++++++-------- 2 files changed, 31 insertions(+), 13 deletions(-)
app/test-pmd/cmdline.c +13 -5
@@ -6614,6 +6614,7 @@ cmdline_parse_inst_t cmd_set_vf_macvlan_filter = { }, }; +#ifdef RTE_LIBRTE_IXGBE_PMD /* *** CONFIGURE VF TRAFFIC CONTROL *** */ struct cmd_set_vf_traffic { cmdline_fixed_string_t set;
@@ -6674,7 +6675,9 @@ cmdline_parse_inst_t cmd_set_vf_traffic = { NULL, }, }; +#endif +#ifdef RTE_LIBRTE_IXGBE_PMD /* *** CONFIGURE VF RECEIVE MODE *** */ struct cmd_set_vf_rxmode { cmdline_fixed_string_t set;
@@ -6708,7 +6711,7 @@ cmd_set_vf_rxmode_parsed(void *parsed_result, rx_mode |=ETH_VMDQ_ACCEPT_MULTICAST ; } - ret =rte_eth_dev_set_vf_rxmode (res->port_id,res->vf_id,rx_mode,(uint8_t )is_on); + ret =rte_pmd_ixgbe_set_vf_rxmode (res->port_id, res->vf_id, rx_mode, (uint8_t )is_on);if (ret <0 )printf ("bad VF receive mode parameter, return code = %d \n" , ret);
@@ -6756,6 +6759,7 @@ cmdline_parse_inst_t cmd_set_vf_rxmode = { NULL, }, }; +#endif /* *** ADD MAC ADDRESS FILTER FOR A VF OF A PORT *** */ struct cmd_vf_mac_addr_result {
@@ -6822,6 +6826,7 @@ cmdline_parse_inst_t cmd_vf_mac_addr_filter = { }, }; +#ifdef RTE_LIBRTE_IXGBE_PMD /* *** ADD/REMOVE A VLAN IDENTIFIER TO/FROM A PORT VLAN RX FILTER *** */ struct cmd_vf_rx_vlan_filter { cmdline_fixed_string_t rx_vlan;
@@ -6884,6 +6889,7 @@ cmdline_parse_inst_t cmd_vf_rxvlan_filter = { NULL, }, }; +#endif /* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */ struct cmd_queue_rate_limit_result {
@@ -6952,6 +6958,7 @@ cmdline_parse_inst_t cmd_queue_rate_limit = { }, }; +#ifdef RTE_LIBRTE_IXGBE_PMD /* *** SET RATE LIMIT FOR A VF OF A PORT *** */ struct cmd_vf_rate_limit_result { cmdline_fixed_string_t set;
@@ -7030,6 +7037,7 @@ cmdline_parse_inst_t cmd_vf_rate_limit = { NULL, }, }; +#endif /* *** ADD TUNNEL FILTER OF A PORT *** */ struct cmd_tunnel_filter_result {
@@ -11561,15 +11569,11 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_config_burst, (cmdline_parse_inst_t *)&cmd_config_thresh, (cmdline_parse_inst_t *)&cmd_config_threshold, - (cmdline_parse_inst_t *)&cmd_set_vf_rxmode, (cmdline_parse_inst_t *)&cmd_set_uc_hash_filter, (cmdline_parse_inst_t *)&cmd_set_uc_all_hash_filter, (cmdline_parse_inst_t *)&cmd_vf_mac_addr_filter, (cmdline_parse_inst_t *)&cmd_set_vf_macvlan_filter, - (cmdline_parse_inst_t *)&cmd_set_vf_traffic, - (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter, (cmdline_parse_inst_t *)&cmd_queue_rate_limit, - (cmdline_parse_inst_t *)&cmd_vf_rate_limit, (cmdline_parse_inst_t *)&cmd_tunnel_filter, (cmdline_parse_inst_t *)&cmd_tunnel_udp_config, (cmdline_parse_inst_t *)&cmd_global_config,
@@ -11624,6 +11628,10 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, + (cmdline_parse_inst_t *)&cmd_set_vf_rxmode, + (cmdline_parse_inst_t *)&cmd_set_vf_traffic, + (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter, + (cmdline_parse_inst_t *)&cmd_vf_rate_limit, #endif NULL, };
app/test-pmd/config.c +18 -8
@@ -92,6 +92,9 @@#include <rte_ethdev.h> #include <rte_string_fns.h> #include <rte_cycles.h> +#ifdef RTE_LIBRTE_IXGBE_PMD +#include <rte_pmd_ixgbe.h> +#endif #include "testpmd.h"
@@ -2324,6 +2327,7 @@ fdir_set_flex_payload(portid_t port_id, struct rte_eth_flex_payload_cfg *cfg) } +#ifdef RTE_LIBRTE_IXGBE_PMD void set_vf_traffic (portid_t port_id,uint8_t is_rx,uint16_t vf,uint8_t on) {
@@ -2332,16 +2336,17 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)if (port_id_is_invalid (port_id,ENABLED_WARN ))return ;if (is_rx) - diag =rte_eth_dev_set_vf_rx (port_id,vf,on); + diag =rte_pmd_ixgbe_set_vf_rx (port_id, vf, on);else - diag =rte_eth_dev_set_vf_tx (port_id,vf,on); + diag =rte_pmd_ixgbe_set_vf_tx (port_id, vf, on); +if (diag ==0 )return ;if (is_rx) -printf ("rte_eth_dev_set_vf_rx for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_rx for port_id=%d failed " "diag=%d\n" , port_id, diag);else -printf ("rte_eth_dev_set_vf_tx for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_tx for port_id=%d failed " "diag=%d\n" , port_id, diag); }
@@ -2355,12 +2360,15 @@ set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)return ;if (vlan_id_is_invalid (vlan_id))return ; - diag =rte_eth_dev_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on); + + diag =rte_pmd_ixgbe_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on); +if (diag ==0 )return ; -printf ("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed " +printf ("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed " "diag=%d\n", port_id, diag); } +#endif int set_queue_rate_limit (portid_t port_id,uint16_t queue_idx,uint16_t rate)
@@ -2384,6 +2392,7 @@ set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)return diag; } +#ifdef RTE_LIBRTE_IXGBE_PMD int set_vf_rate_limit (portid_t port_id,uint16_t vf,uint16_t rate,uint64_t q_msk) {
@@ -2401,13 +2410,14 @@ set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk) rate, link.link_speed); return 1; } - diag =rte_eth_set_vf_rate_limit (port_id, vf, rate, q_msk); + diag =rte_pmd_ixgbe_set_vf_rate_limit (port_id, vf, rate, q_msk);if (diag ==0 )return diag; -printf ("rte_eth_set_vf_rate_limit for port_id=%d failed diag=%d\n" , +printf ("rte_pmd_ixgbe_set_vf_rate_limit for port_id=%d failed diag=%d\n" , port_id, diag);return diag; } +#endif /* * Functions to manage the set of filtered Multicast MAC addresses.
Signature · 1 line
2.10.1
PATCH v4 3/7 app/testpmd: cleanup parameter checking
In reply to Bernard IremongerParameter checking is done in the rte_pmd_ixgbe_* functions. Remove parameter checking from before calls to the rte_pmd_ixgbe_* functions.
--- app/test-pmd/config.c | 19 ------------------- 1 file changed, 19 deletions(-)
app/test-pmd/config.c +0 -19
@@ -2333,8 +2333,6 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on) {int diag; -if (port_id_is_invalid (port_id,ENABLED_WARN )) -return ;if (is_rx) diag =rte_pmd_ixgbe_set_vf_rx (port_id, vf, on);else
@@ -2356,11 +2354,6 @@ set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on) {int diag; -if (port_id_is_invalid (port_id,ENABLED_WARN )) -return ; -if (vlan_id_is_invalid (vlan_id)) -return ; - diag =rte_pmd_ixgbe_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on);if (diag ==0 )
@@ -2397,19 +2390,7 @@ int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk) { int diag; -struct rte_eth_link link; - -if (q_msk ==0 ) -return 0 ; -if (port_id_is_invalid (port_id,ENABLED_WARN )) -return 1 ; -rte_eth_link_get_nowait (port_id, &link); -if (rate > link.link_speed) { -printf ("Invalid rate value:%u bigger than link speed: %u\n" , - rate, link.link_speed); -return 1 ; - } diag =rte_pmd_ixgbe_set_vf_rate_limit (port_id, vf, rate, q_msk);if (diag ==0 )return diag;
Signature · 1 line
2.10.1
PATCH v4 4/7 examples/ethtool: use ixgbe public function
In reply to Bernard IremongerReplace rte_eth_dev_set_vf_rxmode with rte_pmd_ixgbe_set_vf_rx_mode.
--- examples/ethtool/lib/rte_ethtool.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
examples/ethtool/lib/rte_ethtool.c +9 -3
@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,9 @@#include <rte_version.h> #include <rte_ethdev.h> #include <rte_ether.h> +#ifdef RTE_LIBRTE_IXGBE_PMD +#include <rte_pmd_ixgbe.h> +#endif #include "rte_ethtool.h" #define PKTPOOL_SIZE 512
@@ -353,9 +356,12 @@ rte_ethtool_net_set_rx_mode(uint8_t port_id) num_vfs = dev_info.max_vfs;/* Set VF vf_rx_mode, VF unsupport status is discard */ -for (vf =0 ; vf < num_vfs; vf++) -rte_eth_dev_set_vf_rxmode (port_id, vf, +for (vf =0 ; vf < num_vfs; vf++) { +#ifdef RTE_LIBRTE_IXGBE_PMD +rte_pmd_ixgbe_set_vf_rxmode (port_id, vf,ETH_VMDQ_ACCEPT_UNTAG ,0 ); +#endif + }/* Enable Rx vlan filter, VF unspport status is discard */ rte_eth_dev_set_vlan_offload (port_id,ETH_VLAN_FILTER_MASK );
Signature · 1 line
2.10.1
PATCH v4 5/7 net/ixgbe: remove static set VF functions
In reply to Bernard Iremongerremove the following static functions:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limit
--- drivers/net/ixgbe/ixgbe_ethdev.c | 193 --------------------------------------- 1 file changed, 193 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -193
@@ -276,12 +276,6 @@ static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);static int ixgbe_uc_hash_table_set (struct rte_eth_dev *dev,struct ether_addr * mac_addr,uint8_t on);static int ixgbe_uc_all_hash_table_set (struct rte_eth_dev *dev,uint8_t on); -static int ixgbe_set_pool_rx_mode (struct rte_eth_dev *dev,uint16_t pool, -uint16_t rx_mask,uint8_t on); -static int ixgbe_set_pool_rx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on); -static int ixgbe_set_pool_tx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on); -static int ixgbe_set_pool_vlan_filter (struct rte_eth_dev *dev,uint16_t vlan, -uint64_t pool_mask,uint8_t vlan_on);static int ixgbe_mirror_rule_set (struct rte_eth_dev *dev,struct rte_eth_mirror_conf *mirror_conf,uint8_t rule_id,uint8_t on);
@@ -297,8 +291,6 @@ static void ixgbe_configure_msix(struct rte_eth_dev *dev);static int ixgbe_set_queue_rate_limit (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t tx_rate); -static int ixgbe_set_vf_rate_limit (struct rte_eth_dev *dev,uint16_t vf, -uint16_t tx_rate,uint64_t q_msk); static void ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
@@ -568,12 +560,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .uc_all_hash_table_set = ixgbe_uc_all_hash_table_set, .mirror_rule_set = ixgbe_mirror_rule_set, .mirror_rule_reset = ixgbe_mirror_rule_reset, - .set_vf_rx_mode = ixgbe_set_pool_rx_mode, - .set_vf_rx = ixgbe_set_pool_rx, - .set_vf_tx = ixgbe_set_pool_tx, - .set_vf_vlan_filter = ixgbe_set_pool_vlan_filter, .set_queue_rate_limit = ixgbe_set_queue_rate_limit, - .set_vf_rate_limit = ixgbe_set_vf_rate_limit, .reta_update = ixgbe_dev_rss_reta_update, .reta_query = ixgbe_dev_rss_reta_query, #ifdef RTE_NIC_BYPASS
@@ -4547,132 +4534,6 @@ ixgbe_convert_vm_rx_mask_to_val(uint16_t rx_mask, uint32_t orig_val)return new_val; } -static int -ixgbe_set_pool_rx_mode (struct rte_eth_dev *dev,uint16_t pool, -uint16_t rx_mask,uint8_t on) -{ -int val =0 ; - -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -uint32_t vmolr =IXGBE_READ_REG (hw,IXGBE_VMOLR (pool)); - -if (hw->mac.type == ixgbe_mac_82598EB) { -PMD_INIT_LOG (ERR ,"setting VF receive mode set should be done" -" on 82599 hardware and newer" ); -return -ENOTSUP ; - } -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; - - val =ixgbe_convert_vm_rx_mask_to_val (rx_mask, val); - -if (on) - vmolr |= val; -else - vmolr &= ~val; - -IXGBE_WRITE_REG (hw,IXGBE_VMOLR (pool), vmolr); - -return 0 ; -} - -static int -ixgbe_set_pool_rx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on) -{ -uint32_t reg, addr; -uint32_t val; -const uint8_t bit1 =0x1 ; - -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; - -if (pool >=ETH_64_POOLS ) -return -EINVAL ; - -/* for pool >= 32, set bit in PFVFRE[1], otherwise PFVFRE[0] */ -if (pool >=32 ) { - addr =IXGBE_VFRE (1 ); - val = bit1 << (pool -32 ); - }else { - addr =IXGBE_VFRE (0 ); - val = bit1 << pool; - } - - reg =IXGBE_READ_REG (hw, addr); - -if (on) - reg |= val; -else - reg &= ~val; - -IXGBE_WRITE_REG (hw, addr, reg); - -return 0 ; -} - -static int -ixgbe_set_pool_tx (struct rte_eth_dev *dev,uint16_t pool,uint8_t on) -{ -uint32_t reg, addr; -uint32_t val; -const uint8_t bit1 =0x1 ; - -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; - -if (pool >=ETH_64_POOLS ) -return -EINVAL ; - -/* for pool >= 32, set bit in PFVFTE[1], otherwise PFVFTE[0] */ -if (pool >=32 ) { - addr =IXGBE_VFTE (1 ); - val = bit1 << (pool -32 ); - }else { - addr =IXGBE_VFTE (0 ); - val = bit1 << pool; - } - - reg =IXGBE_READ_REG (hw, addr); - -if (on) - reg |= val; -else - reg &= ~val; - -IXGBE_WRITE_REG (hw, addr, reg); - -return 0 ; -} - -static int -ixgbe_set_pool_vlan_filter (struct rte_eth_dev *dev,uint16_t vlan, -uint64_t pool_mask,uint8_t vlan_on) -{ -int ret =0 ; -uint16_t pool_idx; -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -if (ixgbe_vmdq_mode_check (hw) <0 ) -return -ENOTSUP ; -for (pool_idx =0 ; pool_idx <ETH_64_POOLS ; pool_idx++) { -if (pool_mask & ((uint64_t )(1ULL << pool_idx))) { - ret = hw->mac.ops.set_vfta (hw, vlan, pool_idx, - vlan_on, false); -if (ret <0 ) -return ret; - } - } - -return ret; -}int rte_pmd_ixgbe_set_vf_vlan_anti_spoof (uint8_t port,uint16_t vf,uint8_t on)
@@ -5628,60 +5489,6 @@ static int ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev,return 0 ; } -static int ixgbe_set_vf_rate_limit (struct rte_eth_dev *dev,uint16_t vf, -uint16_t tx_rate,uint64_t q_msk) -{ -struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -struct ixgbe_vf_info *vfinfo = - *(IXGBE_DEV_PRIVATE_TO_P_VFDATA (dev->data->dev_private)); -uint8_t nb_q_per_pool =RTE_ETH_DEV_SRIOV (dev).nb_q_per_pool; -uint32_t queue_stride = -IXGBE_MAX_RX_QUEUE_NUM /RTE_ETH_DEV_SRIOV (dev).active; -uint32_t queue_idx = vf * queue_stride, idx =0 , vf_idx; -uint32_t queue_end = queue_idx + nb_q_per_pool -1 ; -uint16_t total_rate =0 ; - -if (queue_end >= hw->mac.max_tx_queues) -return -EINVAL ; - -if (vfinfo !=NULL ) { -for (vf_idx =0 ; vf_idx < dev->pci_dev->max_vfs; vf_idx++) { -if (vf_idx == vf) -continue ; -for (idx =0 ; idx <RTE_DIM (vfinfo[vf_idx].tx_rate); - idx++) - total_rate += vfinfo[vf_idx].tx_rate[idx]; - } - }else -return -EINVAL ; - -/* Store tx_rate for this vf. */ -for (idx =0 ; idx < nb_q_per_pool; idx++) { -if (((uint64_t )0x1 << idx) & q_msk) { -if (vfinfo[vf].tx_rate[idx] != tx_rate) - vfinfo[vf].tx_rate[idx] = tx_rate; - total_rate += tx_rate; - } - } - -if (total_rate > dev->data->dev_link.link_speed) { -/* -* Reset stored TX rate of the VF if it causes exceed -* link speed. -*/ -memset (vfinfo[vf].tx_rate,0 ,sizeof (vfinfo[vf].tx_rate)); -return -EINVAL ; - } - -/* Set RTTBCNRC of each queue/pool for vf X */ -for (; queue_idx <= queue_end; queue_idx++) { -if (0x1 & q_msk) -ixgbe_set_queue_rate_limit (dev, queue_idx, tx_rate); - q_msk = q_msk >>1 ; - } - -return 0 ; -} static void ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
Signature · 1 line
2.10.1
PATCH v4 6/7 librte_ether: remove the set VF API's
In reply to Bernard Iremongerremove the following API's:
rte_eth_dev_set_vf_rxmoderte_eth_dev_set_vf_rxrte_eth_dev_set_vf_txrte_eth_dev_set_vf_vlan_filterrte_eth_dev_set_vf_rate_limit
Increment LIBABIVER in Makefile
Remove deprecation notice for removing rte_eth_dev_set_vf_* API's.
--- doc/guides/rel_notes/deprecation.rst | 13 --- lib/librte_ether/Makefile | 4 +- lib/librte_ether/rte_ethdev.c | 129 ------------------------------ lib/librte_ether/rte_ethdev.h | 140 --------------------------------- lib/librte_ether/rte_ether_version.map | 7 +- 5 files changed, 3 insertions(+), 290 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -13
@@ -38,19 +38,6 @@ Deprecation Notices ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int`` instead of ``void`` and a fourth parameter ``void *ret_param`` will be added. -* ethdev: for 17.02 it is planned to deprecate the following five functions - and move them in ixgbe: - - ``rte_eth_dev_set_vf_rxmode`` - - ``rte_eth_dev_set_vf_rx`` - - ``rte_eth_dev_set_vf_tx`` - - ``rte_eth_dev_set_vf_vlan_filter`` - - ``rte_eth_set_vf_rate_limit`` - * ABI changes are planned for 17.02 in the ``rte_mbuf`` structure: some fields may be reordered to facilitate the writing of ``data_off``, ``refcnt``, and ``nb_segs`` in one operation, because some platforms have an overhead if the
lib/librte_ether/Makefile +2 -2
@@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright(c) 2010-2016 Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@ CFLAGS += $(WERROR_FLAGS) EXPORT_MAP := rte_ether_version.map -LIBABIVER := 5 +LIBABIVER := 6 SRCS-y += rte_ethdev.c
lib/librte_ether/rte_ethdev.c +0 -129
147 lines not on this page · raw message
lib/librte_ether/rte_ethdev.h +0 -140
174 lines not on this page · raw message
lib/librte_ether/rte_ether_version.map +1 -6
@@ -61,10 +61,6 @@ DPDK_2.2 { rte_eth_dev_set_mtu; rte_eth_dev_set_rx_queue_stats_mapping; rte_eth_dev_set_tx_queue_stats_mapping; - rte_eth_dev_set_vf_rx; - rte_eth_dev_set_vf_rxmode; - rte_eth_dev_set_vf_tx; - rte_eth_dev_set_vf_vlan_filter; rte_eth_dev_set_vlan_offload; rte_eth_dev_set_vlan_pvid; rte_eth_dev_set_vlan_strip_on_queue;
@@ -94,7 +90,6 @@ DPDK_2.2 { rte_eth_rx_queue_info_get; rte_eth_rx_queue_setup; rte_eth_set_queue_rate_limit; - rte_eth_set_vf_rate_limit; rte_eth_stats; rte_eth_stats_get; rte_eth_stats_reset;
@@ -146,4 +141,4 @@ DPDK_16.11 { rte_eth_dev_pci_probe; rte_eth_dev_pci_remove; -} DPDK_16.07; +} DPDK_16.07;
Signature · 1 line
2.10.1
PATCH v4 7/7 doc: update release notes
In reply to Bernard IremongerAdd release note for removing set VF API's from the ethdev, renaming the API's and moving them to the ixgbe PMD.
--- doc/guides/rel_notes/release_17_02.rst | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_17_02.rst +21 -2
@@ -38,7 +38,6 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= - Resolved Issues ---------------
@@ -102,6 +101,26 @@ API Changes Also, make sure to start the actual text at the margin. ========================================================= +* **Moved five APIs for VF management from the ethdev to the ixgbe PMD.** + + The following five APIs for VF management from the PF have been removed from the ethdev, + renamed and added to the ixgbe PMD:: + + rte_eth_dev_set_vf_rate_limit + rte_eth_dev_set_vf_rx + rte_eth_dev_set_vf_rxmode + rte_eth_dev_set_vf_tx + rte_eth_dev_set_vf_vlan_filter + + The API's have been renamed to the following:: + + rte_pmd_ixgbe_set_vf_rate_limit + rte_pmd_ixgbe_set_vf_rx + rte_pmd_ixgbe_set_vf_rxmode + rte_pmd_ixgbe_set_vf_tx + rte_pmd_ixgbe_set_vf_vlan_filter + + The declarations for the API’s can be found in ``rte_pmd_ixgbe.h``. ABI Changes -----------
@@ -142,7 +161,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_cryptodev.so.2 librte_distributor.so.1 librte_eal.so.3 - librte_ethdev.so.5 + +librte_ethdev.so.6 librte_hash.so.2 librte_ip_frag.so.1 librte_jobstats.so.1
Signature · 1 line
2.10.1
Quoted 51 lines · Bernard Iremonger
This patchset implements the following deprecation notice:
[PATCH v1] doc: announce API and ABI change forlibrte_etherChanges in V4:
Fixed compile issues when ixgbe PMD is not present. Removed duplicate testpmd commands.
Added cleanup patch for testpmd.
Updated release note.Changes in V3:
Updated LIBABIVER inMakefileinlibrte_etherpatch. Updatedrte_ethdev.hand ret_ether_version.map inlibrte_etherpatch. Squashed deprecation notice patch intolibrte_etherpatch. Addedrelease_notepatch.Changes in V2:
Update testpmd set vf commands help messages.
Updated ethtool to use the ixgbe public API's.
Removed the ixgbe_set_pool_* andixgbe_set_vf_rate_limitfunctions. Removed the rte_eth_dev_set_vf_* API's
Removed the deprecation notice.Changes in V1:
The following functions frometh_dev_opshave been moved to the ixgbe PMD and renamed:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limitRenamed the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limitTestpmd has been modified to use the following functions:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rate_limitNew testpmd commands have been added to test the following functions:
rte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterThe testpmd user guide has been updated for the new commands.
Quoted 9 lines
Bernard Iremonger (7):
net/ixgbe: move set VF functions from the ethdev app/testpmd: use ixgbe public functions app/testpmd: cleanup parameter checking examples/ethtool: use ixgbe public function net/ixgbe: remove static set VF functions
librte_ether: remove the set VF API's
doc: update release notes
Series applied to dpdk-next-net/master, thanks.
Last patch squashed.
Hi Ferruh,
Quoted 69 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, December 13, 2016 1:37 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v4 0/7] net/ixgbe: move set VF functions.Quoted 15 lines · Bernard Iremonger
This patchset implements the following deprecation notice:
[PATCH v1] doc: announce API and ABI change forlibrte_etherChanges in V4:
Fixed compile issues when ixgbe PMD is not present. Removed duplicate testpmd commands.
Added cleanup patch for testpmd.
Updated release note.Changes in V3:
Updated LIBABIVER inMakefileinlibrte_etherpatch. Updatedrte_ethdev.hand ret_ether_version.map inlibrte_etherpatch. Squashed deprecation notice patch intolibrte_etherpatch. Addedrelease_notepatch.Quoted 5 lines
Changes in V2:
Update testpmd set vf commands help messages.
Updated ethtool to use the ixgbe public API's.
Removed the ixgbe_set_pool_* andixgbe_set_vf_rate_limitfunctions. Removed the rte_eth_dev_set_vf_* API's Removed the deprecationnotice.
Quoted 30 lines
Changes in V1:
The following functions frometh_dev_opshave been moved to the ixgbe PMD and renamed:
ixgbe_set_pool_rx_modeixgbe_set_pool_rxixgbe_set_pool_txixgbe_set_pool_vlan_filterixgbe_set_vf_rate_limitRenamed the functions to the following:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterrte_pmd_ixgbe_set_vf_rate_limitTestpmd has been modified to use the following functions:
rte_pmd_ixgbe_set_vf_rxmoderte_pmd_ixgbe_set_vf_rate_limitNew testpmd commands have been added to test the following functions:
rte_pmd_ixgbe_set_vf_rxrte_pmd_ixgbe_set_vf_txrte_pmd_ixgbe_set_vf_vlan_filterThe testpmd user guide has been updated for the new commands.
Quoted 9 lines
Bernard Iremonger (7):
net/ixgbe: move set VF functions from the ethdev app/testpmd: use ixgbe public functions app/testpmd: cleanup parameter checking examples/ethtool: use ixgbe public function net/ixgbe: remove static set VF functions
librte_ether: remove the set VF API's
doc: update release notes
Quoted 3 lines
Series applied to dpdk-next-net/master, thanks.
Last patch squashed.
Thanks.
Regards,
Bernard.