[dpdk-dev] [PATCH v9] app/testpmd: fix DCB configuration

2016-11-03 Thread Bernard Iremonger
Data Centre Bridge (DCB) configuration fails when SRIOV is
enabled if nb_rxq or nb_txq are greater than nb_q_per_pool.

The failure occurs during configuration of the ixgbe PMD when
it is started, in the ixgbe_check_mq_mode function.

Fixes: 2a977b891f99 ("app/testpmd: fix DCB configuration")

Signed-off-by: Bernard Iremonger 
---
 Changes in v9:
 when max_vfs is greater then 0, set nb_rxq and nb_txq to
 dev_info.nb_rx_queues and dev_info.nb_tx_queues.

 Changes in v8:
 revise commit message.

 Changes in v7:
 restore nb_rxq and nb_txq setting when max_vfs is 0

 app/test-pmd/testpmd.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6185be6..a0332c2 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2002,8 +2002,13 @@ init_port_dcb_config(portid_t pid,
 * and has the same number of rxq and txq in dcb mode
 */
if (dcb_mode == DCB_VT_ENABLED) {
-   nb_rxq = rte_port->dev_info.max_rx_queues;
-   nb_txq = rte_port->dev_info.max_tx_queues;
+   if (rte_port->dev_info.max_vfs > 0) {
+   nb_rxq = rte_port->dev_info.nb_rx_queues;
+   nb_txq = rte_port->dev_info.nb_tx_queues;
+   } else {
+   nb_rxq = rte_port->dev_info.max_rx_queues;
+   nb_txq = rte_port->dev_info.max_tx_queues;
+   }
} else {
/*if vt is disabled, use all pf queues */
if (rte_port->dev_info.vmdq_pool_base == 0) {
-- 
2.10.1



[dpdk-dev] [PATCH v8] app/testpmd: fix DCB configuration

2016-11-01 Thread Bernard Iremonger
Data Centre Bridge (DCB) configuration fails when SRIOV is
enabled if nb_rxq and nb_txq are not set to 1.

The failure occurs during configuration of the ixgbe PMD when
it is started, in the ixgbe_check_mq_mode function.

Fixes: 2a977b891f99 ("app/testpmd: fix DCB configuration")

Signed-off-by: Bernard Iremonger 
---
 Changes in v8:
 revise commit message.

 Changes in v7:
 restore nb_rxq and nb_txq setting when max_vfs is 0

 app/test-pmd/testpmd.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6185be6..96f5011 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2002,8 +2002,13 @@ init_port_dcb_config(portid_t pid,
 * and has the same number of rxq and txq in dcb mode
 */
if (dcb_mode == DCB_VT_ENABLED) {
-   nb_rxq = rte_port->dev_info.max_rx_queues;
-   nb_txq = rte_port->dev_info.max_tx_queues;
+   if (rte_port->dev_info.max_vfs > 0) {
+   nb_rxq = 1;
+   nb_txq = 1;
+   } else {
+   nb_rxq = rte_port->dev_info.max_rx_queues;
+   nb_txq = rte_port->dev_info.max_tx_queues;
+   }
} else {
/*if vt is disabled, use all pf queues */
if (rte_port->dev_info.vmdq_pool_base == 0) {
-- 
2.4.3



[dpdk-dev] [PATCH v7] app/testpmd: fix DCB configuration

2016-10-28 Thread Bernard Iremonger
Data Centre Bridge (DCB) configuration fails when SRIOV is
enabled if nb_rxq and nb_txq are not set to 1.

When dcb_mode is DCB_VT_ENABLED and max_vfs is greater than
zero, set nb_rxq and nb_txq to 1.

The failure occurs during configuration of the ixgbe PMD when
it is started, in the ixgbe_check_mq_mode function, if nb_rxq
and nb_txq are not set to 1.

Fixes: 2a977b891f99 ("app/testpmd: fix DCB configuration")

Signed-off-by: Bernard Iremonger 

Changes in v7:
restore nb_rxq and nb_txq setting when max_vfs is 0.
---
 app/test-pmd/testpmd.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6185be6..96f5011 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2002,8 +2002,13 @@ init_port_dcb_config(portid_t pid,
 * and has the same number of rxq and txq in dcb mode
 */
if (dcb_mode == DCB_VT_ENABLED) {
-   nb_rxq = rte_port->dev_info.max_rx_queues;
-   nb_txq = rte_port->dev_info.max_tx_queues;
+   if (rte_port->dev_info.max_vfs > 0) {
+   nb_rxq = 1;
+   nb_txq = 1;
+   } else {
+   nb_rxq = rte_port->dev_info.max_rx_queues;
+   nb_txq = rte_port->dev_info.max_tx_queues;
+   }
} else {
/*if vt is disabled, use all pf queues */
if (rte_port->dev_info.vmdq_pool_base == 0) {
-- 
2.4.3



[dpdk-dev] [PATCH v6 2/2] app/test_pmd: fix DCB configuration

2016-10-25 Thread Bernard Iremonger
Data Centre Bridge (DCB) configuration fails when SRIOV is
enabled if nb_rxq and nb_txq are not set to 1.

When dcb_mode is DCB_VT_ENABLED set nb_rxq and nb_txq to 1.

The failure occurs during configuration of the ixgbe PMD when
it is started, in the ixgbe_check_mq_mode function, if nb_rxq
and nb_txq are not set to 1.

Fixes: 2a977b891f99 ("app/testpmd: fix DCB configuration")

Signed-off-by: Bernard Iremonger 
Acked-by: Wenzhuo Lu 
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6185be6..ee567c3 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2002,8 +2002,8 @@ init_port_dcb_config(portid_t pid,
 * and has the same number of rxq and txq in dcb mode
 */
if (dcb_mode == DCB_VT_ENABLED) {
-   nb_rxq = rte_port->dev_info.max_rx_queues;
-   nb_txq = rte_port->dev_info.max_tx_queues;
+   nb_rxq = 1;
+   nb_txq = 1;
} else {
/*if vt is disabled, use all pf queues */
if (rte_port->dev_info.vmdq_pool_base == 0) {
-- 
2.10.1



[dpdk-dev] [PATCH v6 1/2] net/ixgbe: support multiqueue mode VMDq DCB with SRIOV

2016-10-25 Thread Bernard Iremonger
The folowing changes have been made to allow Data Centre Bridge
(DCB) configuration when SRIOV is enabled.

Modify ixgbe_check_mq_mode function,
when SRIOV is enabled, enable mq_mode
ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB.

Modify ixgbe_dcb_tx_hw_config function,
replace the struct ixgbe_hw parameter with a
struct rte_eth_dev parameter and handle SRIOV enabled.

Modify ixgbe_dev_mq_rx_configure function,
when SRIOV is enabled, enable mq_mode ETH_MQ_RX_VMDQ_DCB.

Modify ixgbe_configure_dcb function,
revise check on dev->data->nb_rx_queues.

Signed-off-by: Rahul R Shah 
Signed-off-by: Bernard Iremonger 
Acked-by: Wenzhuo Lu 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++-
 drivers/net/ixgbe/ixgbe_rxtx.c   | 35 ++-
 2 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4ca5747..4d5ce83 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1977,6 +1977,9 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
/* check multi-queue mode */
switch (dev_conf->rxmode.mq_mode) {
case ETH_MQ_RX_VMDQ_DCB:
+   PMD_INIT_LOG(INFO, "ETH_MQ_RX_VMDQ_DCB mode supported 
in SRIOV");
+   dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_DCB;
+   break;
case ETH_MQ_RX_VMDQ_DCB_RSS:
/* DCB/RSS VMDQ in SRIOV mode, not implement yet */
PMD_INIT_LOG(ERR, "SRIOV active,"
@@ -2012,11 +2015,9 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)

switch (dev_conf->txmode.mq_mode) {
case ETH_MQ_TX_VMDQ_DCB:
-   /* DCB VMDQ in SRIOV mode, not implement yet */
-   PMD_INIT_LOG(ERR, "SRIOV is active,"
-   " unsupported VMDQ mq_mode tx %d.",
-   dev_conf->txmode.mq_mode);
-   return -EINVAL;
+   PMD_INIT_LOG(INFO, "ETH_MQ_TX_VMDQ_DCB mode supported 
in SRIOV");
+   dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_DCB;
+   break;
default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
dev->data->dev_conf.txmode.mq_mode = 
ETH_MQ_TX_VMDQ_ONLY;
break;
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 2ce8234..b2d9f45 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   Copyright 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -3313,15 +3313,16 @@ ixgbe_vmdq_dcb_configure(struct rte_eth_dev *dev)

 /**
  * ixgbe_dcb_config_tx_hw_config - Configure general DCB TX parameters
- * @hw: pointer to hardware structure
+ * @dev: pointer to eth_dev structure
  * @dcb_config: pointer to ixgbe_dcb_config structure
  */
 static void
-ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
+ixgbe_dcb_tx_hw_config(struct rte_eth_dev *dev,
   struct ixgbe_dcb_config *dcb_config)
 {
uint32_t reg;
uint32_t q;
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);

PMD_INIT_FUNC_TRACE();
if (hw->mac.type != ixgbe_mac_82598EB) {
@@ -3340,10 +3341,17 @@ ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
reg |= IXGBE_MTQC_VT_ENA;
IXGBE_WRITE_REG(hw, IXGBE_MTQC, reg);

-   /* Disable drop for all queues */
-   for (q = 0; q < 128; q++)
-   IXGBE_WRITE_REG(hw, IXGBE_QDE,
-   (IXGBE_QDE_WRITE | (q << IXGBE_QDE_IDX_SHIFT)));
+   if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
+   /* Disable drop for all queues in VMDQ mode*/
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT)));
+   } else {
+   /* Enable drop for all queues in SRIOV mode */
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT) | IXGBE_QDE_ENABLE));
+   }

/* Enable the Tx desc arbiter */
reg = IXGBE_READ_REG(hw, IXGBE_RTTDCS);
@@ -3378,7 +3386,7 @@ ixgbe_vmdq_dcb_hw_tx_config(struct rte_eth_dev *dev,
vmdq_tx_conf->nb_queue_pools == ETH_16_POO

[dpdk-dev] [PATCH v6 0/2] net/ixgbe: VMDq DCB with SRIOV

2016-10-25 Thread Bernard Iremonger
Changes in v6:
rebase to latest master.
revise commit messages.

Changes in v5:
fix enable/disable of the QDE bit in the PFQDE register.

Changes in v4:
changes to ixgbe patch following comments.

Changes in v3:
rebase to latest master.
update commit message for ixgbe patch
add testpmd patch.

Changes in v2:
rebase to  latest master.

Bernard Iremonger (2):
  net/ixgbe: support multiqueue mode VMDq DCB with SRIOV
  app/test_pmd: fix DCB configuration

 app/test-pmd/testpmd.c   |  4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++-
 drivers/net/ixgbe/ixgbe_rxtx.c   | 35 ++-
 3 files changed, 30 insertions(+), 20 deletions(-)

-- 
2.10.1



[dpdk-dev] [PATCH] doc: release note for ixgbe PMD API's

2016-10-25 Thread Bernard Iremonger
Signed-off-by: Bernard Iremonger 
---
 doc/guides/rel_notes/release_16_11.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/release_16_11.rst 
b/doc/guides/rel_notes/release_16_11.rst
index 26cdd62..8253614 100644
--- a/doc/guides/rel_notes/release_16_11.rst
+++ b/doc/guides/rel_notes/release_16_11.rst
@@ -131,6 +131,10 @@ New Features
   The GCC 4.9 ``-march`` option supports the Intel processor code names.
   The config option ``RTE_MACHINE`` can be used to pass code names to the 
compiler as ``-march`` flag.

+* **Added API's for VF management to the ixgbe PMD.**
+
+  Eight new API's have been added to the ixgbe PMD for VF management from the 
PF.
+  The declarations for the API's can be found in ``rte_pmd_ixgbe.h``.

 Resolved Issues
 ---
-- 
2.10.1



[dpdk-dev] [PATCH v2 2/2] app/test_pmd: change to the VF VLAN insert command

2016-10-19 Thread Bernard Iremonger
The third parameter to the function rte_pmd_ixgbe_set_vf_vlan_insert
has changed to vlan_id from on|off.
The testpmd doc file has been changed to reflect this change.

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/cmdline.c  | 19 +--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  2 +-
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index e0e4fe4..15dbd2c 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -286,7 +286,7 @@ static void cmd_help_long_parsed(void *parsed_result,
"set vf vlan stripq (port_id) (vf_id) (on|off)\n"
"Set the VLAN strip for all queues in a pool for a 
VF from the PF.\n\n"

-   "set vf vlan insert (port_id) (vf_id) (on|off)\n"
+   "set vf vlan insert (port_id) (vf_id) (vlan_id)\n"
"Set VLAN insert for a VF from the PF.\n\n"

"set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
@@ -11017,7 +11017,7 @@ struct cmd_vf_vlan_insert_result {
cmdline_fixed_string_t insert;
uint8_t port_id;
uint16_t vf_id;
-   cmdline_fixed_string_t on_off;
+   uint16_t vlan_id;
 };

 /* Common CLI fields for vf vlan insert enable disable */
@@ -11045,10 +11045,10 @@ cmdline_parse_token_num_t cmd_vf_vlan_insert_vf_id =
TOKEN_NUM_INITIALIZER
(struct cmd_vf_vlan_insert_result,
 vf_id, UINT16);
-cmdline_parse_token_string_t cmd_vf_vlan_insert_on_off =
-   TOKEN_STRING_INITIALIZER
+cmdline_parse_token_num_t cmd_vf_vlan_insert_vlan_id =
+   TOKEN_NUM_INITIALIZER
(struct cmd_vf_vlan_insert_result,
-on_off, "on#off");
+vlan_id, UINT16);

 static void
 cmd_set_vf_vlan_insert_parsed(
@@ -11058,14 +11058,13 @@ cmd_set_vf_vlan_insert_parsed(
 {
struct cmd_vf_vlan_insert_result *res = parsed_result;
int ret;
-   int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;

-   ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, is_on);
+   ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, 
res->vlan_id);
switch (ret) {
case 0:
break;
case -EINVAL:
-   printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+   printf("invalid vf_id %d or vlan_id %d\n", res->vf_id, 
res->vlan_id);
break;
case -ENODEV:
printf("invalid port_id %d\n", res->port_id);
@@ -11078,7 +11077,7 @@ cmd_set_vf_vlan_insert_parsed(
 cmdline_parse_inst_t cmd_set_vf_vlan_insert = {
.f = cmd_set_vf_vlan_insert_parsed,
.data = NULL,
-   .help_str = "set vf vlan insert port_id vf_id on|off",
+   .help_str = "set vf vlan insert port_id vf_id vlan_id",
.tokens = {
(void *)_vf_vlan_insert_set,
(void *)_vf_vlan_insert_vf,
@@ -11086,7 +11085,7 @@ cmdline_parse_inst_t cmd_set_vf_vlan_insert = {
(void *)_vf_vlan_insert_insert,
(void *)_vf_vlan_insert_port_id,
(void *)_vf_vlan_insert_vf_id,
-   (void *)_vf_vlan_insert_on_off,
+   (void *)_vf_vlan_insert_vlan_id,
NULL,
},
 };
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst 
b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index c04805b..9a45932 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -533,7 +533,7 @@ vlan set insert (for VF)

 Set VLAN insert for a VF from the PF::

-   testpmd> set vf vlan insert (port_id) (vf_id) (on|off)
+   testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)

 vlan set antispoof (for VF)
 ~~~
-- 
2.10.1



[dpdk-dev] [PATCH v2 1/2] net/ixgbe: fix VLAN insert parameter type and its use

2016-10-19 Thread Bernard Iremonger
From: "E. Scott Daniels" 

The final parameter to rte_pmd_ixgbe_set_vf_vlan_insert is uint8_t
and treated as a binary flag when it needs to be a uint16_t
and treated as a VLAN id.  The data sheet (sect 8.2.3.27.13) describes
the right most 16 bits as the VLAN id that is to be inserted; the
16.11  code is accepting only a 1 or 0 thus effectively only
allowing the VLAN id 1 to be inserted (0 disables the insertion
setting).

This patch changes the final parm name to represent the data that
is being accepted (vlan_id), changes the type to permit all valid
VLAN ids, and validates the parameter based on the range of 0 to
4095. Corresponding changes to prototype and documentation in the
.h file.

Fixes: 49e248223e9f71 ("net/ixgbe: add API for VF management")

Signed-off-by: E. Scott Daniels 
---
 drivers/net/ixgbe/ixgbe_ethdev.c  | 8 
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4ca5747..316af73 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4727,7 +4727,7 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, 
uint16_t vf, uint8_t on)
 }

 int
-rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on)
+rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t vlan_id)
 {
struct ixgbe_hw *hw;
uint32_t ctrl;
@@ -4742,13 +4742,13 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t 
vf, uint8_t on)
if (vf >= dev_info.max_vfs)
return -EINVAL;

-   if (on > 1)
+   if (vlan_id > 4095)
return -EINVAL;

hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf));
-   if (on) {
-   ctrl = on;
+   if (vlan_id) {
+   ctrl = vlan_id;
ctrl |= IXGBE_VMVIR_VLANA_DEFAULT;
} else {
ctrl = 0;
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h 
b/drivers/net/ixgbe/rte_pmd_ixgbe.h
index 2fdf530..c2fb826 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.h
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h
@@ -99,16 +99,17 @@ int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, 
uint16_t vf, uint8_t on);
  *The port identifier of the Ethernet device.
  * @param vf
  *ID specifying VF.
- * @param on
- *1 - Enable VF's vlan insert.
- *0 - Disable VF's vlan insert
+ * @param vlan_id
+ *0 - Disable VF's vlan insert.
+ *n - Enable; n is inserted as the vlan id.
  *
  * @return
  *   - (0) if successful.
  *   - (-ENODEV) if *port* invalid.
  *   - (-EINVAL) if bad parameter.
  */
-int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on);
+int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf,
+   uint16_t vlan_id);

 /**
  * Enable/Disable tx loopback
-- 
2.10.1



[dpdk-dev] [PATCH v2 0/2] net/ixgbe: fix VF VLAN insert

2016-10-19 Thread Bernard Iremonger
Changes in v2:
Add testpmd patch.
Update testpmd for change to rte_pmd_ixgbe_set_vf_vlan_insert function.

Bernard Iremonger (1):
  app/test_pmd: change to the VF VLAN insert command

E. Scott Daniels (1):
  net/ixgbe: fix VLAN insert parameter type and its use

 app/test-pmd/cmdline.c  | 19 +--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c|  8 
 drivers/net/ixgbe/rte_pmd_ixgbe.h   |  9 +
 4 files changed, 19 insertions(+), 19 deletions(-)

-- 
2.10.1



[dpdk-dev] [PATCH v5 2/2] app/test_pmd: fix DCB configuration

2016-10-19 Thread Bernard Iremonger
when dcb mode is DCB_VT_ENABLED set nb_rxq and nb_txq to 1.

Fixes: 2a977b891f99 ("app/testpmd: fix DCB configuration")
Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6185be6..ee567c3 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2002,8 +2002,8 @@ init_port_dcb_config(portid_t pid,
 * and has the same number of rxq and txq in dcb mode
 */
if (dcb_mode == DCB_VT_ENABLED) {
-   nb_rxq = rte_port->dev_info.max_rx_queues;
-   nb_txq = rte_port->dev_info.max_tx_queues;
+   nb_rxq = 1;
+   nb_txq = 1;
} else {
/*if vt is disabled, use all pf queues */
if (rte_port->dev_info.vmdq_pool_base == 0) {
-- 
2.10.1



[dpdk-dev] [PATCH v5 1/2] net/ixgbe: support multiqueue mode VMDq DCB with SRIOV

2016-10-19 Thread Bernard Iremonger
Modify ixgbe_check_mq_mode function,
when SRIOV is enabled, enable mq_mode
ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB.

Modify ixgbe_dcb_tx_hw_config function,
replace the struct ixgbe_hw parameter with a
struct rte_eth_dev parameter and handle SRIOV enabled.

Modify ixgbe_dev_mq_rx_configure function,
when SRIOV is enabled, enable mq_mode ETH_MQ_RX_VMDQ_DCB.

Modify ixgbe_configure_dcb function,
drop check on dev->data->nb_rx_queues.

Signed-off-by: Rahul R Shah 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++-
 drivers/net/ixgbe/ixgbe_rxtx.c   | 35 ++-
 2 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4ca5747..4d5ce83 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1977,6 +1977,9 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
/* check multi-queue mode */
switch (dev_conf->rxmode.mq_mode) {
case ETH_MQ_RX_VMDQ_DCB:
+   PMD_INIT_LOG(INFO, "ETH_MQ_RX_VMDQ_DCB mode supported 
in SRIOV");
+   dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_DCB;
+   break;
case ETH_MQ_RX_VMDQ_DCB_RSS:
/* DCB/RSS VMDQ in SRIOV mode, not implement yet */
PMD_INIT_LOG(ERR, "SRIOV active,"
@@ -2012,11 +2015,9 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)

switch (dev_conf->txmode.mq_mode) {
case ETH_MQ_TX_VMDQ_DCB:
-   /* DCB VMDQ in SRIOV mode, not implement yet */
-   PMD_INIT_LOG(ERR, "SRIOV is active,"
-   " unsupported VMDQ mq_mode tx %d.",
-   dev_conf->txmode.mq_mode);
-   return -EINVAL;
+   PMD_INIT_LOG(INFO, "ETH_MQ_TX_VMDQ_DCB mode supported 
in SRIOV");
+   dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_DCB;
+   break;
default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
dev->data->dev_conf.txmode.mq_mode = 
ETH_MQ_TX_VMDQ_ONLY;
break;
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 2ce8234..b2d9f45 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   Copyright 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -3313,15 +3313,16 @@ ixgbe_vmdq_dcb_configure(struct rte_eth_dev *dev)

 /**
  * ixgbe_dcb_config_tx_hw_config - Configure general DCB TX parameters
- * @hw: pointer to hardware structure
+ * @dev: pointer to eth_dev structure
  * @dcb_config: pointer to ixgbe_dcb_config structure
  */
 static void
-ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
+ixgbe_dcb_tx_hw_config(struct rte_eth_dev *dev,
   struct ixgbe_dcb_config *dcb_config)
 {
uint32_t reg;
uint32_t q;
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);

PMD_INIT_FUNC_TRACE();
if (hw->mac.type != ixgbe_mac_82598EB) {
@@ -3340,10 +3341,17 @@ ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
reg |= IXGBE_MTQC_VT_ENA;
IXGBE_WRITE_REG(hw, IXGBE_MTQC, reg);

-   /* Disable drop for all queues */
-   for (q = 0; q < 128; q++)
-   IXGBE_WRITE_REG(hw, IXGBE_QDE,
-   (IXGBE_QDE_WRITE | (q << IXGBE_QDE_IDX_SHIFT)));
+   if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
+   /* Disable drop for all queues in VMDQ mode*/
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT)));
+   } else {
+   /* Enable drop for all queues in SRIOV mode */
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT) | IXGBE_QDE_ENABLE));
+   }

/* Enable the Tx desc arbiter */
reg = IXGBE_READ_REG(hw, IXGBE_RTTDCS);
@@ -3378,7 +3386,7 @@ ixgbe_vmdq_dcb_hw_tx_config(struct rte_eth_dev *dev,
vmdq_tx_conf->nb_queue_pools == ETH_16_POOLS ? 0x : 
0x);

/*Configure general DCB TX parameters*/
-   ixgbe_dcb_tx_hw_config(hw, dcb_config);
+  

[dpdk-dev] [PATCH v5 0/2] net/ixgbe: VMDq DCB with SRIOV

2016-10-19 Thread Bernard Iremonger
Changes in v5:
fix enable/disable of the QDE bit in the PFQDE register.

Changes in v4:
changes to ixgbe patch following comments.

Changes in v3:
rebase to latest master.
update commit message for ixgbe patch
add testpmd patch.

Changes in v2:
rebase to  latest master.

Bernard Iremonger (2):
  net/ixgbe: support multiqueue mode VMDq DCB with SRIOV
  app/test_pmd: fix DCB configuration

 app/test-pmd/testpmd.c   |  4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++-
 drivers/net/ixgbe/ixgbe_rxtx.c   | 35 ++-
 3 files changed, 30 insertions(+), 20 deletions(-)

-- 
2.10.1



[dpdk-dev] [PATCH v1] doc: announce API change for ethdev function

2016-10-18 Thread Bernard Iremonger
The _rte_eth_dev_call_process function will change to return "int"
and a fourth parameter "void* ret_param" will be added. This change
targets release 17.02.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/rel_notes/deprecation.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index d5c1490..1d274d8 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -49,3 +49,7 @@ Deprecation Notices
 * mempool: The functions for single/multi producer/consumer are deprecated
   and will be removed in 17.02.
   It is replaced by ``rte_mempool_generic_get/put`` functions.
+
+* librte_ether: an API change is planned for 17.02 for the function
+  ``_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.
-- 
2.10.1



[dpdk-dev] [PATCH v1] doc: announce API and ABI change for librte_ether

2016-10-18 Thread Bernard Iremonger
In 17.02 five rte_eth_dev_set_vf_*** functions will be removed
from librte_ether, renamed and moved to the ixgbe PMD.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/rel_notes/deprecation.rst | 36 
 1 file changed, 36 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 1d274d8..20e11ac 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -53,3 +53,39 @@ Deprecation Notices
 * librte_ether: an API change is planned for 17.02 for the function
   ``_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.
+
+* librte_ether: for 17.02 it is planned to deprecate the following five 
functions:
+
+  ``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``
+
+  The following fields will be removed from ``struct eth_dev_ops``:
+
+  ``eth_set_vf_rx_mode_t``
+
+  ``eth_set_vf_rx_t``
+
+  ``eth_set_vf_tx_t``
+
+  ``eth_set_vf_vlan_filter_t``
+
+  ``eth_set_vf_rate_limit_t``
+
+  The functions will be renamed to the following, and moved to the ``ixgbe`` 
PMD.
+
+  ``rte_pmd_ixgbe_set_vf_rxmode``
+
+  ``rte_pmd_ixgbe_set_vf_rx``
+
+  ``rte_pmd_ixgbe_set_vf_tx``
+
+  ``rte_pmd_ixgbe_set_vf_vlan_filter``
+
+  ``rte_pmd_ixgbe_set_vf_rate_limit``
-- 
2.10.1



[dpdk-dev] [PATCH v4 2/2] app/test_pmd: fix DCB configuration

2016-10-17 Thread Bernard Iremonger
when dcb mode is DCB_VT_ENABLED set nb_rxq and nb_txq to 1.

Fixes: 2a977b891f99 ("app/testpmd: fix DCB configuration")
Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6185be6..ee567c3 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2002,8 +2002,8 @@ init_port_dcb_config(portid_t pid,
 * and has the same number of rxq and txq in dcb mode
 */
if (dcb_mode == DCB_VT_ENABLED) {
-   nb_rxq = rte_port->dev_info.max_rx_queues;
-   nb_txq = rte_port->dev_info.max_tx_queues;
+   nb_rxq = 1;
+   nb_txq = 1;
} else {
/*if vt is disabled, use all pf queues */
if (rte_port->dev_info.vmdq_pool_base == 0) {
-- 
2.10.1



[dpdk-dev] [PATCH v4 1/2] net/ixgbe: support multiqueue mode VMDq DCB with SRIOV

2016-10-17 Thread Bernard Iremonger
Modify ixgbe_check_mq_mode function,
when SRIOV is enabled, enable mq_mode
ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB.

Modify ixgbe_dcb_tx_hw_config function,
replace the struct ixgbe_hw parameter with a
struct rte_eth_dev parameter and handle SRIOV enabled.

Modify ixgbe_dev_mq_rx_configure function,
when SRIOV is enabled, enable mq_mode ETH_MQ_RX_VMDQ_DCB.

Modify ixgbe_configure_dcb function,
drop check on dev->data->nb_rx_queues.

Signed-off-by: Rahul R Shah 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++-
 drivers/net/ixgbe/ixgbe_rxtx.c   | 36 ++--
 2 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4ca5747..4d5ce83 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1977,6 +1977,9 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
/* check multi-queue mode */
switch (dev_conf->rxmode.mq_mode) {
case ETH_MQ_RX_VMDQ_DCB:
+   PMD_INIT_LOG(INFO, "ETH_MQ_RX_VMDQ_DCB mode supported 
in SRIOV");
+   dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_DCB;
+   break;
case ETH_MQ_RX_VMDQ_DCB_RSS:
/* DCB/RSS VMDQ in SRIOV mode, not implement yet */
PMD_INIT_LOG(ERR, "SRIOV active,"
@@ -2012,11 +2015,9 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)

switch (dev_conf->txmode.mq_mode) {
case ETH_MQ_TX_VMDQ_DCB:
-   /* DCB VMDQ in SRIOV mode, not implement yet */
-   PMD_INIT_LOG(ERR, "SRIOV is active,"
-   " unsupported VMDQ mq_mode tx %d.",
-   dev_conf->txmode.mq_mode);
-   return -EINVAL;
+   PMD_INIT_LOG(INFO, "ETH_MQ_TX_VMDQ_DCB mode supported 
in SRIOV");
+   dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_DCB;
+   break;
default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
dev->data->dev_conf.txmode.mq_mode = 
ETH_MQ_TX_VMDQ_ONLY;
break;
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 2ce8234..4c13ed2 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   Copyright 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -3313,15 +3313,16 @@ ixgbe_vmdq_dcb_configure(struct rte_eth_dev *dev)

 /**
  * ixgbe_dcb_config_tx_hw_config - Configure general DCB TX parameters
- * @hw: pointer to hardware structure
+ * @dev: pointer to eth_dev structure
  * @dcb_config: pointer to ixgbe_dcb_config structure
  */
 static void
-ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
+ixgbe_dcb_tx_hw_config(struct rte_eth_dev *dev,
   struct ixgbe_dcb_config *dcb_config)
 {
uint32_t reg;
uint32_t q;
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);

PMD_INIT_FUNC_TRACE();
if (hw->mac.type != ixgbe_mac_82598EB) {
@@ -3339,11 +3340,17 @@ ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
if (dcb_config->vt_mode)
reg |= IXGBE_MTQC_VT_ENA;
IXGBE_WRITE_REG(hw, IXGBE_MTQC, reg);
-
-   /* Disable drop for all queues */
-   for (q = 0; q < 128; q++)
-   IXGBE_WRITE_REG(hw, IXGBE_QDE,
-   (IXGBE_QDE_WRITE | (q << IXGBE_QDE_IDX_SHIFT)));
+   if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
+   /* Disable drop for all queues in VMDQ mode*/
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT) | IXGBE_QDE_ENABLE));
+   } else {
+   /* Enable drop for all queues in SRIOV mode */
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT)));
+   }

/* Enable the Tx desc arbiter */
reg = IXGBE_READ_REG(hw, IXGBE_RTTDCS);
@@ -3378,7 +3385,7 @@ ixgbe_vmdq_dcb_hw_tx_config(struct rte_eth_dev *dev,
vmdq_tx_conf->nb_queue_pools == ETH_16_POOLS ? 0x : 
0x);

/*Configure general DCB TX parameters*/
-  

[dpdk-dev] [PATCH v4 0/2] net/ixgbe: VMDq DCB with SRIOV

2016-10-17 Thread Bernard Iremonger
Changes in v4:
changes to ixgbe patch following comments.

Changes in v3:
rebase to latest master.
update commit message for ixgbe patch
add testpmd patch.

Changes in v2:
rebase to  latest master.

Bernard Iremonger (2):
  net/ixgbe: support multiqueue mode VMDq DCB with SRIOV
  app/test_pmd: fix DCB configuration

 app/test-pmd/testpmd.c   |  4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++-
 drivers/net/ixgbe/ixgbe_rxtx.c   | 36 ++--
 3 files changed, 30 insertions(+), 21 deletions(-)

-- 
2.10.1



[dpdk-dev] [PATCH v3 2/2] app/test_pmd: fix DCB configuration

2016-10-17 Thread Bernard Iremonger
when dcb mode is DCB_VT_ENABLED set nb_rxq and nb_txq to 1.

Fixes: 2a977b891f99 ("app/testpmd: fix DCB configuration")
Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6185be6..ee567c3 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2002,8 +2002,8 @@ init_port_dcb_config(portid_t pid,
 * and has the same number of rxq and txq in dcb mode
 */
if (dcb_mode == DCB_VT_ENABLED) {
-   nb_rxq = rte_port->dev_info.max_rx_queues;
-   nb_txq = rte_port->dev_info.max_tx_queues;
+   nb_rxq = 1;
+   nb_txq = 1;
} else {
/*if vt is disabled, use all pf queues */
if (rte_port->dev_info.vmdq_pool_base == 0) {
-- 
2.10.1



[dpdk-dev] [PATCH v3 1/2] net/ixgbe: support multiqueue mode VMDq DCB with SRIOV

2016-10-17 Thread Bernard Iremonger
Modify ixgbe_check_mq_mode function,
when SRIOV is enabled, enable mq_mode
ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB.

Modify ixgbe_dcb_tx_hw_config function,
replace the struct ixgbe_hw parameter with a
struct rte_eth_dev parameter and handle SRIOV enabled.

Modify ixgbe_dev_mq_rx_configure function,
when SRIOV is enabled, enable mq_mode ETH_MQ_RX_VMDQ_DCB.

Modify ixgbe_configure_dcb function,
drop check on dev->data->nb_rx_queues.

Signed-off-by: Rahul R Shah 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c |  9 -
 drivers/net/ixgbe/ixgbe_rxtx.c   | 37 +
 2 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4ca5747..114698d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1977,6 +1977,8 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
/* check multi-queue mode */
switch (dev_conf->rxmode.mq_mode) {
case ETH_MQ_RX_VMDQ_DCB:
+   PMD_INIT_LOG(INFO, "ETH_MQ_RX_VMDQ_DCB mode supported 
in SRIOV");
+   break;
case ETH_MQ_RX_VMDQ_DCB_RSS:
/* DCB/RSS VMDQ in SRIOV mode, not implement yet */
PMD_INIT_LOG(ERR, "SRIOV active,"
@@ -2012,11 +2014,8 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)

switch (dev_conf->txmode.mq_mode) {
case ETH_MQ_TX_VMDQ_DCB:
-   /* DCB VMDQ in SRIOV mode, not implement yet */
-   PMD_INIT_LOG(ERR, "SRIOV is active,"
-   " unsupported VMDQ mq_mode tx %d.",
-   dev_conf->txmode.mq_mode);
-   return -EINVAL;
+   PMD_INIT_LOG(INFO, "ETH_MQ_TX_VMDQ_DCB mode supported 
in SRIOV");
+   break;
default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
dev->data->dev_conf.txmode.mq_mode = 
ETH_MQ_TX_VMDQ_ONLY;
break;
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 2ce8234..bb13889 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   Copyright 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -3313,15 +3313,16 @@ ixgbe_vmdq_dcb_configure(struct rte_eth_dev *dev)

 /**
  * ixgbe_dcb_config_tx_hw_config - Configure general DCB TX parameters
- * @hw: pointer to hardware structure
+ * @dev: pointer to eth_dev structure
  * @dcb_config: pointer to ixgbe_dcb_config structure
  */
 static void
-ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
+ixgbe_dcb_tx_hw_config(struct rte_eth_dev *dev,
   struct ixgbe_dcb_config *dcb_config)
 {
uint32_t reg;
uint32_t q;
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);

PMD_INIT_FUNC_TRACE();
if (hw->mac.type != ixgbe_mac_82598EB) {
@@ -3339,11 +3340,17 @@ ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
if (dcb_config->vt_mode)
reg |= IXGBE_MTQC_VT_ENA;
IXGBE_WRITE_REG(hw, IXGBE_MTQC, reg);
-
-   /* Disable drop for all queues */
-   for (q = 0; q < 128; q++)
-   IXGBE_WRITE_REG(hw, IXGBE_QDE,
-   (IXGBE_QDE_WRITE | (q << IXGBE_QDE_IDX_SHIFT)));
+   if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
+   /* Disable drop for all queues in VMDQ mode*/
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT) | IXGBE_QDE_ENABLE));
+   } else {
+   /* Enable drop for all queues in SRIOV mode */
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT)));
+   }

/* Enable the Tx desc arbiter */
reg = IXGBE_READ_REG(hw, IXGBE_RTTDCS);
@@ -3378,7 +3385,7 @@ ixgbe_vmdq_dcb_hw_tx_config(struct rte_eth_dev *dev,
vmdq_tx_conf->nb_queue_pools == ETH_16_POOLS ? 0x : 
0x);

/*Configure general DCB TX parameters*/
-   ixgbe_dcb_tx_hw_config(hw, dcb_config);
+   ixgbe_dcb_tx_hw_config(dev, dcb_config);
 }

 static void
@@ -3661,7 +3668,7 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,

[dpdk-dev] [PATCH v3 0/2] net/ixgbe: VMDq DCB with SRIOV

2016-10-17 Thread Bernard Iremonger
Changes in v3:
rebase to latest master.
update commit message for ixgbe patch
add testpmd patch.

Changes in v2:
rebase to  latest master.

Bernard Iremonger (2):
  net/ixgbe: support multiqueue mode VMDq DCB with SRIOV
  app/test_pmd: fix DCB configuration

 app/test-pmd/testpmd.c   |  4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c |  9 -
 drivers/net/ixgbe/ixgbe_rxtx.c   | 37 +
 3 files changed, 27 insertions(+), 23 deletions(-)

-- 
2.10.1



[dpdk-dev] [PATCH v1 2/2] doc: update poll mode driver guide

2016-10-14 Thread Bernard Iremonger
add information about new ixgbe PMD API.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/prog_guide/poll_mode_drv.rst | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/doc/guides/prog_guide/poll_mode_drv.rst 
b/doc/guides/prog_guide/poll_mode_drv.rst
index bf3ea9f..3a400b2 100644
--- a/doc/guides/prog_guide/poll_mode_drv.rst
+++ b/doc/guides/prog_guide/poll_mode_drv.rst
@@ -356,3 +356,9 @@ Some additions in the metadata scheme are as follows:
 An example where queue numbers are used is as follows: ``tx_q7_bytes`` which
 indicates this statistic applies to queue number 7, and represents the number
 of transmitted bytes on that queue.
+
+Extended ixgbe PMD API
+~~
+
+In DPDK release v16.11 an API for ixgbe specific functions has been added to 
the ixgbe PMD.
+The declarations for the API functions are in the header ``rte_pmd_ixgbe.h``.
-- 
2.10.1



[dpdk-dev] [PATCH v1 1/2] doc: update ixgbe guide

2016-10-14 Thread Bernard Iremonger
add information about new ixgbe PMD API.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/nics/ixgbe.rst | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/doc/guides/nics/ixgbe.rst b/doc/guides/nics/ixgbe.rst
index ed260c4..3b6851b 100644
--- a/doc/guides/nics/ixgbe.rst
+++ b/doc/guides/nics/ixgbe.rst
@@ -1,5 +1,5 @@
 ..  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
@@ -147,6 +147,11 @@ The following MACROs are used for these three features:

 *   ETH_TXQ_FLAGS_NOXSUMTCP

+Application Programming Interface
+~
+
+In DPDK release v16.11 an API for ixgbe specific functions has been added to 
the ixgbe PMD.
+The declarations for the API functions are in the header ``rte_pmd_ixgbe.h``.

 Sample Application Notes
 
-- 
2.10.1



[dpdk-dev] [PATCH v1 0/2] doc: ixgbe updates

2016-10-14 Thread Bernard Iremonger
Update two rst files to announce ixgbe PMD API's

Bernard Iremonger (2):
  doc: update ixgbe guide
  doc: update poll mode driver guide

 doc/guides/nics/ixgbe.rst   | 7 ++-
 doc/guides/prog_guide/poll_mode_drv.rst | 6 ++
 2 files changed, 12 insertions(+), 1 deletion(-)

-- 
2.10.1



[dpdk-dev] [PATCH v2] net/ixgbe: support multiqueue mode VMDq DCB with SRIOV

2016-10-14 Thread Bernard Iremonger
modify ixgbe_dcb_tx_hw_config function.
modify ixgbe_dev_mq_rx_configure function.
modify ixgbe_configure_dcb function.

Changes in v2:
Rebased to DPDK v16.11-rc1

Signed-off-by: Rahul R Shah 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c |  9 -
 drivers/net/ixgbe/ixgbe_rxtx.c   | 37 +
 2 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4ca5747..114698d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1977,6 +1977,8 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
/* check multi-queue mode */
switch (dev_conf->rxmode.mq_mode) {
case ETH_MQ_RX_VMDQ_DCB:
+   PMD_INIT_LOG(INFO, "ETH_MQ_RX_VMDQ_DCB mode supported 
in SRIOV");
+   break;
case ETH_MQ_RX_VMDQ_DCB_RSS:
/* DCB/RSS VMDQ in SRIOV mode, not implement yet */
PMD_INIT_LOG(ERR, "SRIOV active,"
@@ -2012,11 +2014,8 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)

switch (dev_conf->txmode.mq_mode) {
case ETH_MQ_TX_VMDQ_DCB:
-   /* DCB VMDQ in SRIOV mode, not implement yet */
-   PMD_INIT_LOG(ERR, "SRIOV is active,"
-   " unsupported VMDQ mq_mode tx %d.",
-   dev_conf->txmode.mq_mode);
-   return -EINVAL;
+   PMD_INIT_LOG(INFO, "ETH_MQ_TX_VMDQ_DCB mode supported 
in SRIOV");
+   break;
default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
dev->data->dev_conf.txmode.mq_mode = 
ETH_MQ_TX_VMDQ_ONLY;
break;
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 2ce8234..bb13889 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   Copyright 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -3313,15 +3313,16 @@ ixgbe_vmdq_dcb_configure(struct rte_eth_dev *dev)

 /**
  * ixgbe_dcb_config_tx_hw_config - Configure general DCB TX parameters
- * @hw: pointer to hardware structure
+ * @dev: pointer to eth_dev structure
  * @dcb_config: pointer to ixgbe_dcb_config structure
  */
 static void
-ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
+ixgbe_dcb_tx_hw_config(struct rte_eth_dev *dev,
   struct ixgbe_dcb_config *dcb_config)
 {
uint32_t reg;
uint32_t q;
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);

PMD_INIT_FUNC_TRACE();
if (hw->mac.type != ixgbe_mac_82598EB) {
@@ -3339,11 +3340,17 @@ ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
if (dcb_config->vt_mode)
reg |= IXGBE_MTQC_VT_ENA;
IXGBE_WRITE_REG(hw, IXGBE_MTQC, reg);
-
-   /* Disable drop for all queues */
-   for (q = 0; q < 128; q++)
-   IXGBE_WRITE_REG(hw, IXGBE_QDE,
-   (IXGBE_QDE_WRITE | (q << IXGBE_QDE_IDX_SHIFT)));
+   if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
+   /* Disable drop for all queues in VMDQ mode*/
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT) | IXGBE_QDE_ENABLE));
+   } else {
+   /* Enable drop for all queues in SRIOV mode */
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT)));
+   }

/* Enable the Tx desc arbiter */
reg = IXGBE_READ_REG(hw, IXGBE_RTTDCS);
@@ -3378,7 +3385,7 @@ ixgbe_vmdq_dcb_hw_tx_config(struct rte_eth_dev *dev,
vmdq_tx_conf->nb_queue_pools == ETH_16_POOLS ? 0x : 
0x);

/*Configure general DCB TX parameters*/
-   ixgbe_dcb_tx_hw_config(hw, dcb_config);
+   ixgbe_dcb_tx_hw_config(dev, dcb_config);
 }

 static void
@@ -3661,7 +3668,7 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
/*get DCB TX configuration parameters from rte_eth_conf*/
ixgbe_dcb_tx_config(dev, dcb_config);
/*Configure general DCB TX parameters*/
-   ixgbe_dcb_tx_hw_config(hw, dcb_config);
+   ixgbe_dcb_tx_hw_config(de

[dpdk-dev] [PATCH v9 2/2] app/test_pmd: add tests for new API's

2016-10-12 Thread Bernard Iremonger
add test for set vf vlan anti spoof
add test for set vf mac anti spoof
add test for set vf vlan stripq
add test for set vf vlan insert
add test for set tx loopback
add test for set all queues drop enable bit
add test for set vf split drop enable bit
add test for set vf mac address
add new API's to testpmd help command.

add new API's to the testpmd guide

modify Makefile, add library rte_pmd_ixgbe to _LDLIBS-y.

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/Makefile   |   2 +
 app/test-pmd/cmdline.c  | 699 +++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  62 ++-
 3 files changed, 759 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 2a0b5a5..891b85a 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -58,6 +58,8 @@ SRCS-y += csumonly.c
 SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c

+_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
+
 CFLAGS_cmdline.o := -D_GNU_SOURCE

 # this application needs libraries first
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a1da8b8..41c7acf 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -87,7 +87,9 @@
 #ifdef RTE_LIBRTE_PMD_BOND
 #include 
 #endif
-
+#ifdef RTE_LIBRTE_IXGBE_PMD
+#include 
+#endif
 #include "testpmd.h"

 static struct cmdline *testpmd_cl;
@@ -260,12 +262,37 @@ static void cmd_help_long_parsed(void *parsed_result,
"set portlist (x[,y]*)\n"
"Set the list of forwarding ports.\n\n"

+#ifdef RTE_LIBRTE_IXGBE_PMD
+   "set tx loopback (port_id) (on|off)\n"
+   "Enable or disable tx loopback.\n\n"
+
+   "set all queues drop (port_id) (on|off)\n"
+   "Set drop enable bit for all queues.\n\n"
+
+   "set vf split drop (port_id) (vf_id) (on|off)\n"
+   "Set split drop enable bit for a VF from the 
PF.\n\n"
+
+   "set vf mac antispoof (port_id) (vf_id) (on|off).\n"
+   "Set MAC antispoof for a VF from the PF.\n\n"
+#endif
+
"vlan set strip (on|off) (port_id)\n"
"Set the VLAN strip on a port.\n\n"

"vlan set stripq (on|off) (port_id,queue_id)\n"
"Set the VLAN strip for a queue on a port.\n\n"

+#ifdef RTE_LIBRTE_IXGBE_PMD
+   "set vf vlan stripq (port_id) (vf_id) (on|off)\n"
+   "Set the VLAN strip for all queues in a pool for a 
VF from the PF.\n\n"
+
+   "set vf vlan insert (port_id) (vf_id) (on|off)\n"
+   "Set VLAN insert for a VF from the PF.\n\n"
+
+   "set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
+   "Set VLAN antispoof for a VF from the PF.\n\n"
+#endif
+
"vlan set filter (on|off) (port_id)\n"
"Set the VLAN filter on a port.\n\n"

@@ -359,6 +386,11 @@ static void cmd_help_long_parsed(void *parsed_result,
"mac_addr add port (port_id) vf (vf_id) (mac_address)\n"
"Add a MAC address for a VF on the port.\n\n"

+#ifdef RTE_LIBRTE_IXGBE_PMD
+   "set vf mac addr (port_id) (vf_id) 
(XX:XX:XX:XX:XX:XX)\n"
+   "Set the MAC address for a VF from the PF.\n\n"
+#endif
+
"set port (port_id) uta (mac_address|all) (on|off)\n"
"Add/Remove a or all unicast hash filter(s)"
"from port X.\n\n"
@@ -10700,6 +10732,661 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
NULL,
},
 };
+#ifdef RTE_LIBRTE_IXGBE_PMD
+
+/* vf vlan anti spoof configuration */
+
+/* Common result structure for vf vlan anti spoof */
+struct cmd_vf_vlan_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t vlan;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf vlan anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+set, "set");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vf =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_res

[dpdk-dev] [PATCH v9 1/2] net/ixgbe: add API's for VF management

2016-10-12 Thread Bernard Iremonger
Add API's to configure and manage VF's on an Intel 82559 NIC.

add rte_pmd_ixgbe_set_vf_vlan_anti_spoof function.
add rte_pmd_ixgbe_set_vf_mac_anti_spoof function.
add rte_pmd_ixgbe_set_vf_stripq function.

Signed-off-by: Alex Zelezniak 

add rte_pmd_ixgbe_set_vf_vlan_insert function.
add rte_pmd_ixgbe_set_tx_loopback function.
add rte_pmd_ixgbe_set_all_queues_drop function.
add rte_pmd_ixgbe_set_vf_split_drop_en function.
add rte_pmd_ixgbe_set_vf_mac_addr function.

Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/Makefile  |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c| 240 
 drivers/net/ixgbe/rte_pmd_ixgbe.h   | 182 +
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  13 ++
 4 files changed, 438 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ixgbe/rte_pmd_ixgbe.h

diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile
index a6c71f3..94ddc7b 100644
--- a/drivers/net/ixgbe/Makefile
+++ b/drivers/net/ixgbe/Makefile
@@ -1,6 +1,6 @@
 #   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
@@ -119,6 +119,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bypass.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_82599_bypass.c
 endif

+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)-include := rte_pmd_ixgbe.h

 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal lib/librte_ether
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 6b3d4fa..35281f9 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -72,6 +72,8 @@
 #include "base/ixgbe_phy.h"
 #include "ixgbe_regs.h"

+#include "rte_pmd_ixgbe.h"
+
 /*
  * High threshold controlling when to start sending XOFF frames. Must be at
  * least 8 bytes less than receive packet buffer size. This value is in units
@@ -4046,6 +4048,35 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, 
struct ether_addr *addr)
ixgbe_add_rar(dev, addr, 0, 0);
 }

+int
+rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf, struct ether_addr 
*mac_addr)
+{
+   struct ixgbe_hw *hw;
+   struct ixgbe_vf_info *vfinfo;
+   int rar_entry;
+   uint8_t *new_mac = (uint8_t *)(mac_addr);
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+   dev = _eth_devices[port];
+   rte_eth_dev_info_get(port, _info);
+
+   if (vf >= dev_info.max_vfs)
+   return -EINVAL;
+
+   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
+   rar_entry = hw->mac.num_rar_entries - (vf + 1);
+
+   if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) {
+   rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 
ETHER_ADDR_LEN);
+   return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, 
IXGBE_RAH_AV);
+   }
+   return -EINVAL;
+}
+
 static int
 ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
@@ -4639,6 +4670,215 @@ ixgbe_set_pool_vlan_filter(struct rte_eth_dev *dev, 
uint16_t vlan,
return ret;
 }

+int
+rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
+{
+   struct ixgbe_hw *hw;
+   struct ixgbe_mac_info *mac;
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+   dev = _eth_devices[port];
+   rte_eth_dev_info_get(port, _info);
+
+   if (vf >= dev_info.max_vfs)
+   return -EINVAL;
+
+   if (on > 1)
+   return -EINVAL;
+
+   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   mac = >mac;
+
+   mac->ops.set_vlan_anti_spoofing(hw, on, vf);
+
+   return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
+{
+   struct ixgbe_hw *hw;
+   struct ixgbe_mac_info *mac;
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+   dev = _eth_devices[port];
+   rte_eth_dev_info_get(port, _info);
+
+   if (vf >= dev_info.max_vfs)
+   return -EINVAL;
+
+   if (on > 1)
+   return -EINVAL;
+
+   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   mac = >mac;
+   mac->ops.set_mac_anti_spoofing(hw, on, vf);
+
+   return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on)
+{
+   struct ixgbe_hw *hw;
+   uint32_t ctrl;
+   struct rte_eth_dev *dev;
+   st

[dpdk-dev] [PATCH v9 0/2] add API's for VF management

2016-10-12 Thread Bernard Iremonger
This patchset contains new DPDK API's for use
with the Virtual Function Daemon (VFD).

The need to configure and manage VF's on a NIC has grown to the
point where a DPDK based tool, VFD, has been developed to do this.

This patch set adds API extensions to DPDK for VF configuration.

Eight new API's have been added for the Intel 82559 NIC.

Changes have been made to testpmd to facilitate testing of the new API's.
The testpmd documentation has been updated to document the testpmd changes.

Changes in v8:
rebase to latest master branch.
fix testpmd Makefile.

Changes in v8:
rebase to latest master branch.
add new API's to testpmd help command.
modify testpmd  Makefile to build with and without ixgbe PMD,
in shared library mode and default mode.

Changes in v7:
rebase to latest master branch.
minor changes to ixgbe PMD following internal review.

Changes in v6:
rebase to latest master branch.
fix ixgbe makefile.
move set_vf_vlan_stripq function from ethdev to ixgbe PMD.
revise testpmd command for set_vf_vlan_stripq.

Changes in v5:
rebase to latest master branch.
remove new API's from eth_dev_ops structure.
add public API's to ixgbe PMD.
revise testpmd commands for new API's

Changes in v4:
The rte_eth_dev_vf_ping API has been dropped as it is a work around for a bug.
The rte_eth_dev_set_vf_vlan_strip API has been renamed to
rte_eth_dev_set_vf_vlan_stripq.

Changes in v3:
rebase to latest master branch.
drop patches for callback functions
revise VF id checks in new librte_ether functions
revise testpmd commands for new API's

Changes in V2:
rebase to latest master branch.
fix compile  error with clang.
Bernard Iremonger (2):
  net/ixgbe: add API's for VF management
  app/test_pmd: add tests for new API's

 app/test-pmd/Makefile   |   2 +
 app/test-pmd/cmdline.c  | 699 +++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  62 ++-
 drivers/net/ixgbe/Makefile  |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c| 240 ++
 drivers/net/ixgbe/rte_pmd_ixgbe.h   | 182 
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  13 +
 7 files changed, 1197 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/ixgbe/rte_pmd_ixgbe.h

-- 
2.9.0



[dpdk-dev] [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 Thread Bernard Iremonger
add test for set vf vlan anti spoof
add test for set vf mac anti spoof
add test for set vf vlan stripq
add test for set vf vlan insert
add test for set tx loopback
add test for set all queues drop enable bit
add test for set vf split drop enable bit
add test for set vf mac address
add new API's to testpmd help command.

add new API's to the testpmd guide

modify Makefile, add library rte_pmd_ixgbe to LDLIBS.

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/Makefile   |  11 +
 app/test-pmd/cmdline.c  | 699 +++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  62 ++-
 3 files changed, 768 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 2a0b5a5..472a016 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -58,6 +58,17 @@ SRCS-y += csumonly.c
 SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c

+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
+endif
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+endif
+
+
 CFLAGS_cmdline.o := -D_GNU_SOURCE

 # this application needs libraries first
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a1da8b8..41c7acf 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -87,7 +87,9 @@
 #ifdef RTE_LIBRTE_PMD_BOND
 #include 
 #endif
-
+#ifdef RTE_LIBRTE_IXGBE_PMD
+#include 
+#endif
 #include "testpmd.h"

 static struct cmdline *testpmd_cl;
@@ -260,12 +262,37 @@ static void cmd_help_long_parsed(void *parsed_result,
"set portlist (x[,y]*)\n"
"Set the list of forwarding ports.\n\n"

+#ifdef RTE_LIBRTE_IXGBE_PMD
+   "set tx loopback (port_id) (on|off)\n"
+   "Enable or disable tx loopback.\n\n"
+
+   "set all queues drop (port_id) (on|off)\n"
+   "Set drop enable bit for all queues.\n\n"
+
+   "set vf split drop (port_id) (vf_id) (on|off)\n"
+   "Set split drop enable bit for a VF from the 
PF.\n\n"
+
+   "set vf mac antispoof (port_id) (vf_id) (on|off).\n"
+   "Set MAC antispoof for a VF from the PF.\n\n"
+#endif
+
"vlan set strip (on|off) (port_id)\n"
"Set the VLAN strip on a port.\n\n"

"vlan set stripq (on|off) (port_id,queue_id)\n"
"Set the VLAN strip for a queue on a port.\n\n"

+#ifdef RTE_LIBRTE_IXGBE_PMD
+   "set vf vlan stripq (port_id) (vf_id) (on|off)\n"
+   "Set the VLAN strip for all queues in a pool for a 
VF from the PF.\n\n"
+
+   "set vf vlan insert (port_id) (vf_id) (on|off)\n"
+   "Set VLAN insert for a VF from the PF.\n\n"
+
+   "set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
+   "Set VLAN antispoof for a VF from the PF.\n\n"
+#endif
+
"vlan set filter (on|off) (port_id)\n"
"Set the VLAN filter on a port.\n\n"

@@ -359,6 +386,11 @@ static void cmd_help_long_parsed(void *parsed_result,
"mac_addr add port (port_id) vf (vf_id) (mac_address)\n"
"Add a MAC address for a VF on the port.\n\n"

+#ifdef RTE_LIBRTE_IXGBE_PMD
+   "set vf mac addr (port_id) (vf_id) 
(XX:XX:XX:XX:XX:XX)\n"
+   "Set the MAC address for a VF from the PF.\n\n"
+#endif
+
"set port (port_id) uta (mac_address|all) (on|off)\n"
"Add/Remove a or all unicast hash filter(s)"
"from port X.\n\n"
@@ -10700,6 +10732,661 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
NULL,
},
 };
+#ifdef RTE_LIBRTE_IXGBE_PMD
+
+/* vf vlan anti spoof configuration */
+
+/* Common result structure for vf vlan anti spoof */
+struct cmd_vf_vlan_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t vlan;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf vlan anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_resu

[dpdk-dev] [PATCH v8 1/2] net/ixgbe: add API's for VF management

2016-10-12 Thread Bernard Iremonger
Add API's to configure and manage VF's on an Intel 82559 NIC.

add rte_pmd_ixgbe_set_vf_vlan_anti_spoof function.
add rte_pmd_ixgbe_set_vf_mac_anti_spoof function.
add rte_pmd_ixgbe_set_vf_stripq function.

Signed-off-by: Alex Zelezniak 

add rte_pmd_ixgbe_set_vf_vlan_insert function.
add rte_pmd_ixgbe_set_tx_loopback function.
add rte_pmd_ixgbe_set_all_queues_drop function.
add rte_pmd_ixgbe_set_vf_split_drop_en function.
add rte_pmd_ixgbe_set_vf_mac_addr function.

Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/Makefile  |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c| 240 
 drivers/net/ixgbe/rte_pmd_ixgbe.h   | 182 +
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  13 ++
 4 files changed, 438 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ixgbe/rte_pmd_ixgbe.h

diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile
index a6c71f3..94ddc7b 100644
--- a/drivers/net/ixgbe/Makefile
+++ b/drivers/net/ixgbe/Makefile
@@ -1,6 +1,6 @@
 #   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
@@ -119,6 +119,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bypass.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_82599_bypass.c
 endif

+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)-include := rte_pmd_ixgbe.h

 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal lib/librte_ether
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 6b3d4fa..35281f9 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -72,6 +72,8 @@
 #include "base/ixgbe_phy.h"
 #include "ixgbe_regs.h"

+#include "rte_pmd_ixgbe.h"
+
 /*
  * High threshold controlling when to start sending XOFF frames. Must be at
  * least 8 bytes less than receive packet buffer size. This value is in units
@@ -4046,6 +4048,35 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, 
struct ether_addr *addr)
ixgbe_add_rar(dev, addr, 0, 0);
 }

+int
+rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf, struct ether_addr 
*mac_addr)
+{
+   struct ixgbe_hw *hw;
+   struct ixgbe_vf_info *vfinfo;
+   int rar_entry;
+   uint8_t *new_mac = (uint8_t *)(mac_addr);
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+   dev = _eth_devices[port];
+   rte_eth_dev_info_get(port, _info);
+
+   if (vf >= dev_info.max_vfs)
+   return -EINVAL;
+
+   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
+   rar_entry = hw->mac.num_rar_entries - (vf + 1);
+
+   if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) {
+   rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 
ETHER_ADDR_LEN);
+   return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, 
IXGBE_RAH_AV);
+   }
+   return -EINVAL;
+}
+
 static int
 ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
@@ -4639,6 +4670,215 @@ ixgbe_set_pool_vlan_filter(struct rte_eth_dev *dev, 
uint16_t vlan,
return ret;
 }

+int
+rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
+{
+   struct ixgbe_hw *hw;
+   struct ixgbe_mac_info *mac;
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+   dev = _eth_devices[port];
+   rte_eth_dev_info_get(port, _info);
+
+   if (vf >= dev_info.max_vfs)
+   return -EINVAL;
+
+   if (on > 1)
+   return -EINVAL;
+
+   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   mac = >mac;
+
+   mac->ops.set_vlan_anti_spoofing(hw, on, vf);
+
+   return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
+{
+   struct ixgbe_hw *hw;
+   struct ixgbe_mac_info *mac;
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+   dev = _eth_devices[port];
+   rte_eth_dev_info_get(port, _info);
+
+   if (vf >= dev_info.max_vfs)
+   return -EINVAL;
+
+   if (on > 1)
+   return -EINVAL;
+
+   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   mac = >mac;
+   mac->ops.set_mac_anti_spoofing(hw, on, vf);
+
+   return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on)
+{
+   struct ixgbe_hw *hw;
+   uint32_t ctrl;
+   struct rte_eth_dev *dev;
+   st

[dpdk-dev] [PATCH v8 0/2] add API's for VF management

2016-10-12 Thread Bernard Iremonger
This patchset contains new DPDK API's for use
with the Virtual Function Daemon (VFD).

The need to configure and manage VF's on a NIC has grown to the
point where a DPDK based tool, VFD, has been developed to do this.

This patch set adds API extensions to DPDK for VF configuration.

Eight new API's have been added for the Intel 82559 NIC.

Changes have been made to testpmd to facilitate testing of the new API's.
The testpmd documentation has been updated to document the testpmd changes.

Changes in v8:
rebase to latest master branch.
add new API's to testpmd help command.
modify testpmd  Makefile to build with and without ixgbe PMD,
in shared library mode and default mode.

Changes in v7:
rebase to latest master branch.
minor changes to ixgbe PMD following internal review.

Changes in v6:
rebase to latest master branch.
fix ixgbe makefile.
move set_vf_vlan_stripq function from ethdev to ixgbe PMD.
revise testpmd command for set_vf_vlan_stripq.

Changes in v5:
rebase to latest master branch.
remove new API's from eth_dev_ops structure.
add public API's to ixgbe PMD.
revise testpmd commands for new API's

Changes in v4:
The rte_eth_dev_vf_ping API has been dropped as it is a work around for a bug.
The rte_eth_dev_set_vf_vlan_strip API has been renamed to
rte_eth_dev_set_vf_vlan_stripq.

Changes in v3:
rebase to latest master branch.
drop patches for callback functions
revise VF id checks in new librte_ether functions
revise testpmd commands for new API's

Changes in V2:
rebase to latest master branch.
fix compile  error with clang.

Bernard Iremonger (2):
  net/ixgbe: add API's for VF management
  app/test_pmd: add tests for new API's

 app/test-pmd/Makefile   |  11 +
 app/test-pmd/cmdline.c  | 699 +++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  62 ++-
 drivers/net/ixgbe/Makefile  |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c| 240 ++
 drivers/net/ixgbe/rte_pmd_ixgbe.h   | 182 
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  13 +
 7 files changed, 1206 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/ixgbe/rte_pmd_ixgbe.h

-- 
2.9.0



[dpdk-dev] [PATCH v8 2/2] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-10-10 Thread Bernard Iremonger
call _rte_eth_dev_callback_process from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform
the function.

If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue,
if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

Signed-off-by: Alex Zelezniak 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_pf.c  | 42 +--
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 20 +++
 2 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 56393ff..26395e4 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -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
@@ -51,6 +51,7 @@

 #include "base/ixgbe_common.h"
 #include "ixgbe_ethdev.h"
+#include "rte_pmd_ixgbe.h"

 #define IXGBE_MAX_VFTA (128)
 #define IXGBE_VF_MSG_SIZE_DEFAULT 1
@@ -660,6 +661,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
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);
+   struct rte_pmd_ixgbe_mb_event_param cb_param;

retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
if (retval) {
@@ -674,27 +676,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t 
vf)
/* flush the ack before we write any messages back */
IXGBE_WRITE_FLUSH(hw);

+   /**
+* initialise structure to send to user application
+* will return response from user in retval field
+*/
+   cb_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
+   cb_param.vfid = vf;
+   cb_param.msg_type = msgbuf[0] & 0x;
+   cb_param.msg = (void *)msgbuf;
+
/* perform VF reset */
if (msgbuf[0] == IXGBE_VF_RESET) {
int ret = ixgbe_vf_reset(dev, vf, msgbuf);

vfinfo[vf].clear_to_send = true;
+
+   /* notify application about VF reset */
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, 
_param);
return ret;
}

+   /**
+* ask user application if we allowed to perform those functions
+* if we get cb_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED
+* then business as usual,
+* if 0, do nothing and send ACK to VF
+* if cb_param.retval > 1, do nothing and send NAK to VF
+*/
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, _param);
+
+   retval = cb_param.retval;
+
/* check & process VF to PF mailbox message */
switch ((msgbuf[0] & 0x)) {
case IXGBE_VF_SET_MAC_ADDR:
-   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_MULTICAST:
-   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_LPE:
-   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_VLAN:
-   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
break;
case IXGBE_VF_API_NEGOTIATE:
retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
@@ -704,7 +733,8 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE;
break;
case IXGBE_VF_UPDATE_XCAST_MODE:
-   retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
break;
default:
PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h 
b/drivers/net/ixgbe/rte_pmd_ixgbe.h
index 2689668..74b64ad 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.h
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h
@@ -179,4 +179,24 @@ int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, 
uint16_t vf, uint8_t on);

[dpdk-dev] [PATCH v8 1/2] librte_ether: modify internal callback function

2016-10-10 Thread Bernard Iremonger
add cb_arg parameter to the _rte_eth_dev_callback_process function.

Adding a parameter to this function allows passing information
to the application when an eth device event occurs such as
a VF to PF message.
This allows the application to decide if a particular function
is permitted.

drivers/net: add parameter to callback process function

add parameter to call of _rte_eth_dev_callback_process function
in the following PMD's:

net/bonding
net/e1000
net/i40e
net/enic
net/ixgbe
net/mlx4
net/mlx5
net/nfp
net/thunderx
net/vhost
net/virtio

app/test: add parameter to callback process function
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
Signed-off-by: Alex Zelezniak 
---
 app/test/virtual_pmd.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 +++---
 drivers/net/e1000/em_ethdev.c  |  2 +-
 drivers/net/e1000/igb_ethdev.c |  4 ++--
 drivers/net/enic/enic_main.c   |  2 +-
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c  |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c   |  4 ++--
 drivers/net/mlx4/mlx4.c|  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c |  4 ++--
 drivers/net/nfp/nfp_net.c  |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c|  2 +-
 drivers/net/vhost/rte_eth_vhost.c  |  6 +++---
 drivers/net/virtio/virtio_ethdev.c |  2 +-
 lib/librte_ether/rte_ethdev.c  |  5 -
 lib/librte_ether/rte_ethdev.h  | 12 +++-
 16 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 4831113..65b44c6 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -485,7 +485,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_t 
port_id,

vrtl_eth_dev->data->dev_link.link_status = link_status;

-   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 int
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index fb4050c..8d510e3 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1958,7 +1958,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
return;

_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 void
@@ -2079,7 +2079,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum 
rte_eth_event_type type,
(void *)bonded_eth_dev);
else
_rte_eth_dev_callback_process(bonded_eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);

} else {
if (internals->link_down_delay_ms > 0)
@@ -2088,7 +2088,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum 
rte_eth_event_type type,
(void *)bonded_eth_dev);
else
_rte_eth_dev_callback_process(bonded_eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
}
}
 }
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index f767e1c..e13e858 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1599,7 +1599,7 @@ eth_em_interrupt_handler(__rte_unused struct 
rte_intr_handle *handle,

eth_em_interrupt_get_status(dev);
eth_em_interrupt_action(dev);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 static int
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 5a1a83e..d9ab2df 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2683,7 +2683,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_TCTL, tctl);
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
E1000_WRITE_FLUSH(hw);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
}

return 0;
@@ -2743,7 +2743,7 @@ void igbvf_mbx_process(struct rte_eth_dev *dev)

/* PF reset VF event */
if (in_msg == E1000_PF_CONTROL_MSG)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, 
NULL);
 }

 static int
diff --git a/drivers/net/enic/e

[dpdk-dev] [PATCH v8 0/2] modify callback for VF management

2016-10-10 Thread Bernard Iremonger
This patchset modifies the callback function for VF management.

A third parameter has been added to the _rte_eth_dev_callback_process
function. All references to this function have been updated.
Changes have been made to the ixgbe_rcv_msg_from_vf function to
use the new callback parameter.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16430/
[dpdk-dev,v7,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset,
but were dropped from the v3 patchset.

Changes in v8:
Rebased to latest master.
Improve description of struct rte_pmd_ixgbe_mb_event_param,
rename  member user_data to msg.

Changes in v7:
Rebased to latest master.
Move references to _rte_eth_dev_callback_process in ixgbe patch
to librte_ether patch.
Revised description of callback parameter.

Changes in v6:
Rebased to latest master.
Squashed patches down to two patches.
Renamed parameter to _rte_eth_dev_callback_process function.
Updated API descriptions.

Changes in v5:
Rebased to latest master.
Added parameter to the _rte_eth_dev_callback_process function
Removed two new callback functions which were added previously.
Updated all calls to the _rte_eth_dev_callback_process function.

Changes in v4:
Rebased to latest master.
Moved the callback parameter structure from the ethdev to the ixgbe PMD.

Changes in v3:
Rebased to latest master.
Submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Changes in v2:
Rebased to latest master.

Bernard Iremonger (2):
  librte_ether: modify internal callback function
  net/ixgbe: add callback to user app on VF to PF mbox msg

 app/test/virtual_pmd.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 ++---
 drivers/net/e1000/em_ethdev.c  |  2 +-
 drivers/net/e1000/igb_ethdev.c |  4 ++--
 drivers/net/enic/enic_main.c   |  2 +-
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c  |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c   |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c   | 42 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.h  | 20 
 drivers/net/mlx4/mlx4.c|  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c |  4 ++--
 drivers/net/nfp/nfp_net.c  |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c|  2 +-
 drivers/net/vhost/rte_eth_vhost.c  |  6 ++---
 drivers/net/virtio/virtio_ethdev.c |  2 +-
 lib/librte_ether/rte_ethdev.c  |  5 +++-
 lib/librte_ether/rte_ethdev.h  | 12 +-
 18 files changed, 94 insertions(+), 31 deletions(-)

-- 
2.9.0



[dpdk-dev] [PATCH v7 2/2] app/test_pmd: add tests for new API's

2016-10-07 Thread Bernard Iremonger
add test for set vf vlan anti spoof
add test for set vf mac anti spoof
add test for set vf vlan stripq
add test for set vf vlan insert
add test for set tx loopback
add test for set all queues drop enable bit
add test for set vf split drop enable bit
add test for set vf mac address
add new API's to the testpmd guide

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/cmdline.c  | 675 
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  62 ++-
 2 files changed, 734 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 17d238f..d26db62 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -87,6 +87,7 @@
 #ifdef RTE_LIBRTE_PMD_BOND
 #include 
 #endif
+#include 

 #include "testpmd.h"

@@ -10585,6 +10586,672 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
},
 };

+/* vf vlan anti spoof configuration */
+
+/* Common result structure for vf vlan anti spoof */
+struct cmd_vf_vlan_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t vlan;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf vlan anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+set, "set");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vf =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vf, "vf");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vlan =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vlan, "vlan");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_antispoof =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+antispoof, "antispoof");
+cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_port_id =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_vf_id =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_on_off =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+on_off, "on#off");
+
+static void
+cmd_set_vf_vlan_anti_spoof_parsed(
+   void *parsed_result,
+   __attribute__((unused)) struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   struct cmd_vf_vlan_anti_spoof_result *res = parsed_result;
+   int ret = 0;
+   int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+   ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, res->vf_id, 
is_on);
+   switch (ret) {
+   case 0:
+   break;
+   case -EINVAL:
+   printf("invalid vf_id %d\n", res->vf_id);
+   break;
+   case -ENODEV:
+   printf("invalid port_id %d\n", res->port_id);
+   break;
+   default:
+   printf("programming error: (%s)\n", strerror(-ret));
+   }
+}
+
+cmdline_parse_inst_t cmd_set_vf_vlan_anti_spoof = {
+   .f = cmd_set_vf_vlan_anti_spoof_parsed,
+   .data = NULL,
+   .help_str = "set vf vlan antispoof port_id vf_id on|off",
+   .tokens = {
+   (void *)_vf_vlan_anti_spoof_set,
+   (void *)_vf_vlan_anti_spoof_vf,
+   (void *)_vf_vlan_anti_spoof_vlan,
+   (void *)_vf_vlan_anti_spoof_antispoof,
+   (void *)_vf_vlan_anti_spoof_port_id,
+   (void *)_vf_vlan_anti_spoof_vf_id,
+   (void *)_vf_vlan_anti_spoof_on_off,
+   NULL,
+   },
+};
+
+/* vf mac anti spoof configuration */
+
+/* Common result structure for vf mac anti spoof */
+struct cmd_vf_mac_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t mac;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf mac anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+set, "set");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_vf =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+vf, "vf");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_mac =
+

[dpdk-dev] [PATCH v7 1/2] net/ixgbe: add API's for VF management

2016-10-07 Thread Bernard Iremonger
Add API's to configure and manage VF's on an Intel 82559 NIC.

add rte_pmd_ixgbe_set_vf_vlan_anti_spoof function.
add rte_pmd_ixgbe_set_vf_mac_anti_spoof function.
add rte_pmd_ixgbe_set_vf_stripq function.

Signed-off-by: Alex Zelezniak 

add rte_pmd_ixgbe_set_vf_vlan_insert function.
add rte_pmd_ixgbe_set_tx_loopback function.
add rte_pmd_ixgbe_set_all_queues_drop function.
add rte_pmd_ixgbe_set_vf_split_drop_en function.
add rte_pmd_ixgbe_set_vf_mac_addr function.

Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/Makefile  |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c| 240 
 drivers/net/ixgbe/rte_pmd_ixgbe.h   | 182 +
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  13 ++
 4 files changed, 438 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ixgbe/rte_pmd_ixgbe.h

diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile
index a6c71f3..94ddc7b 100644
--- a/drivers/net/ixgbe/Makefile
+++ b/drivers/net/ixgbe/Makefile
@@ -1,6 +1,6 @@
 #   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
@@ -119,6 +119,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bypass.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_82599_bypass.c
 endif

+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)-include := rte_pmd_ixgbe.h

 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal lib/librte_ether
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 6b3d4fa..35281f9 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -72,6 +72,8 @@
 #include "base/ixgbe_phy.h"
 #include "ixgbe_regs.h"

+#include "rte_pmd_ixgbe.h"
+
 /*
  * High threshold controlling when to start sending XOFF frames. Must be at
  * least 8 bytes less than receive packet buffer size. This value is in units
@@ -4046,6 +4048,35 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, 
struct ether_addr *addr)
ixgbe_add_rar(dev, addr, 0, 0);
 }

+int
+rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf, struct ether_addr 
*mac_addr)
+{
+   struct ixgbe_hw *hw;
+   struct ixgbe_vf_info *vfinfo;
+   int rar_entry;
+   uint8_t *new_mac = (uint8_t *)(mac_addr);
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+   dev = _eth_devices[port];
+   rte_eth_dev_info_get(port, _info);
+
+   if (vf >= dev_info.max_vfs)
+   return -EINVAL;
+
+   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
+   rar_entry = hw->mac.num_rar_entries - (vf + 1);
+
+   if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) {
+   rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 
ETHER_ADDR_LEN);
+   return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, 
IXGBE_RAH_AV);
+   }
+   return -EINVAL;
+}
+
 static int
 ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
@@ -4639,6 +4670,215 @@ ixgbe_set_pool_vlan_filter(struct rte_eth_dev *dev, 
uint16_t vlan,
return ret;
 }

+int
+rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
+{
+   struct ixgbe_hw *hw;
+   struct ixgbe_mac_info *mac;
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+   dev = _eth_devices[port];
+   rte_eth_dev_info_get(port, _info);
+
+   if (vf >= dev_info.max_vfs)
+   return -EINVAL;
+
+   if (on > 1)
+   return -EINVAL;
+
+   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   mac = >mac;
+
+   mac->ops.set_vlan_anti_spoofing(hw, on, vf);
+
+   return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
+{
+   struct ixgbe_hw *hw;
+   struct ixgbe_mac_info *mac;
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+   dev = _eth_devices[port];
+   rte_eth_dev_info_get(port, _info);
+
+   if (vf >= dev_info.max_vfs)
+   return -EINVAL;
+
+   if (on > 1)
+   return -EINVAL;
+
+   hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   mac = >mac;
+   mac->ops.set_mac_anti_spoofing(hw, on, vf);
+
+   return 0;
+}
+
+int
+rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on)
+{
+   struct ixgbe_hw *hw;
+   uint32_t ctrl;
+   struct rte_eth_dev *dev;
+   st

[dpdk-dev] [PATCH v7 0/2] add API's for VF management

2016-10-07 Thread Bernard Iremonger
This patchset contains new DPDK API's for use
with the Virtual Function Daemon (VFD).

The need to configure and manage VF's on a NIC has grown to the
point where a DPDK based tool, VFD, has been developed to do this.

This patch set adds API extensions to DPDK for VF configuration.

Eight new API's have been added for the Intel 82559 NIC.

Changes have been made to testpmd to facilitate testing of the new API's.
The testpmd documentation has been updated to document the testpmd changes.

Changes in v7:
rebase to latest master branch.
minor changes to ixgbe PMD following internal review.

Changes in v6:
rebase to latest master branch.
fix ixgbe makefile.
move set_vf_vlan_stripq function from ethdev to ixgbe PMD.
revise testpmd command for set_vf_vlan_stripq.

Changes in v5:
rebase to latest master branch.
remove new API's from eth_dev_ops structure.
add public API's to ixgbe PMD.
revise testpmd commands for new API's

Changes in v4:
The rte_eth_dev_vf_ping API has been dropped as it is a work around for a bug.
The rte_eth_dev_set_vf_vlan_strip API has been renamed to
rte_eth_dev_set_vf_vlan_stripq.

Changes in v3:
rebase to latest master branch.
drop patches for callback functions
revise VF id checks in new librte_ether functions
revise testpmd commands for new API's

Changes in V2:
rebase to latest master branch.
fix compile  error with clang.

Bernard Iremonger (2):
  net/ixgbe: add API's for VF management
  app/test_pmd: add tests for new API's

 app/test-pmd/cmdline.c  | 675 
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  62 ++-
 drivers/net/ixgbe/Makefile  |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c| 240 ++
 drivers/net/ixgbe/rte_pmd_ixgbe.h   | 182 
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  13 +
 6 files changed, 1172 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/ixgbe/rte_pmd_ixgbe.h

-- 
2.9.0



[dpdk-dev] [PATCH v6 2/2] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-10-06 Thread Bernard Iremonger
call _rte_eth_dev_callback_process from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform
the function.
If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue,
if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

Signed-off-by: Alex Zelezniak 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c  |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c  | 42 +--
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 17 
 3 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 55a82d3..91db2c3 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3559,7 +3559,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
ixgbe_dev_link_update(dev, 0);
intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
ixgbe_dev_link_status_print(dev);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
}

PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);
@@ -7525,7 +7525,7 @@ static void ixgbevf_mbx_process(struct rte_eth_dev *dev)

/* PF reset VF event */
if (in_msg == IXGBE_PF_CONTROL_MSG)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, 
NULL);
 }

 static int
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 56393ff..2a177b8 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -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
@@ -51,6 +51,7 @@

 #include "base/ixgbe_common.h"
 #include "ixgbe_ethdev.h"
+#include "rte_pmd_ixgbe.h"

 #define IXGBE_MAX_VFTA (128)
 #define IXGBE_VF_MSG_SIZE_DEFAULT 1
@@ -660,6 +661,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
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);
+   struct rte_pmd_ixgbe_mb_event_param cb_param;

retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
if (retval) {
@@ -674,27 +676,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t 
vf)
/* flush the ack before we write any messages back */
IXGBE_WRITE_FLUSH(hw);

+   /**
+* initialise structure to send to user application
+* will return response from user in retval field
+*/
+   cb_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
+   cb_param.vfid = vf;
+   cb_param.msg_type = msgbuf[0] & 0x;
+   cb_param.userdata = (void *)msgbuf;
+
/* perform VF reset */
if (msgbuf[0] == IXGBE_VF_RESET) {
int ret = ixgbe_vf_reset(dev, vf, msgbuf);

vfinfo[vf].clear_to_send = true;
+
+   /* notify application about VF reset */
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, 
_param);
return ret;
}

+   /**
+* ask user application if we allowed to perform those functions
+* if we get cb_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED
+* then business as usual,
+* if 0, do nothing and send ACK to VF
+* if cb_param.retval > 1, do nothing and send NAK to VF
+*/
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, _param);
+
+   retval = cb_param.retval;
+
/* check & process VF to PF mailbox message */
switch ((msgbuf[0] & 0x)) {
case IXGBE_VF_SET_MAC_ADDR:
-   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_MULTICAST:
-   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_LPE:
-   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_VLAN:
-   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+  

[dpdk-dev] [PATCH v6 1/2] librte_ether: modify internal callback function

2016-10-06 Thread Bernard Iremonger
add cb_arg parameter to the _rte_eth_dev_callback_process function.

Adding a parameter to this function allows passing information
to the application when an eth device event occurs such as
a VF to PF message.
This allows the application to decide if a particular function
is permitted.

drivers/net: add parameter to callback process function

add parameter to call of _rte_eth_dev_callback_process function
in the following PMD's:

net/bonding
net/e1000
net/i40e
net/mlx4
net/mlx5
net/nfp
net/thunderx
net/vhost
net/virtio
net/enic

app/test: add parameter to callback process function
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
Signed-off-by: Alex Zelezniak 
---
 app/test/virtual_pmd.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 +++---
 drivers/net/e1000/em_ethdev.c  |  2 +-
 drivers/net/e1000/igb_ethdev.c |  4 ++--
 drivers/net/enic/enic_main.c   |  2 +-
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c  |  2 +-
 drivers/net/mlx4/mlx4.c|  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c |  4 ++--
 drivers/net/nfp/nfp_net.c  |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c|  2 +-
 drivers/net/vhost/rte_eth_vhost.c  |  6 +++---
 drivers/net/virtio/virtio_ethdev.c |  2 +-
 lib/librte_ether/rte_ethdev.c  |  5 -
 lib/librte_ether/rte_ethdev.h  | 12 +++-
 15 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 4831113..65b44c6 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -485,7 +485,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_t 
port_id,

vrtl_eth_dev->data->dev_link.link_status = link_status;

-   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 int
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index fb4050c..8d510e3 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1958,7 +1958,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
return;

_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 void
@@ -2079,7 +2079,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum 
rte_eth_event_type type,
(void *)bonded_eth_dev);
else
_rte_eth_dev_callback_process(bonded_eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);

} else {
if (internals->link_down_delay_ms > 0)
@@ -2088,7 +2088,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum 
rte_eth_event_type type,
(void *)bonded_eth_dev);
else
_rte_eth_dev_callback_process(bonded_eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
}
}
 }
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index f767e1c..e13e858 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1599,7 +1599,7 @@ eth_em_interrupt_handler(__rte_unused struct 
rte_intr_handle *handle,

eth_em_interrupt_get_status(dev);
eth_em_interrupt_action(dev);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 static int
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 5a1a83e..d9ab2df 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2683,7 +2683,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_TCTL, tctl);
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
E1000_WRITE_FLUSH(hw);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
}

return 0;
@@ -2743,7 +2743,7 @@ void igbvf_mbx_process(struct rte_eth_dev *dev)

/* PF reset VF event */
if (in_msg == E1000_PF_CONTROL_MSG)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, 
NULL);
 }

 static int
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 15a05b4..fb

[dpdk-dev] [PATCH v6 0/2] modify callback for VF management

2016-10-06 Thread Bernard Iremonger
This patchset modifies the callback function for VF management.

A third parameter has been added to the _rte_eth_dev_callback_process
function. All references to this function have been updated.
Changes have been made to the ixgbe_rcv_msg_from_vf function to
use the new callback parameter.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16296/
[dpdk-dev,v6,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset,
but were dropped from the v3 patchset.

Changes in v5:
Rebased to latest master.
Squashed patches down to two patches.
Renamed parameter to _rte_eth_dev_callback_process function.
Updated API descriptions.

Changes in v5:
Rebased to latest master.
Added parameter to the _rte_eth_dev_callback_process function
Removed two new callback functions which were added previously.
Updated all calls to the _rte_eth_dev_callback_process function.

Changes in v4:
Rebased to latest master.
Moved the callback parameter structure from the ethdev to the ixgbe PMD.

Changes in v3:
Rebased to latest master.
Submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Changes in v2:
Rebased to latest master.




















Bernard Iremonger (2):
  librte_ether: modify internal callback function
  net/ixgbe: add callback to user app on VF to PF mbox msg

 app/test/virtual_pmd.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 ++---
 drivers/net/e1000/em_ethdev.c  |  2 +-
 drivers/net/e1000/igb_ethdev.c |  4 ++--
 drivers/net/enic/enic_main.c   |  2 +-
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c  |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c   |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c   | 42 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.h  | 17 ++
 drivers/net/mlx4/mlx4.c|  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c |  4 ++--
 drivers/net/nfp/nfp_net.c  |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c|  2 +-
 drivers/net/vhost/rte_eth_vhost.c  |  6 ++---
 drivers/net/virtio/virtio_ethdev.c |  2 +-
 lib/librte_ether/rte_ethdev.c  |  5 +++-
 lib/librte_ether/rte_ethdev.h  | 12 +-
 18 files changed, 91 insertions(+), 31 deletions(-)

-- 
2.9.0



[dpdk-dev] [PATCH v5 13/13] net/enic: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/enic/enic_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 15a05b4..fb72491 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -436,7 +436,7 @@ enic_intr_handler(__rte_unused struct rte_intr_handle 
*handle,
vnic_intr_return_all_credits(>intr);

enic_link_update(enic);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
enic_log_q_error(enic);
 }

-- 
2.9.0



[dpdk-dev] [PATCH v5 12/13] net/virtio: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/virtio/virtio_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index b4dfc0a..2f0065a 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1103,7 +1103,7 @@ virtio_interrupt_handler(__rte_unused struct 
rte_intr_handle *handle,
if (isr & VIRTIO_PCI_ISR_CONFIG) {
if (virtio_dev_link_update(dev, 0) == 0)
_rte_eth_dev_callback_process(dev,
- RTE_ETH_EVENT_INTR_LSC);
+ RTE_ETH_EVENT_INTR_LSC, 
NULL);
}

 }
-- 
2.9.0



[dpdk-dev] [PATCH v5 11/13] net/vhost: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/vhost/rte_eth_vhost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c 
b/drivers/net/vhost/rte_eth_vhost.c
index 409e090..421cdba 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -559,7 +559,7 @@ new_device(int vid)

RTE_LOG(INFO, PMD, "New connection established\n");

-   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);

return 0;
 }
@@ -626,7 +626,7 @@ destroy_device(int vid)

RTE_LOG(INFO, PMD, "Connection closed\n");

-   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 static int
@@ -655,7 +655,7 @@ vring_state_changed(int vid, uint16_t vring, int enable)
RTE_LOG(INFO, PMD, "vring%u is %s\n",
vring, enable ? "enabled" : "disabled");

-   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE);
+   _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE, NULL);

return 0;
 }
-- 
2.9.0



[dpdk-dev] [PATCH v5 10/13] net/thunderx: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/thunderx/nicvf_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/thunderx/nicvf_ethdev.c 
b/drivers/net/thunderx/nicvf_ethdev.c
index b758c9f..c61e171 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -108,7 +108,7 @@ nicvf_interrupt(void *arg)
nicvf_set_eth_link_status(nic,
>eth_dev->data->dev_link);
_rte_eth_dev_callback_process(nic->eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
}

rte_eal_alarm_set(NICVF_INTR_POLL_INTERVAL_MS * 1000,
-- 
2.9.0



[dpdk-dev] [PATCH v5 09/13] net/nfp: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/nfp/nfp_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index d526f34..a2b9056 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1219,7 +1219,7 @@ nfp_net_dev_interrupt_delayed_handler(void *param)
struct rte_eth_dev *dev = (struct rte_eth_dev *)param;

nfp_net_link_update(dev, 0);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);

nfp_net_dev_link_status_print(dev);

-- 
2.9.0



[dpdk-dev] [PATCH v5 08/13] net/mlx5: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/mlx5/mlx5_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index bf4232a..c76e754 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1069,7 +1069,7 @@ mlx5_dev_link_status_handler(void *arg)
ret = priv_dev_link_status_handler(priv, dev);
priv_unlock(priv);
if (ret)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 /**
@@ -1092,7 +1092,7 @@ mlx5_dev_interrupt_handler(struct rte_intr_handle 
*intr_handle, void *cb_arg)
ret = priv_dev_link_status_handler(priv, dev);
priv_unlock(priv);
if (ret)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 /**
-- 
2.9.0



[dpdk-dev] [PATCH v5 07/13] net/mlx4: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/mlx4/mlx4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 1553b2e..3e57cca 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5448,7 +5448,7 @@ mlx4_dev_link_status_handler(void *arg)
ret = priv_dev_link_status_handler(priv, dev);
priv_unlock(priv);
if (ret)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 /**
@@ -5471,7 +5471,7 @@ mlx4_dev_interrupt_handler(struct rte_intr_handle 
*intr_handle, void *cb_arg)
ret = priv_dev_link_status_handler(priv, dev);
priv_unlock(priv);
if (ret)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 /**
-- 
2.9.0



[dpdk-dev] [PATCH v5 06/13] net/i40e: update call to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/i40e/i40e_ethdev.c| 4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 697800e..d947760 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5510,7 +5510,7 @@ i40e_dev_interrupt_delayed_handler(void *param)

/* handle the link up interrupt in an alarm callback */
i40e_dev_link_update(dev, 0);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);

i40e_pf_enable_irq0(hw);
rte_intr_enable(&(dev->pci_dev->intr_handle));
@@ -5594,7 +5594,7 @@ i40e_dev_interrupt_handler(__rte_unused struct 
rte_intr_handle *handle,
return;
else
_rte_eth_dev_callback_process(dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
}

 done:
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c 
b/drivers/net/i40e/i40e_ethdev_vf.c
index 34eb274..bd89cd9 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1341,7 +1341,7 @@ i40evf_handle_pf_event(__rte_unused struct rte_eth_dev 
*dev,
switch (pf_msg->event) {
case I40E_VIRTCHNL_EVENT_RESET_IMPENDING:
PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event\n");
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, 
NULL);
break;
case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event\n");
-- 
2.9.0



[dpdk-dev] [PATCH v5 05/13] net/e1000: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/e1000/em_ethdev.c  | 2 +-
 drivers/net/e1000/igb_ethdev.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index f767e1c..e13e858 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1599,7 +1599,7 @@ eth_em_interrupt_handler(__rte_unused struct 
rte_intr_handle *handle,

eth_em_interrupt_get_status(dev);
eth_em_interrupt_action(dev);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 static int
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 5a1a83e..d9ab2df 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2683,7 +2683,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev)
E1000_WRITE_REG(hw, E1000_TCTL, tctl);
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
E1000_WRITE_FLUSH(hw);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
}

return 0;
@@ -2743,7 +2743,7 @@ void igbvf_mbx_process(struct rte_eth_dev *dev)

/* PF reset VF event */
if (in_msg == E1000_PF_CONTROL_MSG)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, 
NULL);
 }

 static int
-- 
2.9.0



[dpdk-dev] [PATCH v5 04/13] net/bonding: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index 292086a..0913020 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1958,7 +1958,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
return;

_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
 }

 void
@@ -2079,7 +2079,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum 
rte_eth_event_type type,
(void *)bonded_eth_dev);
else
_rte_eth_dev_callback_process(bonded_eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);

} else {
if (internals->link_down_delay_ms > 0)
@@ -2088,7 +2088,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum 
rte_eth_event_type type,
(void *)bonded_eth_dev);
else
_rte_eth_dev_callback_process(bonded_eth_dev,
-   RTE_ETH_EVENT_INTR_LSC);
+   RTE_ETH_EVENT_INTR_LSC, NULL);
}
}
 }
-- 
2.9.0



[dpdk-dev] [PATCH v5 03/13] app/test: add parameter to callback process function

2016-10-06 Thread Bernard Iremonger
add parameter to call of _rte_eth_dev_callback_process function

Signed-off-by: Bernard Iremonger 
---
 app/test/virtual_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 4831113..65b44c6 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -485,7 +485,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_t 
port_id,

vrtl_eth_dev->data->dev_link.link_status = link_status;

-   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
 }

 int
-- 
2.9.0



[dpdk-dev] [PATCH v5 02/13] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-10-06 Thread Bernard Iremonger
call _rte_eth_dev_callback_process from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform
the function.
If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue,
if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

Signed-off-by: Alex Zelezniak 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c  |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c  | 42 +--
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 17 
 3 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 55a82d3..91db2c3 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3559,7 +3559,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
ixgbe_dev_link_update(dev, 0);
intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
ixgbe_dev_link_status_print(dev);
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, 
NULL);
}

PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);
@@ -7525,7 +7525,7 @@ static void ixgbevf_mbx_process(struct rte_eth_dev *dev)

/* PF reset VF event */
if (in_msg == IXGBE_PF_CONTROL_MSG)
-   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, 
NULL);
 }

 static int
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 56393ff..2a177b8 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -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
@@ -51,6 +51,7 @@

 #include "base/ixgbe_common.h"
 #include "ixgbe_ethdev.h"
+#include "rte_pmd_ixgbe.h"

 #define IXGBE_MAX_VFTA (128)
 #define IXGBE_VF_MSG_SIZE_DEFAULT 1
@@ -660,6 +661,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
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);
+   struct rte_pmd_ixgbe_mb_event_param cb_param;

retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
if (retval) {
@@ -674,27 +676,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t 
vf)
/* flush the ack before we write any messages back */
IXGBE_WRITE_FLUSH(hw);

+   /**
+* initialise structure to send to user application
+* will return response from user in retval field
+*/
+   cb_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
+   cb_param.vfid = vf;
+   cb_param.msg_type = msgbuf[0] & 0x;
+   cb_param.userdata = (void *)msgbuf;
+
/* perform VF reset */
if (msgbuf[0] == IXGBE_VF_RESET) {
int ret = ixgbe_vf_reset(dev, vf, msgbuf);

vfinfo[vf].clear_to_send = true;
+
+   /* notify application about VF reset */
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, 
_param);
return ret;
}

+   /**
+* ask user application if we allowed to perform those functions
+* if we get cb_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED
+* then business as usual,
+* if 0, do nothing and send ACK to VF
+* if cb_param.retval > 1, do nothing and send NAK to VF
+*/
+   _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, _param);
+
+   retval = cb_param.retval;
+
/* check & process VF to PF mailbox message */
switch ((msgbuf[0] & 0x)) {
case IXGBE_VF_SET_MAC_ADDR:
-   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_MULTICAST:
-   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_LPE:
-   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_VLAN:
-   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+  

[dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 Thread Bernard Iremonger
add parameter to the _rte_eth_dev_callback_process function.

Adding a parameter to this function allows passing information
to the application when an eth device event occurs such as
a VF to PF message.
This allows the application to decide if a particular function
is permitted.

Signed-off-by: Alex Zelezniak 
Signed-off-by: Bernard Iremonger 
---
 lib/librte_ether/rte_ethdev.c | 5 -
 lib/librte_ether/rte_ethdev.h | 7 ++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index c517e88..416ca77 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2508,7 +2508,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id,

 void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-   enum rte_eth_event_type event)
+   enum rte_eth_event_type event, void *param)
 {
struct rte_eth_dev_callback *cb_lst;
struct rte_eth_dev_callback dev_cb;
@@ -2519,6 +2519,9 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
continue;
dev_cb = *cb_lst;
cb_lst->active = 1;
+   if (param != NULL)
+   dev_cb.cb_arg = (void *) param;
+
rte_spinlock_unlock(_eth_dev_cb_lock);
dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
dev_cb.cb_arg);
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 7218b6f..9fb34ca 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3026,6 +3026,7 @@ enum rte_eth_event_type {
/**< queue state event (enabled/disabled) */
RTE_ETH_EVENT_INTR_RESET,
/**< reset interrupt event, sent to VF on PF reset */
+   RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
RTE_ETH_EVENT_MAX   /**< max value of this enum */
 };

@@ -3085,12 +3086,16 @@ int rte_eth_dev_callback_unregister(uint8_t port_id,
  *  Pointer to struct rte_eth_dev.
  * @param event
  *  Eth device interrupt event type.
+ * @param param
+ *  Parameter to pass back to user application.
+ *  Allows the user application to decide if a particular function
+ *  is permitted.
  *
  * @return
  *  void
  */
 void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-   enum rte_eth_event_type event);
+   enum rte_eth_event_type event, void *param);

 /**
  * When there is no rx packet coming in Rx Queue for a long time, we can
-- 
2.9.0



[dpdk-dev] [PATCH v5 00/13] modify callback for VF management

2016-10-06 Thread Bernard Iremonger
This patchset modifies the callback function for VF management.

A third parameter has been added to the _rte_eth_dev_callback_process
function. All references to this function have been updated.
Changes have been made to the ixgbe_rcv_msg_from_vf function to
use the new callback parameter.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16296/
[dpdk-dev,v6,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset,
but were dropped from the v3 patchset.

Changes in v5:
Rebased to latest master.
Added parameter to the _rte_eth_dev_callback_process function
Removed two new callback functions which were added previously.
Updated all calls to the _rte_eth_dev_callback_process function.

Changes in v4:
Rebased to latest master.
Moved the callback parameter structure from the ethdev to the ixgbe PMD.

Changes in v3:
Rebased to latest master.
Submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Changes in v2:
Rebased to latest master.




















Bernard Iremonger (13):
  librte_ether: modify internal callback function
  net/ixgbe: add callback to user app on VF to PF mbox msg
  app/test: add parameter to callback process function
  net/bonding: add parameter to callback process function
  net/e1000: add parameter to callback process function
  net/i40e: update call to callback process function
  net/mlx4: add parameter to callback process function
  net/mlx5: add parameter to callback process function
  net/nfp: add parameter to callback process function
  net/thunderx: add parameter to callback process function
  net/vhost: add parameter to callback process function
  net/virtio: add parameter to callback process function
  net/enic: add parameter to callback process function

 app/test/virtual_pmd.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 ++---
 drivers/net/e1000/em_ethdev.c  |  2 +-
 drivers/net/e1000/igb_ethdev.c |  4 ++--
 drivers/net/enic/enic_main.c   |  2 +-
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c  |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c   |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c   | 42 +-
 drivers/net/ixgbe/rte_pmd_ixgbe.h  | 17 ++
 drivers/net/mlx4/mlx4.c|  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c |  4 ++--
 drivers/net/nfp/nfp_net.c  |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c|  2 +-
 drivers/net/vhost/rte_eth_vhost.c  |  6 ++---
 drivers/net/virtio/virtio_ethdev.c |  2 +-
 lib/librte_ether/rte_ethdev.c  |  5 +++-
 lib/librte_ether/rte_ethdev.h  |  7 +-
 18 files changed, 86 insertions(+), 31 deletions(-)

-- 
2.9.0



[dpdk-dev] [PATCH v4 2/2] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-10-04 Thread Bernard Iremonger
call _rte_eth_dev_callback_process_vf from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform
the function.
If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue,
if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

Signed-off-by: Alex Zelezniak 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_pf.c  | 42 +--
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 17 
 2 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 56393ff..5277517 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -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
@@ -51,6 +51,7 @@

 #include "base/ixgbe_common.h"
 #include "ixgbe_ethdev.h"
+#include "rte_pmd_ixgbe.h"

 #define IXGBE_MAX_VFTA (128)
 #define IXGBE_VF_MSG_SIZE_DEFAULT 1
@@ -660,6 +661,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
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);
+   struct rte_pmd_ixgbe_mb_event_param cb_param;

retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
if (retval) {
@@ -674,27 +676,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t 
vf)
/* flush the ack before we write any messages back */
IXGBE_WRITE_FLUSH(hw);

+   /**
+* initialise structure to send to user application
+* will return response from user in retval field
+*/
+   cb_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
+   cb_param.vfid = vf;
+   cb_param.msg_type = msgbuf[0] & 0x;
+   cb_param.userdata = (void *)msgbuf;
+
/* perform VF reset */
if (msgbuf[0] == IXGBE_VF_RESET) {
int ret = ixgbe_vf_reset(dev, vf, msgbuf);

vfinfo[vf].clear_to_send = true;
+
+   /* notify application about VF reset */
+   _rte_eth_dev_callback_process_vf(dev, RTE_ETH_EVENT_VF_MBOX, 
_param);
return ret;
}

+   /**
+* ask user application if we allowed to perform those functions
+* if we get cb_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED
+* then business as usual,
+* if 0, do nothing and send ACK to VF
+* if cb_param.retval > 1, do nothing and send NAK to VF
+*/
+   _rte_eth_dev_callback_process_vf(dev, RTE_ETH_EVENT_VF_MBOX, _param);
+
+   retval = cb_param.retval;
+
/* check & process VF to PF mailbox message */
switch ((msgbuf[0] & 0x)) {
case IXGBE_VF_SET_MAC_ADDR:
-   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_MULTICAST:
-   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_LPE:
-   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_VLAN:
-   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
break;
case IXGBE_VF_API_NEGOTIATE:
retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
@@ -704,7 +733,8 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE;
break;
case IXGBE_VF_UPDATE_XCAST_MODE:
-   retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
+   if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
break;
default:
PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h 
b/drivers/net/ixgbe/rte_pmd_ixgbe.h
index 33b5b2d..2f6cf46 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.h
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h
@@ -181,4 +181,21 @@ int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, 
uint16_t vf, uint8_t o

[dpdk-dev] [PATCH v4 1/2] librte_ether: add internal callback functions

2016-10-04 Thread Bernard Iremonger
add _rte_eth_dev_callback_process_vf function.
add _rte_eth_dev_callback_process_generic function

Adding a callback to the user application on VF to PF mailbox message,
allows passing information to the application controlling the PF
when a VF mailbox event message is received, such as VF reset.

Signed-off-by: Alex Zelezniak 
Signed-off-by: Bernard Iremonger 
---
 lib/librte_ether/rte_ethdev.c  | 17 +
 lib/librte_ether/rte_ethdev.h  | 44 ++
 lib/librte_ether/rte_ether_version.map |  2 ++
 3 files changed, 63 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index c517e88..e850d88 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2510,6 +2510,20 @@ void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
enum rte_eth_event_type event)
 {
+   return _rte_eth_dev_callback_process_generic(dev, event, NULL);
+}
+
+void
+_rte_eth_dev_callback_process_vf(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param)
+{
+   return _rte_eth_dev_callback_process_generic(dev, event, param);
+}
+
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param)
+{
struct rte_eth_dev_callback *cb_lst;
struct rte_eth_dev_callback dev_cb;

@@ -2519,6 +2533,9 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
continue;
dev_cb = *cb_lst;
cb_lst->active = 1;
+   if (param != NULL)
+   dev_cb.cb_arg = (void *) param;
+
rte_spinlock_unlock(_eth_dev_cb_lock);
dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
dev_cb.cb_arg);
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 7218b6f..b418c5e 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3026,6 +3026,7 @@ enum rte_eth_event_type {
/**< queue state event (enabled/disabled) */
RTE_ETH_EVENT_INTR_RESET,
/**< reset interrupt event, sent to VF on PF reset */
+   RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
RTE_ETH_EVENT_MAX   /**< max value of this enum */
 };

@@ -3093,6 +3094,49 @@ void _rte_eth_dev_callback_process(struct rte_eth_dev 
*dev,
enum rte_eth_event_type event);

 /**
+ * @internal Executes all the user application registered callbacks for
+ * the specific device where parameter have to be passed to user application.
+ * It is for DPDK internal user only. User application should not call it
+ * directly.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ * @param event
+ *  Eth device interrupt event type.
+ *
+ * @param param
+ *  parameters to pass back to user application.
+ *
+ * @return
+ *  void
+ */
+
+void
+_rte_eth_dev_callback_process_vf(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param);
+
+/**
+ * @internal Executes all the user application registered callbacks. Used by:
+ * _rte_eth_dev_callback_process and _rte_eth_dev_callback_process_vf
+ * It is for DPDK internal user only. User application should not call it
+ * directly.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ * @param event
+ *  Eth device interrupt event type.
+ *
+ * @param param
+ *  parameters to pass back to user application.
+ *
+ * @return
+ *  void
+ */
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param);
+
+/**
  * When there is no rx packet coming in Rx Queue for a long time, we can
  * sleep lcore related to RX Queue for power saving, and enable rx interrupt
  * to be triggered when rx packect arrives.
diff --git a/lib/librte_ether/rte_ether_version.map 
b/lib/librte_ether/rte_ether_version.map
index 72be66d..6f97a8f 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -143,6 +143,8 @@ DPDK_16.07 {
 DPDK_16.11 {
global:

+   _rte_eth_dev_callback_process_generic;
+   _rte_eth_dev_callback_process_vf;
rte_eth_dev_pci_probe;
rte_eth_dev_pci_remove;

-- 
2.9.0



[dpdk-dev] [PATCH v4 0/2] add callbacks for VF management

2016-10-04 Thread Bernard Iremonger
This patchset contains new callback functions intended for VF management.

Two new callback functions have been added.
Changes have been made to the ixgbe_rcv_msg_from_vf function to
use the callback functions.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16296/
[dpdk-dev,v6,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset,
but were dropped from the v3 patchset.

Changes in v4:
Rebased to latest master.
Moved the callback parameter structure from the ethdev to the ixgbe PMD.

Changes in v3:
Rebased to latest master.
Submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Changes in v2:
Rebased to latest master.

Bernard Iremonger (2):
  librte_ether: add internal callback functions
  net/ixgbe: add callback to user app on VF to PF mbox msg

 drivers/net/ixgbe/ixgbe_pf.c   | 42 +++-
 drivers/net/ixgbe/rte_pmd_ixgbe.h  | 17 +
 lib/librte_ether/rte_ethdev.c  | 17 +
 lib/librte_ether/rte_ethdev.h  | 44 ++
 lib/librte_ether/rte_ether_version.map |  2 ++
 5 files changed, 116 insertions(+), 6 deletions(-)

-- 
2.9.0



[dpdk-dev] [PATCH v3 3/3] app/test_pmd: add tests for new API's

2016-09-16 Thread Bernard Iremonger
add test for vf vlan anti spoof
add test for vf mac anti spoof
add test for vf ping
add test for vf vlan strip
add test for vf vlan insert
add test for tx loopback
add test for all queues drop enable bit
add test for vf split drop enable bit
add test for vf mac address
add new API's to the testpmd guide

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/cmdline.c  | 707 
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  70 ++-
 2 files changed, 774 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f90befc..264aa90 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -10585,6 +10585,704 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
},
 };

+/* vf vlan anti spoof configuration */
+
+/* Common result structure for vf vlan anti spoof */
+struct cmd_vf_vlan_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t vlan;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf vlan anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+set, "set");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vf =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vf, "vf");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vlan =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vlan, "vlan");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_antispoof =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+antispoof, "antispoof");
+cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_port_id =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_vf_id =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_on_off =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+on_off, "on#off");
+
+static void
+cmd_set_vf_vlan_anti_spoof_parsed(
+   void *parsed_result,
+   __attribute__((unused)) struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   struct cmd_vf_vlan_anti_spoof_result *res = parsed_result;
+   int ret = 0;
+   int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+   if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+   return;
+
+   if (res->vf_id > 63) {
+   printf("vf_id must be less than 64.\n");
+   return;
+   }
+   ret = rte_eth_dev_set_vf_vlan_anti_spoof(res->port_id, res->vf_id, 
is_on);
+   if (ret < 0)
+   printf("vf vlan anti spoofing programming error: (%s)\n",
+  strerror(-ret));
+}
+
+cmdline_parse_inst_t cmd_set_vf_vlan_anti_spoof = {
+   .f = cmd_set_vf_vlan_anti_spoof_parsed,
+   .data = NULL,
+   .help_str = "set vf vlan antispoof port_id vf_id on|off",
+   .tokens = {
+   (void *)_vf_vlan_anti_spoof_set,
+   (void *)_vf_vlan_anti_spoof_vf,
+   (void *)_vf_vlan_anti_spoof_vlan,
+   (void *)_vf_vlan_anti_spoof_antispoof,
+   (void *)_vf_vlan_anti_spoof_port_id,
+   (void *)_vf_vlan_anti_spoof_vf_id,
+   (void *)_vf_vlan_anti_spoof_on_off,
+   NULL,
+   },
+};
+
+/* vf mac anti spoof configuration */
+
+/* Common result structure for vf mac anti spoof */
+struct cmd_vf_mac_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t mac;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf mac anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+set, "set");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_vf =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+vf, "vf");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_mac =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+mac, "mac");
+cmdline_parse_token_string_t cmd_vf

[dpdk-dev] [PATCH v3 2/3] net/ixgbe: add functions for VF management

2016-09-16 Thread Bernard Iremonger
Add new functions to configure and manage VF's on an Intel 82559 NIC.

add ixgbe_vf_ping function.
add ixgbe_set_vf_vlan_anti_spoof function.
add ixgbe_set_vf_mac_anti_spoof function.

Signed-off-by: azelezniak 

add ixgbe_set_vf_vlan_insert function.
add ixgbe_set_tx_loopback function.
add ixgbe_set_all_queues_drop function.
add ixgbe_set_vf_split_drop_en function.
add ixgbe_set_vf_mac_addr function.

Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 166 +++
 1 file changed, 166 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fb618ef..9875290 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -240,6 +240,8 @@ static void ixgbe_add_rar(struct rte_eth_dev *dev, struct 
ether_addr *mac_addr,
 static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index);
 static void ixgbe_set_default_mac_addr(struct rte_eth_dev *dev,
   struct ether_addr *mac_addr);
+static int ixgbe_set_vf_mac_addr(struct rte_eth_dev *dev, uint16_t vf,
+   struct ether_addr *mac_addr);
 static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config 
*dcb_config);

 /* For Virtual Function support */
@@ -280,6 +282,17 @@ 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 void ixgbe_set_vf_vlan_anti_spoof(struct rte_eth_dev *dev,
+   uint16_t vf, uint8_t on);
+static void ixgbe_set_vf_mac_anti_spoof(struct rte_eth_dev *dev,
+   uint16_t vf, uint8_t on);
+static int ixgbe_vf_ping(struct rte_eth_dev *dev, int32_t vf);
+static void ixgbe_set_vf_vlan_insert(struct rte_eth_dev *dev, uint16_t vf,
+   int vlan);
+static void ixgbe_set_tx_loopback(struct rte_eth_dev *dev, int on);
+static void ixgbe_set_all_queues_drop_en(struct rte_eth_dev *dev, int state);
+static void ixgbe_set_vf_split_drop_en(struct rte_eth_dev *dev, uint16_t vf,
+   int state);
 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);
@@ -562,6 +575,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.mac_addr_add = ixgbe_add_rar,
.mac_addr_remove  = ixgbe_remove_rar,
.mac_addr_set = ixgbe_set_default_mac_addr,
+   .set_vf_mac_addr  = ixgbe_set_vf_mac_addr,
.uc_hash_table_set= ixgbe_uc_hash_table_set,
.uc_all_hash_table_set  = ixgbe_uc_all_hash_table_set,
.mirror_rule_set  = ixgbe_mirror_rule_set,
@@ -570,6 +584,13 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.set_vf_rx= ixgbe_set_pool_rx,
.set_vf_tx= ixgbe_set_pool_tx,
.set_vf_vlan_filter   = ixgbe_set_pool_vlan_filter,
+   .set_vf_vlan_anti_spoof  = ixgbe_set_vf_vlan_anti_spoof,
+   .set_vf_mac_anti_spoof   = ixgbe_set_vf_mac_anti_spoof,
+   .vf_ping  = ixgbe_vf_ping,
+   .set_vf_vlan_insert   = ixgbe_set_vf_vlan_insert,
+   .set_tx_loopback  = ixgbe_set_tx_loopback,
+   .set_all_queues_drop_en = ixgbe_set_all_queues_drop_en,
+   .set_vf_split_drop_en = ixgbe_set_vf_split_drop_en,
.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,
@@ -4069,6 +4090,22 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, 
struct ether_addr *addr)
 }

 static int
+ixgbe_set_vf_mac_addr(struct rte_eth_dev *dev, uint16_t vf, struct ether_addr 
*mac_addr)
+{
+   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));
+   int rar_entry = hw->mac.num_rar_entries - (vf + 1);
+   uint8_t *new_mac = (uint8_t *)(mac_addr);
+
+   if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) {
+   rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 
ETHER_ADDR_LEN);
+   return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, 
IXGBE_RAH_AV);
+   }
+   return -1;
+}
+
+static int
 ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
uint32_t hlreg0;
@@ -4661,6 +4698,135 @@ ixgbe_set_pool_vlan_filter(struct rte_eth_dev *dev, 
uint16_t vlan,
return ret;
 }

+static void
+ixgbe_set_vf_vlan_anti_spoof(struct rte_eth_dev *dev,
+   uint16_t vf, uint8_t on)
+{
+   struct ixgbe_hw *hw =
+   IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   st

[dpdk-dev] [PATCH v3 1/3] librte_ether: add API's for VF management

2016-09-16 Thread Bernard Iremonger
Add new API functions to configure and manage VF's on a NIC.

add rte_eth_dev_vf_ping function.
add rte_eth_dev_set_vf_vlan_anti_spoof function.
add rte_eth_dev_set_vf_mac_anti_spoof function.
add rte_eth_dev_set_vf_vlan_strip function.

Signed-off-by: azelezniak 

add rte_eth_dev_set_vf_vlan_insert function.
add rte_eth_dev_set_loopback function.
add rte_eth_dev_set_all_queues_drop function.
add rte_eth_dev_set_vf_split_drop_en function
add rte_eth_dev_set_vf_mac_addr function.

Signed-off-by: Bernard Iremonger 
---
 lib/librte_ether/rte_ethdev.c  | 192 +
 lib/librte_ether/rte_ethdev.h  | 217 -
 lib/librte_ether/rte_ether_version.map |  14 +++
 3 files changed, 422 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 382c959..4f83c29 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2305,6 +2305,30 @@ rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct 
ether_addr *addr)
 }

 int
+rte_eth_dev_set_vf_mac_addr(uint8_t port_id, uint16_t vf, struct ether_addr 
*addr)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   if (!is_valid_assigned_ether_addr(addr))
+   return -EINVAL;
+
+   dev = _eth_devices[port_id];
+   rte_eth_dev_info_get(port_id, _info);
+
+   if (vf >= dev_info.max_vfs) {
+   RTE_PMD_DEBUG_TRACE("set VF mac addr: invalid VF %d\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_mac_addr, -ENOTSUP);
+
+   return (*dev->dev_ops->set_vf_mac_addr)(dev, vf, addr);
+}
+
+int
 rte_eth_dev_set_vf_rxmode(uint8_t port_id,  uint16_t vf,
uint16_t rx_mode, uint8_t on)
 {
@@ -2489,6 +2513,174 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, 
uint16_t vlan_id,
   vf_mask, vlan_on);
 }

+int
+rte_eth_dev_set_vf_vlan_anti_spoof(uint8_t port_id,
+  uint16_t vf, uint8_t on)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   rte_eth_dev_info_get(port_id, _info);
+
+   if (vf >= dev_info.max_vfs) {
+   RTE_PMD_DEBUG_TRACE("set VF VLAN anti spoof: invalid VF %d\n", 
vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_anti_spoof, 
-ENOTSUP);
+   (*dev->dev_ops->set_vf_vlan_anti_spoof)(dev, vf, on);
+   return 0;
+}
+
+int
+rte_eth_dev_set_vf_mac_anti_spoof(uint8_t port_id,
+  uint16_t vf, uint8_t on)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   rte_eth_dev_info_get(port_id, _info);
+
+   if (vf >= dev_info.max_vfs) {
+   RTE_PMD_DEBUG_TRACE("set VF MAC anti spoof:invalid VF %d\n", 
vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_mac_anti_spoof, -ENOTSUP);
+   (*dev->dev_ops->set_vf_mac_anti_spoof)(dev, vf, on);
+   return 0;
+}
+
+int
+rte_eth_dev_vf_ping(uint8_t port_id, int32_t vf)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   rte_eth_dev_info_get(port_id, _info);
+
+   if (vf >= dev_info.max_vfs) {
+   RTE_PMD_DEBUG_TRACE("VF ping: invalid VF %d\n", vf);
+   return -EINVAL;
+   } else if (vf < -1) {
+   RTE_PMD_DEBUG_TRACE("VF ping: invalid value %d\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vf_ping, -ENOTSUP);
+   return (*dev->dev_ops->vf_ping)(dev, vf);
+}
+
+int
+rte_eth_dev_set_vf_vlan_strip(uint8_t port_id, uint16_t vf, int on)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+   uint16_t queues_per_pool;
+   uint32_t q;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   rte_eth_dev_info_get(port_id, _info);
+
+   if (vf >= dev_info.max_vfs) {
+   RTE_PMD_DEBUG_TRACE("set VF vlan strip: invalid VF %d\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+
+   queues_per_pool = dev_info.vmdq_queue_num/dev_info.max_vmdq_pools;
+
+   for (q = 0; q < queues_per_pool; q++)
+   (*dev->dev_o

[dpdk-dev] [PATCH v3 0/3] add API's for VF management

2016-09-16 Thread Bernard Iremonger
This patchset contains new DPDK API's requested by AT for use
with the Virtual Function Daemon (VFD).

The need to configure and manage VF's on a NIC has grown to the
point where AT have devloped a DPDK based tool, VFD, to do this.

This patch set adds API extensions to DPDK VF configuration.

Nine new functions have been added to the eth_dev_ops structure.
Corresponding functions have been added to the ixgbe PMD for the
Intel 82559 NIC.

Changes have been made to testpmd to facilitate testing of the new API's.
The testpmd documentation has been updated to document the testpmd changes.

Note:
Adding new functions to the eth_dev_ops structure will cause an
ABI breakage.

Changes in v3:
rebase to latest master branch.
drop patches for callback functions
revise VF id checks in new librte_ether functions
revise testpmd commands for new API's

Changes in V2:
rebase to latest master branch.
fix compile  error with clang.

Bernard Iremonger (3):
  librte_ether: add API's for VF management
  net/ixgbe: add functions for VF management
  app/test_pmd: add tests for new API's

 app/test-pmd/cmdline.c  | 707 
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  70 ++-
 drivers/net/ixgbe/ixgbe_ethdev.c| 166 +++
 lib/librte_ether/rte_ethdev.c   | 192 
 lib/librte_ether/rte_ethdev.h   | 217 -
 lib/librte_ether/rte_ether_version.map  |  14 +
 6 files changed, 1362 insertions(+), 4 deletions(-)

-- 
2.9.0



[dpdk-dev] [PATCH v3 3/3] app/test_pmd: add tests for new API's

2016-09-16 Thread Bernard Iremonger
add test for vf vlan anti spoof
add test for vf mac anti spoof
add test for vf ping
add test for vf vlan strip
add test for vf vlan insert
add test for tx loopback
add test for all queues drop enable bit
add test for vf split drop enable bit
add test for vf mac address
add new API's to the testpmd guide

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/cmdline.c  | 707 
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  70 ++-
 2 files changed, 774 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f90befc..264aa90 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -10585,6 +10585,704 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
},
 };

+/* vf vlan anti spoof configuration */
+
+/* Common result structure for vf vlan anti spoof */
+struct cmd_vf_vlan_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t vlan;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf vlan anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+set, "set");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vf =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vf, "vf");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vlan =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vlan, "vlan");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_antispoof =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+antispoof, "antispoof");
+cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_port_id =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_vf_id =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_on_off =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+on_off, "on#off");
+
+static void
+cmd_set_vf_vlan_anti_spoof_parsed(
+   void *parsed_result,
+   __attribute__((unused)) struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   struct cmd_vf_vlan_anti_spoof_result *res = parsed_result;
+   int ret = 0;
+   int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+   if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+   return;
+
+   if (res->vf_id > 63) {
+   printf("vf_id must be less than 64.\n");
+   return;
+   }
+   ret = rte_eth_dev_set_vf_vlan_anti_spoof(res->port_id, res->vf_id, 
is_on);
+   if (ret < 0)
+   printf("vf vlan anti spoofing programming error: (%s)\n",
+  strerror(-ret));
+}
+
+cmdline_parse_inst_t cmd_set_vf_vlan_anti_spoof = {
+   .f = cmd_set_vf_vlan_anti_spoof_parsed,
+   .data = NULL,
+   .help_str = "set vf vlan antispoof port_id vf_id on|off",
+   .tokens = {
+   (void *)_vf_vlan_anti_spoof_set,
+   (void *)_vf_vlan_anti_spoof_vf,
+   (void *)_vf_vlan_anti_spoof_vlan,
+   (void *)_vf_vlan_anti_spoof_antispoof,
+   (void *)_vf_vlan_anti_spoof_port_id,
+   (void *)_vf_vlan_anti_spoof_vf_id,
+   (void *)_vf_vlan_anti_spoof_on_off,
+   NULL,
+   },
+};
+
+/* vf mac anti spoof configuration */
+
+/* Common result structure for vf mac anti spoof */
+struct cmd_vf_mac_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t mac;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf mac anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+set, "set");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_vf =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+vf, "vf");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_mac =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+mac, "mac");
+cmdline_parse_token_string_t cmd_vf

[dpdk-dev] [PATCH v3 2/3] net/ixgbe: add functions for VF management

2016-09-16 Thread Bernard Iremonger
Add new functions to configure and manage VF's on an Intel 82559 NIC.

add ixgbe_vf_ping function.
add ixgbe_set_vf_vlan_anti_spoof function.
add ixgbe_set_vf_mac_anti_spoof function.

Signed-off-by: azelezniak 

add ixgbe_set_vf_vlan_insert function.
add ixgbe_set_tx_loopback function.
add ixgbe_set_all_queues_drop function.
add ixgbe_set_vf_split_drop_en function.
add ixgbe_set_vf_mac_addr function.

Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 166 +++
 1 file changed, 166 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fb618ef..9875290 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -240,6 +240,8 @@ static void ixgbe_add_rar(struct rte_eth_dev *dev, struct 
ether_addr *mac_addr,
 static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index);
 static void ixgbe_set_default_mac_addr(struct rte_eth_dev *dev,
   struct ether_addr *mac_addr);
+static int ixgbe_set_vf_mac_addr(struct rte_eth_dev *dev, uint16_t vf,
+   struct ether_addr *mac_addr);
 static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config 
*dcb_config);

 /* For Virtual Function support */
@@ -280,6 +282,17 @@ 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 void ixgbe_set_vf_vlan_anti_spoof(struct rte_eth_dev *dev,
+   uint16_t vf, uint8_t on);
+static void ixgbe_set_vf_mac_anti_spoof(struct rte_eth_dev *dev,
+   uint16_t vf, uint8_t on);
+static int ixgbe_vf_ping(struct rte_eth_dev *dev, int32_t vf);
+static void ixgbe_set_vf_vlan_insert(struct rte_eth_dev *dev, uint16_t vf,
+   int vlan);
+static void ixgbe_set_tx_loopback(struct rte_eth_dev *dev, int on);
+static void ixgbe_set_all_queues_drop_en(struct rte_eth_dev *dev, int state);
+static void ixgbe_set_vf_split_drop_en(struct rte_eth_dev *dev, uint16_t vf,
+   int state);
 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);
@@ -562,6 +575,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.mac_addr_add = ixgbe_add_rar,
.mac_addr_remove  = ixgbe_remove_rar,
.mac_addr_set = ixgbe_set_default_mac_addr,
+   .set_vf_mac_addr  = ixgbe_set_vf_mac_addr,
.uc_hash_table_set= ixgbe_uc_hash_table_set,
.uc_all_hash_table_set  = ixgbe_uc_all_hash_table_set,
.mirror_rule_set  = ixgbe_mirror_rule_set,
@@ -570,6 +584,13 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.set_vf_rx= ixgbe_set_pool_rx,
.set_vf_tx= ixgbe_set_pool_tx,
.set_vf_vlan_filter   = ixgbe_set_pool_vlan_filter,
+   .set_vf_vlan_anti_spoof  = ixgbe_set_vf_vlan_anti_spoof,
+   .set_vf_mac_anti_spoof   = ixgbe_set_vf_mac_anti_spoof,
+   .vf_ping  = ixgbe_vf_ping,
+   .set_vf_vlan_insert   = ixgbe_set_vf_vlan_insert,
+   .set_tx_loopback  = ixgbe_set_tx_loopback,
+   .set_all_queues_drop_en = ixgbe_set_all_queues_drop_en,
+   .set_vf_split_drop_en = ixgbe_set_vf_split_drop_en,
.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,
@@ -4069,6 +4090,22 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, 
struct ether_addr *addr)
 }

 static int
+ixgbe_set_vf_mac_addr(struct rte_eth_dev *dev, uint16_t vf, struct ether_addr 
*mac_addr)
+{
+   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));
+   int rar_entry = hw->mac.num_rar_entries - (vf + 1);
+   uint8_t *new_mac = (uint8_t *)(mac_addr);
+
+   if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) {
+   rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 
ETHER_ADDR_LEN);
+   return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, 
IXGBE_RAH_AV);
+   }
+   return -1;
+}
+
+static int
 ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
uint32_t hlreg0;
@@ -4661,6 +4698,135 @@ ixgbe_set_pool_vlan_filter(struct rte_eth_dev *dev, 
uint16_t vlan,
return ret;
 }

+static void
+ixgbe_set_vf_vlan_anti_spoof(struct rte_eth_dev *dev,
+   uint16_t vf, uint8_t on)
+{
+   struct ixgbe_hw *hw =
+   IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   st

[dpdk-dev] [PATCH v3 1/3] librte_ether: add API's for VF management

2016-09-16 Thread Bernard Iremonger
Add new API functions to configure and manage VF's on a NIC.

add rte_eth_dev_vf_ping function.
add rte_eth_dev_set_vf_vlan_anti_spoof function.
add rte_eth_dev_set_vf_mac_anti_spoof function.
add rte_eth_dev_set_vf_vlan_strip function.

Signed-off-by: azelezniak 

add rte_eth_dev_set_vf_vlan_insert function.
add rte_eth_dev_set_loopback function.
add rte_eth_dev_set_all_queues_drop function.
add rte_eth_dev_set_vf_split_drop_en function
add rte_eth_dev_set_vf_mac_addr function.

Signed-off-by: Bernard Iremonger 
---
 lib/librte_ether/rte_ethdev.c  | 192 +
 lib/librte_ether/rte_ethdev.h  | 217 -
 lib/librte_ether/rte_ether_version.map |  14 +++
 3 files changed, 422 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 382c959..4f83c29 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2305,6 +2305,30 @@ rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct 
ether_addr *addr)
 }

 int
+rte_eth_dev_set_vf_mac_addr(uint8_t port_id, uint16_t vf, struct ether_addr 
*addr)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   if (!is_valid_assigned_ether_addr(addr))
+   return -EINVAL;
+
+   dev = _eth_devices[port_id];
+   rte_eth_dev_info_get(port_id, _info);
+
+   if (vf >= dev_info.max_vfs) {
+   RTE_PMD_DEBUG_TRACE("set VF mac addr: invalid VF %d\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_mac_addr, -ENOTSUP);
+
+   return (*dev->dev_ops->set_vf_mac_addr)(dev, vf, addr);
+}
+
+int
 rte_eth_dev_set_vf_rxmode(uint8_t port_id,  uint16_t vf,
uint16_t rx_mode, uint8_t on)
 {
@@ -2489,6 +2513,174 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, 
uint16_t vlan_id,
   vf_mask, vlan_on);
 }

+int
+rte_eth_dev_set_vf_vlan_anti_spoof(uint8_t port_id,
+  uint16_t vf, uint8_t on)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   rte_eth_dev_info_get(port_id, _info);
+
+   if (vf >= dev_info.max_vfs) {
+   RTE_PMD_DEBUG_TRACE("set VF VLAN anti spoof: invalid VF %d\n", 
vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_anti_spoof, 
-ENOTSUP);
+   (*dev->dev_ops->set_vf_vlan_anti_spoof)(dev, vf, on);
+   return 0;
+}
+
+int
+rte_eth_dev_set_vf_mac_anti_spoof(uint8_t port_id,
+  uint16_t vf, uint8_t on)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   rte_eth_dev_info_get(port_id, _info);
+
+   if (vf >= dev_info.max_vfs) {
+   RTE_PMD_DEBUG_TRACE("set VF MAC anti spoof:invalid VF %d\n", 
vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_mac_anti_spoof, -ENOTSUP);
+   (*dev->dev_ops->set_vf_mac_anti_spoof)(dev, vf, on);
+   return 0;
+}
+
+int
+rte_eth_dev_vf_ping(uint8_t port_id, int32_t vf)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   rte_eth_dev_info_get(port_id, _info);
+
+   if (vf >= dev_info.max_vfs) {
+   RTE_PMD_DEBUG_TRACE("VF ping: invalid VF %d\n", vf);
+   return -EINVAL;
+   } else if (vf < -1) {
+   RTE_PMD_DEBUG_TRACE("VF ping: invalid value %d\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vf_ping, -ENOTSUP);
+   return (*dev->dev_ops->vf_ping)(dev, vf);
+}
+
+int
+rte_eth_dev_set_vf_vlan_strip(uint8_t port_id, uint16_t vf, int on)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+   uint16_t queues_per_pool;
+   uint32_t q;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   rte_eth_dev_info_get(port_id, _info);
+
+   if (vf >= dev_info.max_vfs) {
+   RTE_PMD_DEBUG_TRACE("set VF vlan strip: invalid VF %d\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+
+   queues_per_pool = dev_info.vmdq_queue_num/dev_info.max_vmdq_pools;
+
+   for (q = 0; q < queues_per_pool; q++)
+   (*dev->dev_o

[dpdk-dev] [PATCH v3 0/3] add API's for VF management

2016-09-16 Thread Bernard Iremonger
This patchset contains new DPDK API's requested by AT for use
with the Virtual Function Daemon (VFD).

The need to configure and manage VF's on a NIC has grown to the
point where AT have devloped a DPDK based tool, VFD, to do this.

This patch set adds API extensions to DPDK VF configuration.

Nine new functions have been added to the eth_dev_ops structure.
Corresponding functions have been added to the ixgbe PMD for the
Intel 82559 NIC.

Changes have been made to testpmd to facilitate testing of the new API's.
The testpmd documentation has been updated to document the testpmd changes.

Note:
Adding new functions to the eth_dev_ops structure will cause an
ABI breakage.

Changes in v3:
rebase to latest master branch.
drop patches for callback functions
revise VF id checks in new librte_ether functions
revise testpmd commands for new API's

Changes in V2:
rebase to latest master branch.
fix compile  error with clang.

Bernard Iremonger (3):
  librte_ether: add API's for VF management
  net/ixgbe: add functions for VF management
  app/test_pmd: add tests for new API's

 app/test-pmd/cmdline.c  | 707 
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  70 ++-
 drivers/net/ixgbe/ixgbe_ethdev.c| 166 +++
 lib/librte_ether/rte_ethdev.c   | 192 
 lib/librte_ether/rte_ethdev.h   | 217 -
 lib/librte_ether/rte_ether_version.map  |  14 +
 6 files changed, 1362 insertions(+), 4 deletions(-)

-- 
2.9.0



[dpdk-dev] [RFC PATCH v2 5/5] app/test_pmd: add tests for new API's

2016-08-26 Thread Bernard Iremonger
add test for vf vlan anti spoof
add test for vf mac anti spoof
add test for vf ping
add test for vf vlan strip
add test for vf vlan insert
add test for tx loopback
add test for all queues drop enable bit
add test for vf split drop enable bit
add test for vf mac address
add new API's to the testpmd guide

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/cmdline.c  | 700 
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  68 ++-
 2 files changed, 766 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f90befc..fb29c0a 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -10585,6 +10585,697 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
},
 };

+/* vf vlan anti spoof configuration */
+
+/* Common result structure for vf vlan anti spoof */
+struct cmd_vf_vlan_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t vlan;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   uint8_t on;
+};
+
+/* Common CLI fields for vf vlan anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+set, "set");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vf =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vf, "vf");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vlan =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vlan, "vlan");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_antispoof =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+antispoof, "antispoof");
+cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_port_id =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_vf_id =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vf_id, UINT32);
+cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_on =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+on, UINT8);
+
+static void
+cmd_set_vf_vlan_anti_spoof_parsed(
+   void *parsed_result,
+   __attribute__((unused)) struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   struct cmd_vf_vlan_anti_spoof_result *res = parsed_result;
+   int ret = 0;
+
+   if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+   return;
+
+   if (res->vf_id > 63) {
+   printf("vf_id must be less than 64.\n");
+   return;
+   }
+   ret = rte_eth_dev_set_vf_vlan_anti_spoof(res->port_id, res->vf_id, 
res->on);
+   if (ret < 0)
+   printf("vf vlan anti spoofing programming error: (%s)\n",
+  strerror(-ret));
+}
+
+cmdline_parse_inst_t cmd_set_vf_vlan_anti_spoof = {
+   .f = cmd_set_vf_vlan_anti_spoof_parsed,
+   .data = NULL,
+   .help_str = "enable/disable vf vlan anti spoof",
+   .tokens = {
+   (void *)_vf_vlan_anti_spoof_set,
+   (void *)_vf_vlan_anti_spoof_vf,
+   (void *)_vf_vlan_anti_spoof_vlan,
+   (void *)_vf_vlan_anti_spoof_antispoof,
+   (void *)_vf_vlan_anti_spoof_port_id,
+   (void *)_vf_vlan_anti_spoof_vf_id,
+   (void *)_vf_vlan_anti_spoof_on,
+   NULL,
+   },
+};
+
+/* vf mac anti spoof configuration */
+
+/* Common result structure for vf mac anti spoof */
+struct cmd_vf_mac_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t mac;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   uint8_t on;
+};
+
+/* Common CLI fields for vf mac anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+set, "set");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_vf =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+vf, "vf");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_mac =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+mac, "mac");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_antispoof =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+antispoof, "

[dpdk-dev] [RFC PATCH v2 4/5] net/ixgbe: add functions for VF management

2016-08-26 Thread Bernard Iremonger
Add new functions to configure and manage VF's on a Niantic NIC.

add ixgbe_vf_ping function.
add ixgbe_set_vf_vlan_anti_spoof function.
add ixgbe_set_vf_mac_anti_spoof function.

Signed-off-by: azelezniak 

add ixgbe_set_vf_vlan_strip function
add ixgbe_set_vf_vlan_insert function.
add ixgbe_set_tx_loopback function.
add ixgbe_set_all_queues_drop function.
add ixgbe_set_vf_split_drop_en function.
add ixgbe_set_vf_mac_addr function.

Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 179 +++
 1 file changed, 179 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fb618ef..e8220ba 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -240,6 +240,8 @@ static void ixgbe_add_rar(struct rte_eth_dev *dev, struct 
ether_addr *mac_addr,
 static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index);
 static void ixgbe_set_default_mac_addr(struct rte_eth_dev *dev,
   struct ether_addr *mac_addr);
+static int ixgbe_set_vf_mac_addr(struct rte_eth_dev *dev, uint16_t vf,
+   struct ether_addr *mac_addr);
 static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config 
*dcb_config);

 /* For Virtual Function support */
@@ -280,6 +282,19 @@ 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 void ixgbe_set_vf_vlan_anti_spoof(struct rte_eth_dev *dev,
+   uint16_t vf, uint8_t on);
+static void ixgbe_set_vf_mac_anti_spoof(struct rte_eth_dev *dev,
+   uint16_t vf, uint8_t on);
+static int ixgbe_vf_ping(struct rte_eth_dev *dev, int32_t vf);
+static void ixgbe_set_vf_vlan_strip(struct rte_eth_dev *dev,
+   int on, uint16_t queues_per_pool);
+static void ixgbe_set_vf_vlan_insert(struct rte_eth_dev *dev, uint16_t vf,
+   int vlan);
+static void ixgbe_set_tx_loopback(struct rte_eth_dev *dev, int on);
+static void ixgbe_set_all_queues_drop_en(struct rte_eth_dev *dev, int state);
+static void ixgbe_set_vf_split_drop_en(struct rte_eth_dev *dev, uint16_t vf,
+   int state);
 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);
@@ -562,6 +577,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.mac_addr_add = ixgbe_add_rar,
.mac_addr_remove  = ixgbe_remove_rar,
.mac_addr_set = ixgbe_set_default_mac_addr,
+   .set_vf_mac_addr  = ixgbe_set_vf_mac_addr,
.uc_hash_table_set= ixgbe_uc_hash_table_set,
.uc_all_hash_table_set  = ixgbe_uc_all_hash_table_set,
.mirror_rule_set  = ixgbe_mirror_rule_set,
@@ -570,6 +586,14 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.set_vf_rx= ixgbe_set_pool_rx,
.set_vf_tx= ixgbe_set_pool_tx,
.set_vf_vlan_filter   = ixgbe_set_pool_vlan_filter,
+   .set_vf_vlan_anti_spoof  = ixgbe_set_vf_vlan_anti_spoof,
+   .set_vf_mac_anti_spoof   = ixgbe_set_vf_mac_anti_spoof,
+   .vf_ping  = ixgbe_vf_ping,
+   .set_vf_vlan_strip= ixgbe_set_vf_vlan_strip,
+   .set_vf_vlan_insert   = ixgbe_set_vf_vlan_insert,
+   .set_tx_loopback  = ixgbe_set_tx_loopback,
+   .set_all_queues_drop_en = ixgbe_set_all_queues_drop_en,
+   .set_vf_split_drop_en = ixgbe_set_vf_split_drop_en,
.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,
@@ -4069,6 +4093,22 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, 
struct ether_addr *addr)
 }

 static int
+ixgbe_set_vf_mac_addr(struct rte_eth_dev *dev, uint16_t vf, struct ether_addr 
*mac_addr)
+{
+   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));
+   int rar_entry = hw->mac.num_rar_entries - (vf + 1);
+   uint8_t *new_mac = (uint8_t *)(mac_addr);
+
+   if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) {
+   rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 
ETHER_ADDR_LEN);
+   return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, 
IXGBE_RAH_AV);
+   }
+   return -1;
+}
+
+static int
 ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
uint32_t hlreg0;
@@ -4372,6 +4412,16 @@ ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, 
uint16_t queue, int on)
 }

 static void
+ixgbe_set_vf_vlan_strip(struct rte

[dpdk-dev] [RFC PATCH v2 3/5] librte_ether: add API's for VF management

2016-08-26 Thread Bernard Iremonger
Add new API functions to configure and manage VF's on a NIC.

add rte_eth_dev_vf_ping function.
add rte_eth_dev_set_vf_vlan_anti_spoof function.
add rte_eth_dev_set_vf_mac_anti_spoof function.

Signed-off-by: azelezniak 

add rte_eth_dev_set_vf_vlan_strip function.
add rte_eth_dev_set_vf_vlan_insert function.
add rte_eth_dev_set_loopback function.
add rte_eth_dev_set_all_queues_drop function.
add rte_eth_dev_set_vf_split_drop_en function
add rte_eth_dev_set_vf_mac_addr function.
increment LIBABIVER to 5.

Signed-off-by: Bernard Iremonger 
---
 lib/librte_ether/rte_ethdev.c  | 159 +++
 lib/librte_ether/rte_ethdev.h  | 223 +
 lib/librte_ether/rte_ether_version.map |   9 ++
 3 files changed, 391 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 1388ea3..2a3d2ae 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2306,6 +2306,22 @@ rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct 
ether_addr *addr)
 }

 int
+rte_eth_dev_set_vf_mac_addr(uint8_t port_id, uint16_t vf, struct ether_addr 
*addr)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   if (!is_valid_assigned_ether_addr(addr))
+   return -EINVAL;
+
+   dev = _eth_devices[port_id];
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_mac_addr, -ENOTSUP);
+
+   return (*dev->dev_ops->set_vf_mac_addr)(dev, vf, addr);
+}
+
+int
 rte_eth_dev_set_vf_rxmode(uint8_t port_id,  uint16_t vf,
uint16_t rx_mode, uint8_t on)
 {
@@ -2490,6 +2506,149 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, 
uint16_t vlan_id,
   vf_mask, vlan_on);
 }

+int
+rte_eth_dev_set_vf_vlan_anti_spoof(uint8_t port_id,
+  uint16_t vf, uint8_t on)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   if (vf > 63) {
+   RTE_PMD_DEBUG_TRACE("VF VLAN anti spoof:VF %d > 63\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_anti_spoof, 
-ENOTSUP);
+   (*dev->dev_ops->set_vf_vlan_anti_spoof)(dev, vf, on);
+   return 0;
+}
+
+int
+rte_eth_dev_set_vf_mac_anti_spoof(uint8_t port_id,
+  uint16_t vf, uint8_t on)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   if (vf > 63) {
+   RTE_PMD_DEBUG_TRACE("VF MAC anti spoof:VF %d > 63\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_mac_anti_spoof, -ENOTSUP);
+   (*dev->dev_ops->set_vf_mac_anti_spoof)(dev, vf, on);
+   return 0;
+}
+
+int
+rte_eth_dev_vf_ping(uint8_t port_id, int32_t vf)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   if (vf > 63) {
+   RTE_PMD_DEBUG_TRACE("VF ping: VF %d > 64\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vf_ping, -ENOTSUP);
+   return (*dev->dev_ops->vf_ping)(dev, vf);
+}
+
+int
+rte_eth_dev_set_vf_vlan_strip(uint8_t port_id, uint16_t vf, int on)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+   uint16_t queues_per_pool;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   if (vf > 63) {
+   RTE_PMD_DEBUG_TRACE("VF vlan strip set VF %d > 63\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_strip, -ENOTSUP);
+
+   rte_eth_dev_info_get(port_id, _info);
+   queues_per_pool = dev_info.vmdq_queue_num/dev_info.max_vmdq_pools;
+
+   (*dev->dev_ops->set_vf_vlan_strip)(dev, on, queues_per_pool);
+   return 0;
+}
+
+int
+rte_eth_dev_set_vf_vlan_insert(uint8_t port_id, uint16_t vf, int on)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   if (vf > 63) {
+   RTE_PMD_DEBUG_TRACE("VF vlan insert set VF %d > 63\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_insert, -ENOTSUP);
+
+   (*dev->dev_ops->set_vf_vlan_insert)(dev, vf, on);
+   return 0;
+}
+
+int
+rte_eth_dev_set_tx_loopback(uint8_t port_id, int on)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+
+  

[dpdk-dev] [RFC PATCH v2 2/5] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-08-26 Thread Bernard Iremonger
call _rte_eth_dev_callback_process_vf from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform
the function.
If the cb_param.retval is RTE_ETH_MB_EVENT_PROCEED then continue,
if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

Signed-off-by: azelezniak 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_pf.c | 39 ++-
 1 file changed, 34 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 56393ff..bb14106 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -660,6 +660,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
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);
+   struct rte_eth_mb_event_param cb_param;

retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
if (retval) {
@@ -674,27 +675,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t 
vf)
/* flush the ack before we write any messages back */
IXGBE_WRITE_FLUSH(hw);

+   /**
+* initialise structure to send to user application
+* will return response from user in retval field
+*/
+   cb_param.retval = RTE_ETH_MB_EVENT_PROCEED;
+   cb_param.vfid = vf;
+   cb_param.msg_type = msgbuf[0] & 0x;
+   cb_param.userdata = (void *)msgbuf;
+
/* perform VF reset */
if (msgbuf[0] == IXGBE_VF_RESET) {
int ret = ixgbe_vf_reset(dev, vf, msgbuf);

vfinfo[vf].clear_to_send = true;
+
+   /* notify application about VF reset */
+   _rte_eth_dev_callback_process_vf(dev, RTE_ETH_EVENT_VF_MBOX, 
_param);
return ret;
}

+   /**
+* ask user application if we allowed to perform those functions
+* if we get cb_param.retval == RTE_ETH_MB_EVENT_PROCEED then business
+* as usual,
+* if 0, do nothing and send ACK to VF
+* if cb_param.retval > 1, do nothing and send NAK to VF
+*/
+   _rte_eth_dev_callback_process_vf(dev, RTE_ETH_EVENT_VF_MBOX, _param);
+
+   retval = cb_param.retval;
+
/* check & process VF to PF mailbox message */
switch ((msgbuf[0] & 0x)) {
case IXGBE_VF_SET_MAC_ADDR:
-   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+   if (retval == RTE_ETH_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_MULTICAST:
-   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+   if (retval == RTE_ETH_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_LPE:
-   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+   if (retval == RTE_ETH_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_VLAN:
-   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+   if (retval == RTE_ETH_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
break;
case IXGBE_VF_API_NEGOTIATE:
retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
@@ -704,7 +732,8 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE;
break;
case IXGBE_VF_UPDATE_XCAST_MODE:
-   retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
+   if (retval == RTE_ETH_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
break;
default:
PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
-- 
2.9.0



[dpdk-dev] [RFC PATCH v2 1/5] librte_ether: add internal callback functions

2016-08-26 Thread Bernard Iremonger
add _rte_eth_dev_callback_process_vf function.
add _rte_eth_dev_callback_process_generic function

Adding a callback to the user application on VF to PF mailbox message,
allows passing information to the application controlling the PF
when a VF mailbox event message is received, such as VF reset.

Signed-off-by: azelezniak 
Signed-off-by: Bernard Iremonger 
---
 lib/librte_ether/rte_ethdev.c  | 17 ++
 lib/librte_ether/rte_ethdev.h  | 61 ++
 lib/librte_ether/rte_ether_version.map |  7 
 3 files changed, 85 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f62a9ec..1388ea3 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2690,6 +2690,20 @@ void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
enum rte_eth_event_type event)
 {
+   return _rte_eth_dev_callback_process_generic(dev, event, NULL);
+}
+
+void
+_rte_eth_dev_callback_process_vf(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param)
+{
+   return _rte_eth_dev_callback_process_generic(dev, event, param);
+}
+
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param)
+{
struct rte_eth_dev_callback *cb_lst;
struct rte_eth_dev_callback dev_cb;

@@ -2699,6 +2713,9 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
continue;
dev_cb = *cb_lst;
cb_lst->active = 1;
+   if (param != NULL)
+   dev_cb.cb_arg = (void *) param;
+
rte_spinlock_unlock(_eth_dev_cb_lock);
dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
dev_cb.cb_arg);
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index b0fe033..4fb0b9c 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3047,9 +3047,27 @@ enum rte_eth_event_type {
/**< queue state event (enabled/disabled) */
RTE_ETH_EVENT_INTR_RESET,
/**< reset interrupt event, sent to VF on PF reset */
+   RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
RTE_ETH_EVENT_MAX   /**< max value of this enum */
 };

+/**
+ * Response sent back to ixgbe driver from user app after callback
+ */
+enum rte_eth_mb_event_rsp {
+   RTE_ETH_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+   RTE_ETH_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+   RTE_ETH_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+   RTE_ETH_MB_EVENT_MAX   /**< max value of this enum */
+};
+
+struct rte_eth_mb_event_param {
+   uint16_t vfid;
+   uint16_t msg_type;
+   uint16_t retval;
+   void *userdata;
+};
+
 typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \
enum rte_eth_event_type event, void *cb_arg);
 /**< user application callback to be registered for interrupts */
@@ -3114,6 +3132,49 @@ void _rte_eth_dev_callback_process(struct rte_eth_dev 
*dev,
enum rte_eth_event_type event);

 /**
+ * @internal Executes all the user application registered callbacks for
+ * the specific device where parameter have to be passed to user application.
+ * It is for DPDK internal user only. User application should not call it
+ * directly.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ * @param event
+ *  Eth device interrupt event type.
+ *
+ * @param param
+ *  parameters to pass back to user application.
+ *
+ * @return
+ *  void
+ */
+
+void
+_rte_eth_dev_callback_process_vf(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param);
+
+/**
+ * @internal Executes all the user application registered callbacks. Used by:
+ * _rte_eth_dev_callback_process and _rte_eth_dev_callback_process_vf
+ * It is for DPDK internal user only. User application should not call it
+ * directly.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ * @param event
+ *  Eth device interrupt event type.
+ *
+ * @param param
+ *  parameters to pass back to user application.
+ *
+ * @return
+ *  void
+ */
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param);
+
+/**
  * When there is no rx packet coming in Rx Queue for a long time, we can
  * sleep lcore related to RX Queue for power saving, and enable rx interrupt
  * to be triggered when rx packect arrives.
diff --git a/lib/librte_ether/rte_ether_version.map 
b/lib/librte_ether/rte_ether_version.map
index 45ddf44..cb7ef15 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -139,3 +139,10 @@ DPDK_16.07 {
rte_eth_dev_get_port_by_name;
rte

[dpdk-dev] [RFC PATCH v2 0/5] add API's for VF management

2016-08-26 Thread Bernard Iremonger
This RFC patchset contains new DPDK API's requested by AT for use
with the Virtual Function Daemon (VFD).

The need to configure and manage VF's on a NIC has grown to the
point where AT have devloped a DPDK based tool, VFD, to do this.

This RFC proposes to add the following API extensions to DPDK:
  mailbox communication callback support
  VF configuration

Nine new functions have been added to the eth_dev_ops structure.
Corresponding functions have been added to the ixgbe PMD for the
Niantic NIC.

Two new callback functions have been added.
Changes have been made to the ixgbe_rcv_msg_from_vf function to
use the callback functions.

Changes have been made to testpmd to facilitate testing of the new API's.
The testpmd documentation has been updated to document the testpmd changes.

Note:
Adding new functions to the eth_dev_ops structure will cause an
ABI breakage.

Changes in V2:
rebase to latest master branch.
fix compile  error with clang.

Bernard Iremonger (5):
  librte_ether: add internal callback functions
  net/ixgbe: add callback to user app on VF to PF mbox msg
  librte_ether: add API's for VF management
  net/ixgbe: add functions for VF management
  app/test_pmd: add tests for new API's

 app/test-pmd/cmdline.c  | 700 
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  68 ++-
 drivers/net/ixgbe/ixgbe_ethdev.c| 179 +++
 drivers/net/ixgbe/ixgbe_pf.c|  39 +-
 lib/librte_ether/rte_ethdev.c   | 176 +++
 lib/librte_ether/rte_ethdev.h   | 284 +++
 lib/librte_ether/rte_ether_version.map  |  16 +
 7 files changed, 1455 insertions(+), 7 deletions(-)

-- 
2.9.0



[dpdk-dev] [PATCH] net/ixgbe: support multiqueue mode VMDq DCB with SRIOV

2016-08-26 Thread Bernard Iremonger
modify ixgbe_dcb_tx_hw_config function.
modify ixgbe_dev_mq_rx_configure function.
modify ixgbe_configure_dcb function.

Signed-off-by: Rahul R Shah 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c |  9 -
 drivers/net/ixgbe/ixgbe_rxtx.c   | 37 +
 2 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fb618ef..3e62e9e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1997,6 +1997,8 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
/* check multi-queue mode */
switch (dev_conf->rxmode.mq_mode) {
case ETH_MQ_RX_VMDQ_DCB:
+   PMD_INIT_LOG(INFO, "ETH_MQ_RX_VMDQ_DCB mode supported 
in SRIOV");
+   break;
case ETH_MQ_RX_VMDQ_DCB_RSS:
/* DCB/RSS VMDQ in SRIOV mode, not implement yet */
PMD_INIT_LOG(ERR, "SRIOV active,"
@@ -2032,11 +2034,8 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)

switch (dev_conf->txmode.mq_mode) {
case ETH_MQ_TX_VMDQ_DCB:
-   /* DCB VMDQ in SRIOV mode, not implement yet */
-   PMD_INIT_LOG(ERR, "SRIOV is active,"
-   " unsupported VMDQ mq_mode tx %d.",
-   dev_conf->txmode.mq_mode);
-   return -EINVAL;
+   PMD_INIT_LOG(INFO, "ETH_MQ_TX_VMDQ_DCB mode supported 
in SRIOV");
+   break;
default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
dev->data->dev_conf.txmode.mq_mode = 
ETH_MQ_TX_VMDQ_ONLY;
break;
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 8a306b0..bef5ef5 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   Copyright 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -3312,15 +3312,16 @@ ixgbe_vmdq_dcb_configure(struct rte_eth_dev *dev)

 /**
  * ixgbe_dcb_config_tx_hw_config - Configure general DCB TX parameters
- * @hw: pointer to hardware structure
+ * @dev: pointer to eth_dev structure
  * @dcb_config: pointer to ixgbe_dcb_config structure
  */
 static void
-ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
+ixgbe_dcb_tx_hw_config(struct rte_eth_dev *dev,
   struct ixgbe_dcb_config *dcb_config)
 {
uint32_t reg;
uint32_t q;
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);

PMD_INIT_FUNC_TRACE();
if (hw->mac.type != ixgbe_mac_82598EB) {
@@ -3338,11 +3339,17 @@ ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
if (dcb_config->vt_mode)
reg |= IXGBE_MTQC_VT_ENA;
IXGBE_WRITE_REG(hw, IXGBE_MTQC, reg);
-
-   /* Disable drop for all queues */
-   for (q = 0; q < 128; q++)
-   IXGBE_WRITE_REG(hw, IXGBE_QDE,
-   (IXGBE_QDE_WRITE | (q << IXGBE_QDE_IDX_SHIFT)));
+   if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
+   /* Disable drop for all queues in VMDQ mode*/
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT) | IXGBE_QDE_ENABLE));
+   } else {
+   /* Enable drop for all queues in SRIOV mode */
+   for (q = 0; q < 128; q++)
+   IXGBE_WRITE_REG(hw, IXGBE_QDE,
+   (IXGBE_QDE_WRITE | (q << 
IXGBE_QDE_IDX_SHIFT)));
+   }

/* Enable the Tx desc arbiter */
reg = IXGBE_READ_REG(hw, IXGBE_RTTDCS);
@@ -3377,7 +3384,7 @@ ixgbe_vmdq_dcb_hw_tx_config(struct rte_eth_dev *dev,
vmdq_tx_conf->nb_queue_pools == ETH_16_POOLS ? 0x : 
0x);

/*Configure general DCB TX parameters*/
-   ixgbe_dcb_tx_hw_config(hw, dcb_config);
+   ixgbe_dcb_tx_hw_config(dev, dcb_config);
 }

 static void
@@ -3660,7 +3667,7 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
/*get DCB TX configuration parameters from rte_eth_conf*/
ixgbe_dcb_tx_config(dev, dcb_config);
/*Configure general DCB TX parameters*/
-   ixgbe_dcb_tx_hw_config(hw, dcb_config);
+   ixgbe_dcb_tx_hw_config(dev, dcb_config);
break;
  

[dpdk-dev] [RFC PATCH 5/5] app/test_pmd: add tests for new API's

2016-08-18 Thread Bernard Iremonger
add test for vf vlan anti spoof
add test for vf mac anti spoof
add test for vf ping
add test for vf vlan strip
add test for vf vlan insert
add test for tx loopback
add test for all queues drop enable bit
add test for vf split drop enable bit
add test for vf mac address
add new API's to the testpmd guide

Signed-off-by: Bernard Iremonger 
---
 app/test-pmd/cmdline.c  | 700 
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  68 ++-
 2 files changed, 766 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f90befc..12e89c3 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -10585,6 +10585,697 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
},
 };

+/* vf vlan anti spoof configuration */
+
+/* Common result structure for vf vlan anti spoof */
+struct cmd_vf_vlan_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t vlan;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   uint8_t on;
+};
+
+/* Common CLI fields for vf vlan anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+set, "set");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vf =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vf, "vf");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vlan =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vlan, "vlan");
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_antispoof =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+antispoof, "antispoof");
+cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_port_id =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_vf_id =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_on =
+   TOKEN_NUM_INITIALIZER
+   (struct cmd_vf_vlan_anti_spoof_result,
+on, UINT8);
+
+static void
+cmd_set_vf_vlan_anti_spoof_parsed(
+   void *parsed_result,
+   __attribute__((unused)) struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   struct cmd_vf_vlan_anti_spoof_result *res = parsed_result;
+   int ret = 0;
+
+   if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+   return;
+
+   if (res->vf_id > 63) {
+   printf("vf_id must be less than 64.\n");
+   return;
+   }
+   ret = rte_eth_dev_set_vf_vlan_anti_spoof(res->port_id, res->vf_id, 
res->on);
+   if (ret < 0)
+   printf("vf vlan anti spoofing programming error: (%s)\n",
+  strerror(-ret));
+}
+
+cmdline_parse_inst_t cmd_set_vf_vlan_anti_spoof = {
+   .f = cmd_set_vf_vlan_anti_spoof_parsed,
+   .data = NULL,
+   .help_str = "enable/disable vf vlan anti spoof",
+   .tokens = {
+   (void *)_vf_vlan_anti_spoof_set,
+   (void *)_vf_vlan_anti_spoof_vf,
+   (void *)_vf_vlan_anti_spoof_vlan,
+   (void *)_vf_vlan_anti_spoof_antispoof,
+   (void *)_vf_vlan_anti_spoof_port_id,
+   (void *)_vf_vlan_anti_spoof_vf_id,
+   (void *)_vf_vlan_anti_spoof_on,
+   NULL,
+   },
+};
+
+/* vf mac anti spoof configuration */
+
+/* Common result structure for vf mac anti spoof */
+struct cmd_vf_mac_anti_spoof_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t vf;
+   cmdline_fixed_string_t mac;
+   cmdline_fixed_string_t antispoof;
+   uint8_t port_id;
+   uint32_t vf_id;
+   uint8_t on;
+};
+
+/* Common CLI fields for vf mac anti spoof enable disable */
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_set =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+set, "set");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_vf =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+vf, "vf");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_mac =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+mac, "mac");
+cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_antispoof =
+   TOKEN_STRING_INITIALIZER
+   (struct cmd_vf_mac_anti_spoof_result,
+antispoof, "

[dpdk-dev] [RFC PATCH 4/5] net/ixgbe: add functions for VF management

2016-08-18 Thread Bernard Iremonger
Add new functions to configure and manage VF's on a Niantic NIC.

add ixgbe_vf_ping function.
add ixgbe_set_vf_vlan_anti_spoof function.
add ixgbe_set_vf_mac_anti_spoof function.

Signed-off-by: azelezniak 

add ixgbe_set_vf_vlan_strip function
add ixgbe_set_vf_vlan_insert function.
add ixgbe_set_tx_loopback function.
add ixgbe_set_all_queues_drop function.
add ixgbe_set_vf_split_drop_en function.
add ixgbe_set_vf_mac_addr function.

Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 179 +++
 1 file changed, 179 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d478a15..3b0ee82 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -240,6 +240,8 @@ static void ixgbe_add_rar(struct rte_eth_dev *dev, struct 
ether_addr *mac_addr,
 static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index);
 static void ixgbe_set_default_mac_addr(struct rte_eth_dev *dev,
   struct ether_addr *mac_addr);
+static int ixgbe_set_vf_mac_addr(struct rte_eth_dev *dev, uint16_t vf,
+   struct ether_addr *mac_addr);
 static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config 
*dcb_config);

 /* For Virtual Function support */
@@ -280,6 +282,19 @@ 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 void ixgbe_set_vf_vlan_anti_spoof(struct rte_eth_dev *dev,
+   uint16_t vf, uint8_t on);
+static void ixgbe_set_vf_mac_anti_spoof(struct rte_eth_dev *dev,
+   uint16_t vf, uint8_t on);
+static int ixgbe_vf_ping(struct rte_eth_dev *dev, int32_t vf);
+static void ixgbe_set_vf_vlan_strip(struct rte_eth_dev *dev,
+   int on, uint16_t queues_per_pool);
+static void ixgbe_set_vf_vlan_insert(struct rte_eth_dev *dev, uint16_t vf,
+   int vlan);
+static void ixgbe_set_tx_loopback(struct rte_eth_dev *dev, int on);
+static void ixgbe_set_all_queues_drop_en(struct rte_eth_dev *dev, int state);
+static void ixgbe_set_vf_split_drop_en(struct rte_eth_dev *dev, uint16_t vf,
+   int state);
 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);
@@ -505,6 +520,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.mac_addr_add = ixgbe_add_rar,
.mac_addr_remove  = ixgbe_remove_rar,
.mac_addr_set = ixgbe_set_default_mac_addr,
+   .set_vf_mac_addr  = ixgbe_set_vf_mac_addr,
.uc_hash_table_set= ixgbe_uc_hash_table_set,
.uc_all_hash_table_set  = ixgbe_uc_all_hash_table_set,
.mirror_rule_set  = ixgbe_mirror_rule_set,
@@ -513,6 +529,14 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.set_vf_rx= ixgbe_set_pool_rx,
.set_vf_tx= ixgbe_set_pool_tx,
.set_vf_vlan_filter   = ixgbe_set_pool_vlan_filter,
+   .set_vf_vlan_anti_spoof  = ixgbe_set_vf_vlan_anti_spoof,
+   .set_vf_mac_anti_spoof   = ixgbe_set_vf_mac_anti_spoof,
+   .vf_ping  = ixgbe_vf_ping,
+   .set_vf_vlan_strip= ixgbe_set_vf_vlan_strip,
+   .set_vf_vlan_insert   = ixgbe_set_vf_vlan_insert,
+   .set_tx_loopback  = ixgbe_set_tx_loopback,
+   .set_all_queues_drop_en = ixgbe_set_all_queues_drop_en,
+   .set_vf_split_drop_en = ixgbe_set_vf_split_drop_en,
.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,
@@ -4012,6 +4036,22 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, 
struct ether_addr *addr)
 }

 static int
+ixgbe_set_vf_mac_addr(struct rte_eth_dev *dev, uint16_t vf, struct ether_addr 
*mac_addr)
+{
+   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));
+   int rar_entry = hw->mac.num_rar_entries - (vf + 1);
+   uint8_t *new_mac = (uint8_t *)(mac_addr);
+
+   if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) {
+   rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 
ETHER_ADDR_LEN);
+   return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, 
IXGBE_RAH_AV);
+   }
+   return -1;
+}
+
+static int
 ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
uint32_t hlreg0;
@@ -4315,6 +4355,16 @@ ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, 
uint16_t queue, int on)
 }

 static void
+ixgbe_set_vf_vlan_strip(struct rte

[dpdk-dev] [RFC PATCH 3/5] librte_ether: add API's for VF management

2016-08-18 Thread Bernard Iremonger
Add new API functions to configure and manage VF's on a NIC.

add rte_eth_dev_vf_ping function.
add rte_eth_dev_set_vf_vlan_anti_spoof function.
add rte_eth_dev_set_vf_mac_anti_spoof function.

Signed-off-by: azelezniak 

add rte_eth_dev_set_vf_vlan_strip function.
add rte_eth_dev_set_vf_vlan_insert function.
add rte_eth_dev_set_loopback function.
add rte_eth_dev_set_all_queues_drop function.
add rte_eth_dev_set_vf_split_drop_en function
add rte_eth_dev_set_vf_mac_addr function.
increment LIBABIVER to 5.

Signed-off-by: Bernard Iremonger 
---
 lib/librte_ether/rte_ethdev.c  | 159 +++
 lib/librte_ether/rte_ethdev.h  | 223 +
 lib/librte_ether/rte_ether_version.map |   9 ++
 3 files changed, 391 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 1388ea3..2a3d2ae 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2306,6 +2306,22 @@ rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct 
ether_addr *addr)
 }

 int
+rte_eth_dev_set_vf_mac_addr(uint8_t port_id, uint16_t vf, struct ether_addr 
*addr)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   if (!is_valid_assigned_ether_addr(addr))
+   return -EINVAL;
+
+   dev = _eth_devices[port_id];
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_mac_addr, -ENOTSUP);
+
+   return (*dev->dev_ops->set_vf_mac_addr)(dev, vf, addr);
+}
+
+int
 rte_eth_dev_set_vf_rxmode(uint8_t port_id,  uint16_t vf,
uint16_t rx_mode, uint8_t on)
 {
@@ -2490,6 +2506,149 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, 
uint16_t vlan_id,
   vf_mask, vlan_on);
 }

+int
+rte_eth_dev_set_vf_vlan_anti_spoof(uint8_t port_id,
+  uint16_t vf, uint8_t on)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   if (vf > 63) {
+   RTE_PMD_DEBUG_TRACE("VF VLAN anti spoof:VF %d > 63\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_anti_spoof, 
-ENOTSUP);
+   (*dev->dev_ops->set_vf_vlan_anti_spoof)(dev, vf, on);
+   return 0;
+}
+
+int
+rte_eth_dev_set_vf_mac_anti_spoof(uint8_t port_id,
+  uint16_t vf, uint8_t on)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   if (vf > 63) {
+   RTE_PMD_DEBUG_TRACE("VF MAC anti spoof:VF %d > 63\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_mac_anti_spoof, -ENOTSUP);
+   (*dev->dev_ops->set_vf_mac_anti_spoof)(dev, vf, on);
+   return 0;
+}
+
+int
+rte_eth_dev_vf_ping(uint8_t port_id, int32_t vf)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   if (vf > 63) {
+   RTE_PMD_DEBUG_TRACE("VF ping: VF %d > 64\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vf_ping, -ENOTSUP);
+   return (*dev->dev_ops->vf_ping)(dev, vf);
+}
+
+int
+rte_eth_dev_set_vf_vlan_strip(uint8_t port_id, uint16_t vf, int on)
+{
+   struct rte_eth_dev *dev;
+   struct rte_eth_dev_info dev_info;
+   uint16_t queues_per_pool;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   if (vf > 63) {
+   RTE_PMD_DEBUG_TRACE("VF vlan strip set VF %d > 63\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_strip, -ENOTSUP);
+
+   rte_eth_dev_info_get(port_id, _info);
+   queues_per_pool = dev_info.vmdq_queue_num/dev_info.max_vmdq_pools;
+
+   (*dev->dev_ops->set_vf_vlan_strip)(dev, on, queues_per_pool);
+   return 0;
+}
+
+int
+rte_eth_dev_set_vf_vlan_insert(uint8_t port_id, uint16_t vf, int on)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+   if (vf > 63) {
+   RTE_PMD_DEBUG_TRACE("VF vlan insert set VF %d > 63\n", vf);
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_insert, -ENOTSUP);
+
+   (*dev->dev_ops->set_vf_vlan_insert)(dev, vf, on);
+   return 0;
+}
+
+int
+rte_eth_dev_set_tx_loopback(uint8_t port_id, int on)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+
+  

[dpdk-dev] [RFC PATCH 2/5] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-08-18 Thread Bernard Iremonger
call _rte_eth_dev_callback_process_vf from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform
the function.
If the cb_param.retval is RTE_ETH_MB_EVENT_PROCEED then continue,
if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

Signed-off-by: azelezniak 
Signed-off-by: Bernard Iremonger 
---
 drivers/net/ixgbe/ixgbe_pf.c | 39 ++-
 1 file changed, 34 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 56393ff..bb14106 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -660,6 +660,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
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);
+   struct rte_eth_mb_event_param cb_param;

retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
if (retval) {
@@ -674,27 +675,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t 
vf)
/* flush the ack before we write any messages back */
IXGBE_WRITE_FLUSH(hw);

+   /**
+* initialise structure to send to user application
+* will return response from user in retval field
+*/
+   cb_param.retval = RTE_ETH_MB_EVENT_PROCEED;
+   cb_param.vfid = vf;
+   cb_param.msg_type = msgbuf[0] & 0x;
+   cb_param.userdata = (void *)msgbuf;
+
/* perform VF reset */
if (msgbuf[0] == IXGBE_VF_RESET) {
int ret = ixgbe_vf_reset(dev, vf, msgbuf);

vfinfo[vf].clear_to_send = true;
+
+   /* notify application about VF reset */
+   _rte_eth_dev_callback_process_vf(dev, RTE_ETH_EVENT_VF_MBOX, 
_param);
return ret;
}

+   /**
+* ask user application if we allowed to perform those functions
+* if we get cb_param.retval == RTE_ETH_MB_EVENT_PROCEED then business
+* as usual,
+* if 0, do nothing and send ACK to VF
+* if cb_param.retval > 1, do nothing and send NAK to VF
+*/
+   _rte_eth_dev_callback_process_vf(dev, RTE_ETH_EVENT_VF_MBOX, _param);
+
+   retval = cb_param.retval;
+
/* check & process VF to PF mailbox message */
switch ((msgbuf[0] & 0x)) {
case IXGBE_VF_SET_MAC_ADDR:
-   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+   if (retval == RTE_ETH_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_MULTICAST:
-   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+   if (retval == RTE_ETH_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_LPE:
-   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+   if (retval == RTE_ETH_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
break;
case IXGBE_VF_SET_VLAN:
-   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+   if (retval == RTE_ETH_MB_EVENT_PROCEED)
+   retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
break;
case IXGBE_VF_API_NEGOTIATE:
retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
@@ -704,7 +732,8 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE;
break;
case IXGBE_VF_UPDATE_XCAST_MODE:
-   retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
+   if (retval == RTE_ETH_MB_EVENT_PROCEED)
+   retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
break;
default:
PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
-- 
2.9.0



[dpdk-dev] [RFC PATCH 1/5] librte_ether: add internal callback functions

2016-08-18 Thread Bernard Iremonger
add _rte_eth_dev_callback_process_vf function.
add _rte_eth_dev_callback_process_generic function

Adding a callback to the user application on VF to PF mailbox message,
allows passing information to the application controlling the PF
when a VF mailbox event message is received, such as VF reset.

Signed-off-by: azelezniak 
Signed-off-by: Bernard Iremonger 
---
 lib/librte_ether/rte_ethdev.c  | 17 ++
 lib/librte_ether/rte_ethdev.h  | 61 ++
 lib/librte_ether/rte_ether_version.map |  7 
 3 files changed, 85 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f62a9ec..1388ea3 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2690,6 +2690,20 @@ void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
enum rte_eth_event_type event)
 {
+   return _rte_eth_dev_callback_process_generic(dev, event, NULL);
+}
+
+void
+_rte_eth_dev_callback_process_vf(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param)
+{
+   return _rte_eth_dev_callback_process_generic(dev, event, param);
+}
+
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param)
+{
struct rte_eth_dev_callback *cb_lst;
struct rte_eth_dev_callback dev_cb;

@@ -2699,6 +2713,9 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
continue;
dev_cb = *cb_lst;
cb_lst->active = 1;
+   if (param != NULL)
+   dev_cb.cb_arg = (void *) param;
+
rte_spinlock_unlock(_eth_dev_cb_lock);
dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
dev_cb.cb_arg);
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index b0fe033..4fb0b9c 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3047,9 +3047,27 @@ enum rte_eth_event_type {
/**< queue state event (enabled/disabled) */
RTE_ETH_EVENT_INTR_RESET,
/**< reset interrupt event, sent to VF on PF reset */
+   RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
RTE_ETH_EVENT_MAX   /**< max value of this enum */
 };

+/**
+ * Response sent back to ixgbe driver from user app after callback
+ */
+enum rte_eth_mb_event_rsp {
+   RTE_ETH_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+   RTE_ETH_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+   RTE_ETH_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+   RTE_ETH_MB_EVENT_MAX   /**< max value of this enum */
+};
+
+struct rte_eth_mb_event_param {
+   uint16_t vfid;
+   uint16_t msg_type;
+   uint16_t retval;
+   void *userdata;
+};
+
 typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \
enum rte_eth_event_type event, void *cb_arg);
 /**< user application callback to be registered for interrupts */
@@ -3114,6 +3132,49 @@ void _rte_eth_dev_callback_process(struct rte_eth_dev 
*dev,
enum rte_eth_event_type event);

 /**
+ * @internal Executes all the user application registered callbacks for
+ * the specific device where parameter have to be passed to user application.
+ * It is for DPDK internal user only. User application should not call it
+ * directly.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ * @param event
+ *  Eth device interrupt event type.
+ *
+ * @param param
+ *  parameters to pass back to user application.
+ *
+ * @return
+ *  void
+ */
+
+void
+_rte_eth_dev_callback_process_vf(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param);
+
+/**
+ * @internal Executes all the user application registered callbacks. Used by:
+ * _rte_eth_dev_callback_process and _rte_eth_dev_callback_process_vf
+ * It is for DPDK internal user only. User application should not call it
+ * directly.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ * @param event
+ *  Eth device interrupt event type.
+ *
+ * @param param
+ *  parameters to pass back to user application.
+ *
+ * @return
+ *  void
+ */
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+   enum rte_eth_event_type event, void *param);
+
+/**
  * When there is no rx packet coming in Rx Queue for a long time, we can
  * sleep lcore related to RX Queue for power saving, and enable rx interrupt
  * to be triggered when rx packect arrives.
diff --git a/lib/librte_ether/rte_ether_version.map 
b/lib/librte_ether/rte_ether_version.map
index 45ddf44..cb7ef15 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -139,3 +139,10 @@ DPDK_16.07 {
rte_eth_dev_get_port_by_name;
rte

[dpdk-dev] [RFC PATCH 0/5] add API's for VF management

2016-08-18 Thread Bernard Iremonger
This RFC patchset contains new DPDK API's requested by AT for use
with the Virtual Function Daemon (VFD).

The need to configure and manage VF's on a NIC has grown to the
point where AT have devloped a DPDK based tool, VFD, to do this.

This RFC proposes to add the following API extensions to DPDK:
  mailbox communication callback support
  VF configuration

Nine new functions have been added to the eth_dev_ops structure.
Corresponding functions have been added to the ixgbe PMD for the
Niantic NIC.

Two new callback functions have been added.
Changes have been made to the ixgbe_rcv_msg_from_vf function to
use the callback functions.

Changes have been made to testpmd to facilitate testing of the new API's.
The testpmd documentation has been updated to document the testpmd changes.

Note:
Adding new functions to the eth_dev_ops structure will cause an
ABI breakage.

Bernard Iremonger (5):
  librte_ether: add internal callback functions
  net/ixgbe: add callback to user app on VF to PF mbox msg
  librte_ether: add API's for VF management
  net/ixgbe: add functions for VF management
  app/test_pmd: add tests for new API's

 app/test-pmd/cmdline.c  | 700 
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  68 ++-
 drivers/net/ixgbe/ixgbe_ethdev.c| 179 +++
 drivers/net/ixgbe/ixgbe_pf.c|  39 +-
 lib/librte_ether/rte_ethdev.c   | 176 +++
 lib/librte_ether/rte_ethdev.h   | 284 +++
 lib/librte_ether/rte_ether_version.map  |  16 +
 7 files changed, 1455 insertions(+), 7 deletions(-)

-- 
2.9.0



[dpdk-dev] [PATCH v5 2/2] doc: add live migration virtio sriov image

2016-07-19 Thread Bernard Iremonger
This patch adds an image of the Live Migration for
virtio and sriov test configuration.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/howto/img/lm_bond_virtio_sriov.svg | 666 ++
 doc/guides/howto/lm_bond_virtio_sriov.rst |   4 +
 2 files changed, 670 insertions(+)
 create mode 100644 doc/guides/howto/img/lm_bond_virtio_sriov.svg

diff --git a/doc/guides/howto/img/lm_bond_virtio_sriov.svg 
b/doc/guides/howto/img/lm_bond_virtio_sriov.svg
new file mode 100644
index 000..d913ae0
--- /dev/null
+++ b/doc/guides/howto/img/lm_bond_virtio_sriov.svg
@@ -0,0 +1,666 @@
+
+
+
+http://purl.org/dc/elements/1.1/;
+   xmlns:cc="http://creativecommons.org/ns#;
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
+   xmlns:svg="http://www.w3.org/2000/svg;
+   xmlns="http://www.w3.org/2000/svg;
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape;
+   width="1052.8693"
+   height="762.99158"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="lm_overview.svg">
+  
+
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+
+  
+image/svg+xml
+http://purl.org/dc/dcmitype/StillImage; />
+
+  
+
+  
+  
+
+
+
+
+
+
+
+
+VM 1 
+Switch with 10Gb ports
+Server 1
+Server 2
+  10 Gb Traffic Generator
+VM 2 
+Linux, KVM, QEMU 
+Linux, KVM, QEMU 
+10 Gb NIC
+10 Gb NIC
+
+
+10 Gb NIC
+10 Gb NIC
+
+DPDK Testpmd App.
+bonded device withvirtio and VF slaves
+
+DPDK Testpmd App.
+bonded device withvirtio and VF slaves
+Kernel PF driver
+Kernel PF driver
+SW bridge with Tapand PF connected 
+NFS ServerVM disk image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+SW bridge with Tapand PF connected 
+10 Gb Migration Link
+  
+
diff --git a/doc/guides/howto/lm_bond_virtio_sriov.rst 
b/doc/guides/howto/lm_bond_virtio_sriov.rst
index 6cf797d..49666f1 100644
--- a/doc/guides/howto/lm_bond_virtio_sriov.rst
+++ b/doc/guides/howto/lm_bond_virtio_sriov.rst
@@ -67,6 +67,10 @@ The ip address of host_server_1 is 10.237.212.46

 The ip address of host_server_2 is 10.237.212.131

+.. _figure_lm_bond_virtio_sriov:
+
+.. figure:: img/lm_bond_virtio_sriov.*
+
 Live Migration steps
 

-- 
2.9.0



[dpdk-dev] [PATCH v5 1/2] doc: live migration of VM with Virtio and VF

2016-07-19 Thread Bernard Iremonger
This patch describes the procedure to be be followed
to perform Live Migration of a VM with Virtio and VF PMD's
using the bonding PMD.

It includes sample host and VM scripts used in the procedure,
and a sample switch configuration.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/howto/index.rst|  38 ++
 doc/guides/howto/lm_bond_virtio_sriov.rst | 709 ++
 doc/guides/index.rst  |   1 +
 3 files changed, 748 insertions(+)
 create mode 100644 doc/guides/howto/index.rst
 create mode 100644 doc/guides/howto/lm_bond_virtio_sriov.rst

diff --git a/doc/guides/howto/index.rst b/doc/guides/howto/index.rst
new file mode 100644
index 000..5ff7526
--- /dev/null
+++ b/doc/guides/howto/index.rst
@@ -0,0 +1,38 @@
+..  BSD LICENSE
+Copyright(c) 2016 Intel Corporation. All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Intel Corporation nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+How To User Guides
+==
+
+.. toctree::
+:maxdepth: 2
+:numbered:
+
+lm_bond_virtio_sriov
diff --git a/doc/guides/howto/lm_bond_virtio_sriov.rst 
b/doc/guides/howto/lm_bond_virtio_sriov.rst
new file mode 100644
index 000..6cf797d
--- /dev/null
+++ b/doc/guides/howto/lm_bond_virtio_sriov.rst
@@ -0,0 +1,709 @@
+..  BSD LICENSE
+Copyright(c) 2016 Intel Corporation. All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Intel Corporation nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Live Migration of VM with SR-IOV VF
+===
+
+Overview
+
+
+It is not possible to migrate a Virtual Machine which has an SR-IOV Virtual 
Function (VF).
+
+To get around this problem the bonding PMD is used.
+
+The following sections show an example of how to do this.
+
+Test Setup
+--
+
+A bonded device is created in the VM.
+The virtio and VF PMD's are added as slaves to the bonded device.
+The VF is set as the primary slave of the bonded device.
+
+A bridge must be set up on the Host connecting the tap device, w

[dpdk-dev] [PATCH v5 0/2] doc: live migration procedure

2016-07-19 Thread Bernard Iremonger
This patch set describes the procedure to Live migrate
a VM with Virtio and VF PMD's using the bonding PMD.

Changes in v5:
restore missing image file
change Guide to Guides in heading

Changes in v4:
rename image file and patch
added links to rst file
updated rst file in line with comments

Changes in v3:
rename directory from how_to to howto
move to after FAQ in the index

Changes in v2:
change primary port before removing slave port
remove unused variables from QEMU scripts
identify NIC's in bridge setup scripts

Bernard Iremonger (2):
  doc: live migration of VM with Virtio and VF
  doc: add live migration virtio sriov image

 doc/guides/howto/img/lm_bond_virtio_sriov.svg | 666 
 doc/guides/howto/index.rst|  38 ++
 doc/guides/howto/lm_bond_virtio_sriov.rst | 713 ++
 doc/guides/index.rst  |   1 +
 4 files changed, 1418 insertions(+)
 create mode 100644 doc/guides/howto/img/lm_bond_virtio_sriov.svg
 create mode 100644 doc/guides/howto/index.rst
 create mode 100644 doc/guides/howto/lm_bond_virtio_sriov.rst

-- 
2.9.0



[dpdk-dev] [PATCH v3 2/2] doc: add vhost_user live migration image

2016-07-18 Thread Bernard Iremonger
This patch adds an image of the Live Migration of a VM using vhost_user
on the host, test configuration.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/howto/img/lm_vhost_user.svg| 644 ++
 doc/guides/howto/lm_virtio_vhost_user.rst |   4 +
 2 files changed, 648 insertions(+)
 create mode 100644 doc/guides/howto/img/lm_vhost_user.svg

diff --git a/doc/guides/howto/img/lm_vhost_user.svg 
b/doc/guides/howto/img/lm_vhost_user.svg
new file mode 100644
index 000..3601cf1
--- /dev/null
+++ b/doc/guides/howto/img/lm_vhost_user.svg
@@ -0,0 +1,644 @@
+
+
+
+http://purl.org/dc/elements/1.1/;
+   xmlns:cc="http://creativecommons.org/ns#;
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
+   xmlns:svg="http://www.w3.org/2000/svg;
+   xmlns="http://www.w3.org/2000/svg;
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape;
+   width="1052.8693"
+   height="762.99158"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="lm_vhost_user.svg">
+  
+
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+
+  
+image/svg+xml
+http://purl.org/dc/dcmitype/StillImage; />
+
+  
+
+  
+  
+
+
+
+
+
+
+
+
+VM 1 
+Switch with 10Gb ports
+Server 1
+Server 2
+  10 Gb Traffic Generator
+VM 2 
+Linux, KVM, QEMU 2.5 
+10 Gb NIC
+10 Gb NIC
+
+
+10 Gb NIC
+10 Gb NIC
+
+
+DPDK Testpmd App
+DPDK virtio PMD's 
+DPDK PF PMD and vhost_user
+DPDK PF PMD and vhost_user
+NFS ServerVM disk image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+10 Gb Migration Link
+DPDK Testpmd App
+DPDK virtio PMD's  
+Linux, KVM, QEMU 2.5 
+  
+
diff --git a/doc/guides/howto/lm_virtio_vhost_user.rst 
b/doc/guides/howto/lm_virtio_vhost_user.rst
index f159608..fad1f2a 100644
--- a/doc/guides/howto/lm_virtio_vhost_user.rst
+++ b/doc/guides/howto/lm_virtio_vhost_user.rst
@@ -60,6 +60,10 @@ The ip address of host_server_1 is 10.237.212.46

 The ip address of host_server_2 is 10.237.212.131

+.. _figure_lm_vhost_user:
+
+.. figure:: img/lm_vhost_user.*
+
 Live Migration steps
 

-- 
2.9.0



[dpdk-dev] [PATCH v3 1/2] doc: live migration of VM with vhost_user on host

2016-07-18 Thread Bernard Iremonger
This patch describes the procedure to be be followed to perform
Live Migration of a VM with Virtio PMD running on a host which
is running the vhost_user sample application (vhost-switch).

It includes sample host and VM scripts used in the procedure.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/howto/index.rst|   1 +
 doc/guides/howto/lm_virtio_vhost_user.rst | 465 ++
 2 files changed, 466 insertions(+)
 create mode 100644 doc/guides/howto/lm_virtio_vhost_user.rst

diff --git a/doc/guides/howto/index.rst b/doc/guides/howto/index.rst
index d5a17fd..2028e1a 100644
--- a/doc/guides/howto/index.rst
+++ b/doc/guides/howto/index.rst
@@ -36,3 +36,4 @@ How To User Guide
 :numbered:

 lm_bond_virtio_sriov
+lm_virtio_vhost_user
diff --git a/doc/guides/howto/lm_virtio_vhost_user.rst 
b/doc/guides/howto/lm_virtio_vhost_user.rst
new file mode 100644
index 000..f159608
--- /dev/null
+++ b/doc/guides/howto/lm_virtio_vhost_user.rst
@@ -0,0 +1,465 @@
+..  BSD LICENSE
+Copyright(c) 2016 Intel Corporation. All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Intel Corporation nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Live Migration of VM with Virtio on host running vhost_user
+===
+
+Overview
+
+
+Live Migration of a VM with DPDK Virtio PMD on a host which is
+running the Vhost sample application (vhost-switch) and using the DPDK PMD 
(ixgbe or i40e).
+
+The Vhost sample application uses VMDQ so SRIOV must be disabled on the NIC's.
+
+The following sections show an example of how to do this migration.
+
+Test Setup
+--
+
+To test the Live Migration two servers with identical operating systems 
installed are used.
+KVM and QEMU is also required on the servers.
+
+QEMU 2.5 is required for Live Migration of a VM with vhost_user running on the 
hosts.
+
+In this example, the servers have Niantic and or Fortville NIC's installed.
+The NIC's on both servers are connected to a switch
+which is also connected to the traffic generator.
+
+The switch is configured to broadcast traffic on all the NIC ports.
+
+The ip address of host_server_1 is 10.237.212.46
+
+The ip address of host_server_2 is 10.237.212.131
+
+Live Migration steps
+
+
+The sample scripts mentioned in the steps below can be found in the
+:ref:`Sample host scripts ` and
+:ref:`Sample VM scripts ` sections.
+
+On host_server_1: Terminal 1
+
+
+Setup DPDK on host_server_1
+
+.. code-block:: console
+
+   cd /root/dpdk/host_scripts
+   ./setup_dpdk_on_host.sh
+
+On host_server_1: Terminal 2
+
+
+Bind the Niantic or Fortville NIC to igb_uio on host_server_1.
+
+For Fortville NIC.
+
+.. code-block:: console
+
+   cd /root/dpdk/tools
+   ./dpdk_nic_bind.py -b igb_uio :02:00.0
+
+For Niantic NIC.
+
+.. code-block:: console
+
+   cd /root/dpdk/tools
+   ./dpdk_nic_bind.py -b igb_uio :09:00.0
+
+On host_server_1: Terminal 3
+
+
+For Fortville and Niantic NIC's reset SRIOV and run the
+vhost_user sample application (vhost-switch) on host_server_1.
+
+.. code-block:: console
+
+   cd /root/dpdk/host_scripts
+   ./reset_vf_on_212_46.sh
+   ./run_vhost_switch_on_host.sh
+
+On host_server_1: Terminal 1
+
+
+Start the VM on host_server_1
+
+.. code-block:: console
+
+   ./vm_virtio_vhost_user.sh
+
+On host_server_1: 

[dpdk-dev] [PATCH v3 0/2] doc: live migration procedure with vhost_user

2016-07-18 Thread Bernard Iremonger
This patchset describes the procedure to Live migrate a VM with
Virtio PMD's with the vhost_user sample application (vhost-switch)
running on the host.

This patchset depends on the following patch:
http://dpdk.org/dev/patchwork/patch/14871

Changes in v3:
added links in rst file
updated rst file in line with comments

Changes in v2:
removed l2fwd information
minor changes to svg file

Bernard Iremonger (2):
  doc: live migration of VM with vhost_user on host
  doc: add vhost_user live migration image

 doc/guides/howto/img/lm_vhost_user.svg| 644 ++
 doc/guides/howto/index.rst|   1 +
 doc/guides/howto/lm_virtio_vhost_user.rst | 469 ++
 3 files changed, 1114 insertions(+)
 create mode 100644 doc/guides/howto/img/lm_vhost_user.svg
 create mode 100644 doc/guides/howto/lm_virtio_vhost_user.rst

-- 
2.9.0



[dpdk-dev] [PATCH v4 2/2] doc: add live migration virtio sriov image

2016-07-18 Thread Bernard Iremonger
This patch adds an image of the Live Migration for
virtio and sriov test configuration.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/howto/lm_bond_virtio_sriov.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/howto/lm_bond_virtio_sriov.rst 
b/doc/guides/howto/lm_bond_virtio_sriov.rst
index 6cf797d..49666f1 100644
--- a/doc/guides/howto/lm_bond_virtio_sriov.rst
+++ b/doc/guides/howto/lm_bond_virtio_sriov.rst
@@ -67,6 +67,10 @@ The ip address of host_server_1 is 10.237.212.46

 The ip address of host_server_2 is 10.237.212.131

+.. _figure_lm_bond_virtio_sriov:
+
+.. figure:: img/lm_bond_virtio_sriov.*
+
 Live Migration steps
 

-- 
2.9.0



[dpdk-dev] [PATCH v4 1/2] doc: live migration of VM with Virtio and VF

2016-07-18 Thread Bernard Iremonger
This patch describes the procedure to be be followed
to perform Live Migration of a VM with Virtio and VF PMD's
using the bonding PMD.

It includes sample host and VM scripts used in the procedure,
and a sample switch configuration.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/howto/index.rst|  38 ++
 doc/guides/howto/lm_bond_virtio_sriov.rst | 709 ++
 doc/guides/index.rst  |   1 +
 3 files changed, 748 insertions(+)
 create mode 100644 doc/guides/howto/index.rst
 create mode 100644 doc/guides/howto/lm_bond_virtio_sriov.rst

diff --git a/doc/guides/howto/index.rst b/doc/guides/howto/index.rst
new file mode 100644
index 000..d5a17fd
--- /dev/null
+++ b/doc/guides/howto/index.rst
@@ -0,0 +1,38 @@
+..  BSD LICENSE
+Copyright(c) 2016 Intel Corporation. All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Intel Corporation nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+How To User Guide
+=
+
+.. toctree::
+:maxdepth: 2
+:numbered:
+
+lm_bond_virtio_sriov
diff --git a/doc/guides/howto/lm_bond_virtio_sriov.rst 
b/doc/guides/howto/lm_bond_virtio_sriov.rst
new file mode 100644
index 000..6cf797d
--- /dev/null
+++ b/doc/guides/howto/lm_bond_virtio_sriov.rst
@@ -0,0 +1,709 @@
+..  BSD LICENSE
+Copyright(c) 2016 Intel Corporation. All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Intel Corporation nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Live Migration of VM with SR-IOV VF
+===
+
+Overview
+
+
+It is not possible to migrate a Virtual Machine which has an SR-IOV Virtual 
Function (VF).
+
+To get around this problem the bonding PMD is used.
+
+The following sections show an example of how to do this.
+
+Test Setup
+--
+
+A bonded device is created in the VM.
+The virtio and VF PMD's are added as slaves to the bonded device.
+The VF is set as the primary slave of the bonded device.
+
+A bridge must be set up on the Host connecting the tap device, w

[dpdk-dev] [PATCH v4 0/2] doc: live migration procedure

2016-07-18 Thread Bernard Iremonger
This pachset set describes the procedure to Live migrate
a VM with Virtio and VF PMD's using the bonding PMD.

Changes in v4:
rename image file and patch
added links to rst file
updated rst file in line with comments

Changes in v3:
rename directory from how_to to howto
move to after FAQ in the index

Changes in v2:
change primary port before removing slave port
remove unused variables from QEMU scripts
identify NIC's in bridge setup scripts

Bernard Iremonger (2):
  doc: live migration of VM with Virtio and VF
  doc: add live migration virtio sriov image

 doc/guides/howto/index.rst|  38 ++
 doc/guides/howto/lm_bond_virtio_sriov.rst | 713 ++
 doc/guides/index.rst  |   1 +
 3 files changed, 752 insertions(+)
 create mode 100644 doc/guides/howto/index.rst
 create mode 100644 doc/guides/howto/lm_bond_virtio_sriov.rst

-- 
2.9.0



[dpdk-dev] [PATCH v2 2/2] doc: add vhost_user live migration image

2016-07-13 Thread Bernard Iremonger
This patch adds an image of the Live Migration of a VM using vhost_user
on the host, test configuration.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/howto/img/lm_vhost_user.svg| 644 ++
 doc/guides/howto/lm_virtio_vhost_user.rst |   4 +
 2 files changed, 648 insertions(+)
 create mode 100644 doc/guides/howto/img/lm_vhost_user.svg

diff --git a/doc/guides/howto/img/lm_vhost_user.svg 
b/doc/guides/howto/img/lm_vhost_user.svg
new file mode 100644
index 000..3601cf1
--- /dev/null
+++ b/doc/guides/howto/img/lm_vhost_user.svg
@@ -0,0 +1,644 @@
+
+
+
+http://purl.org/dc/elements/1.1/;
+   xmlns:cc="http://creativecommons.org/ns#;
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
+   xmlns:svg="http://www.w3.org/2000/svg;
+   xmlns="http://www.w3.org/2000/svg;
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape;
+   width="1052.8693"
+   height="762.99158"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="lm_vhost_user.svg">
+  
+
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+
+  
+image/svg+xml
+http://purl.org/dc/dcmitype/StillImage; />
+
+  
+
+  
+  
+
+
+
+
+
+
+
+
+VM 1 
+Switch with 10Gb ports
+Server 1
+Server 2
+  10 Gb Traffic Generator
+VM 2 
+Linux, KVM, QEMU 2.5 
+10 Gb NIC
+10 Gb NIC
+
+
+10 Gb NIC
+10 Gb NIC
+
+
+DPDK Testpmd App
+DPDK virtio PMD's 
+DPDK PF PMD and vhost_user
+DPDK PF PMD and vhost_user
+NFS ServerVM disk image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+10 Gb Migration Link
+DPDK Testpmd App
+DPDK virtio PMD's  
+Linux, KVM, QEMU 2.5 
+  
+
diff --git a/doc/guides/howto/lm_virtio_vhost_user.rst 
b/doc/guides/howto/lm_virtio_vhost_user.rst
index 2de3ef7..d8f6365 100644
--- a/doc/guides/howto/lm_virtio_vhost_user.rst
+++ b/doc/guides/howto/lm_virtio_vhost_user.rst
@@ -49,6 +49,10 @@ The switch is configured to broadcast traffic on all the NIC 
ports.
 Live Migration with Virtio and vhost_user test setup:
 -

+.. _figure_lm_vhost_user:
+
+.. figure:: img/lm_vhost_user.*
+
 Live Migration steps for VM with Virtio PMD and vhost_user on host:
 ---

-- 
2.9.0



[dpdk-dev] [PATCH v2 1/2] doc: live migration of VM with vhost_user on host

2016-07-13 Thread Bernard Iremonger
This patch describes the procedure to be be followed to perform
Live Migration of a VM with Virtio PMD running on a host which
is running the vhost_user sample application (vhost-switch).

It includes sample host and VM scripts used in the procedure.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/howto/index.rst|   1 +
 doc/guides/howto/lm_virtio_vhost_user.rst | 455 ++
 2 files changed, 456 insertions(+)
 create mode 100644 doc/guides/howto/lm_virtio_vhost_user.rst

diff --git a/doc/guides/howto/index.rst b/doc/guides/howto/index.rst
index 4b97a32..d3e3a90 100644
--- a/doc/guides/howto/index.rst
+++ b/doc/guides/howto/index.rst
@@ -36,3 +36,4 @@ How To User Guide
 :numbered:

 lm_bond_virtio_sriov
+lm_virtio_vhost_user
diff --git a/doc/guides/howto/lm_virtio_vhost_user.rst 
b/doc/guides/howto/lm_virtio_vhost_user.rst
new file mode 100644
index 000..2de3ef7
--- /dev/null
+++ b/doc/guides/howto/lm_virtio_vhost_user.rst
@@ -0,0 +1,455 @@
+..  BSD LICENSE
+Copyright(c) 2016 Intel Corporation. All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Intel Corporation nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Live Migration of VM with Virtio on host running vhost_user:
+
+
+Live Migration overview for VM with Virtio:
+---
+
+To test the Live Migration two servers with identical operating systems 
installed are used.
+KVM and QEMU is also required on the servers.
+
+QEMU 2.5 is required for Live Migration of a VM with vhost_user running on the 
hosts.
+
+The servers have Niantic and or Fortville NIC's installed.
+The NIC's on both servers are connected to a switch
+which is also connected to the traffic generator.
+
+The switch is configured to broadcast traffic on all the NIC ports.
+
+Live Migration with Virtio and vhost_user test setup:
+-
+
+Live Migration steps for VM with Virtio PMD and vhost_user on host:
+---
+
+The host is running the DPDK PMD (ixgbe or i40e) and the DPDK vhost_user
+sample application (vhost-switch).
+
+The ip address of host_server_1 is 10.237.212.46
+
+The ip address of host_server_2 is 10.237.212.131
+
+The sample scripts mentioned in the steps below can be found in the 
host_scripts
+and vm_scripts sections.
+
+On host_server_1: Terminal 1
+
+
+Setup DPDK on host_server_1
+
+.. code-block:: console
+
+cd /root/dpdk/host_scripts
+./setup_dpdk_on_host.sh
+
+On host_server_1: Terminal 2
+
+
+Bind the Niantic or Fortville NIC to igb_uio on host_server_1.
+
+For Fortville NIC
+
+.. code-block:: console
+
+   cd /root/dpdk/tools
+   ./dpdk_nic_bind.py -b igb_uio :02:00.0
+
+For Niantic NIC
+
+.. code-block:: console
+
+   cd /root/dpdk/tools
+   ./dpdk_nic_bind.py -b igb_uio :09:00.0
+
+On host_server_1: Terminal 3
+
+
+For Fortville and Niantic NIC's reset SRIOV and run the
+vhost_user sample application (vhost-switch) on host_server_1.
+
+.. code-block:: console
+
+ cd /root/dpdk/host_scripts
+./reset_vf_on_212_46.sh
+./run_vhost_switch_on_host.sh
+
+On host_server_1: Terminal 1
+
+
+Start the VM on host_server_1
+
+.. code-block:: console
+
+   ./vm_virtio_vhost_user.sh
+
+On host_server_1: 

[dpdk-dev] [PATCH v2 0/2] doc: live migration procedure with vhost_user

2016-07-13 Thread Bernard Iremonger
This patchset describes the procedure to Live migrate a VM with
Virtio PMD's with the vhost_user sample application (vhost-switch)
running on the host.

This patchset depends on the following patch:
http://dpdk.org/dev/patchwork/patch/14625

Changes in v2:
removed l2fwd information
minor changes to svg file

Bernard Iremonger (2):
  doc: live migration of VM with vhost_user on host
  doc: add vhost_user live migration image

 doc/guides/howto/img/lm_vhost_user.svg| 644 ++
 doc/guides/howto/index.rst|   1 +
 doc/guides/howto/lm_virtio_vhost_user.rst | 459 +
 3 files changed, 1104 insertions(+)
 create mode 100644 doc/guides/howto/img/lm_vhost_user.svg
 create mode 100644 doc/guides/howto/lm_virtio_vhost_user.rst

-- 
2.9.0



[dpdk-dev] [PATCH 1/2] doc: live migration of VM with vhost_user on host

2016-07-11 Thread Bernard Iremonger
This patch describes the procedure to be be followed to perform
Live Migration of a VM with Virtio PMD running on a host which
is running the vhost_user sample application (vhost-switch).

It includes sample host and VM scripts used in the procedure.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/howto/index.rst|   1 +
 doc/guides/howto/lm_virtio_vhost_user.rst | 504 ++
 2 files changed, 505 insertions(+)
 create mode 100644 doc/guides/howto/lm_virtio_vhost_user.rst

diff --git a/doc/guides/howto/index.rst b/doc/guides/howto/index.rst
index 4b97a32..d3e3a90 100644
--- a/doc/guides/howto/index.rst
+++ b/doc/guides/howto/index.rst
@@ -36,3 +36,4 @@ How To User Guide
 :numbered:

 lm_bond_virtio_sriov
+lm_virtio_vhost_user
diff --git a/doc/guides/howto/lm_virtio_vhost_user.rst 
b/doc/guides/howto/lm_virtio_vhost_user.rst
new file mode 100644
index 000..dbcd1d3
--- /dev/null
+++ b/doc/guides/howto/lm_virtio_vhost_user.rst
@@ -0,0 +1,504 @@
+..  BSD LICENSE
+Copyright(c) 2016 Intel Corporation. All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Intel Corporation nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Live Migration of VM with Virtio on host running vhost_user:
+
+
+Live Migration overview for VM with Virtio:
+---
+
+To test the Live Migration two servers with identical operating systems 
installed are used.
+KVM and QEMU is also required on the servers.
+
+QEMU 2.5 is required for Live Migration of a VM with vhost_user running on the 
hosts.
+
+The servers have Niantic and or Fortville NIC's installed.
+The NIC's on both servers are connected to a switch
+which is also connected to the traffic generator.
+
+The switch is configured to broadcast traffic on all the NIC ports.
+
+Live Migration with Virtio and vhost_user test setup:
+-
+
+Live Migration steps for VM with Virtio PMD and vhost_user on host:
+---
+
+The host is running the DPDK PMD (ixgbe or i40e) and the DPDK vhost_user
+sample application (vhost-switch).
+
+The ip address of host_server_1 is 10.237.212.46
+
+The ip address of host_server_2 is 10.237.212.131
+
+The sample scripts mentioned in the steps below can be found in the 
host_scripts
+and vm_scripts sections.
+
+On host_server_1: Terminal 1
+
+
+Setup DPDK on host_server_1
+
+.. code-block:: console
+
+cd /root/dpdk/host_scripts
+./setup_dpdk_on_host.sh
+
+On host_server_1: Terminal 2
+
+
+Bind the Niantic or Fortville NIC to igb_uio on host_server_1.
+
+For Fortville NIC
+
+.. code-block:: console
+
+   cd /root/dpdk/tools
+   ./dpdk_nic_bind.py -b igb_uio :02:00.0
+
+For Niantic NIC
+
+.. code-block:: console
+
+   cd /root/dpdk/tools
+   ./dpdk_nic_bind.py -b igb_uio :09:00.0
+
+On host_server_1: Terminal 3
+
+
+For Fortville and Niantic NIC's reset SRIOV and run the
+vhost_user sample application (vhost-switch) on host_server_1.
+
+.. code-block:: console
+
+ cd /root/dpdk/host_scripts
+./reset_vf_on_212_46.sh
+./run_vhost_switch_on_host.sh
+
+On host_server_1: Terminal 1
+
+
+Start the VM on host_server_1
+
+.. code-block:: console
+
+   ./vm_virtio_vhost_user.sh
+
+On host_server_1: 

[dpdk-dev] [PATCH 0/2] doc: live migration procedure with vhost_user

2016-07-11 Thread Bernard Iremonger
This patchset describes the procedure to Live migrate a VM with
Virtio PMD's with the vhost_user sample application (vhost-switch)
running on the host.

Bernard Iremonger (2):
  doc: live migration of VM with vhost_user on host
  doc: add vhost_user live migration image

 doc/guides/howto/img/lm_vhost_user.svg| 644 ++
 doc/guides/howto/index.rst|   1 +
 doc/guides/howto/lm_virtio_vhost_user.rst | 508 +++
 3 files changed, 1153 insertions(+)
 create mode 100644 doc/guides/howto/img/lm_vhost_user.svg
 create mode 100644 doc/guides/howto/lm_virtio_vhost_user.rst

-- 
2.9.0



[dpdk-dev] [PATCH v3 2/2] doc: add live migration overview image

2016-07-07 Thread Bernard Iremonger
This patch adds an image of the Live Migration test configuration.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/howto/img/lm_overview.svg  | 666 ++
 doc/guides/howto/lm_bond_virtio_sriov.rst |   4 +
 2 files changed, 670 insertions(+)
 create mode 100644 doc/guides/howto/img/lm_overview.svg

diff --git a/doc/guides/howto/img/lm_overview.svg 
b/doc/guides/howto/img/lm_overview.svg
new file mode 100644
index 000..d913ae0
--- /dev/null
+++ b/doc/guides/howto/img/lm_overview.svg
@@ -0,0 +1,666 @@
+
+
+
+http://purl.org/dc/elements/1.1/;
+   xmlns:cc="http://creativecommons.org/ns#;
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
+   xmlns:svg="http://www.w3.org/2000/svg;
+   xmlns="http://www.w3.org/2000/svg;
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape;
+   width="1052.8693"
+   height="762.99158"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="lm_overview.svg">
+  
+
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+
+  
+image/svg+xml
+http://purl.org/dc/dcmitype/StillImage; />
+
+  
+
+  
+  
+
+
+
+
+
+
+
+
+VM 1 
+Switch with 10Gb ports
+Server 1
+Server 2
+  10 Gb Traffic Generator
+VM 2 
+Linux, KVM, QEMU 
+Linux, KVM, QEMU 
+10 Gb NIC
+10 Gb NIC
+
+
+10 Gb NIC
+10 Gb NIC
+
+DPDK Testpmd App.
+bonded device withvirtio and VF slaves
+
+DPDK Testpmd App.
+bonded device withvirtio and VF slaves
+Kernel PF driver
+Kernel PF driver
+SW bridge with Tapand PF connected 
+NFS ServerVM disk image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+SW bridge with Tapand PF connected 
+10 Gb Migration Link
+  
+
diff --git a/doc/guides/howto/lm_bond_virtio_sriov.rst 
b/doc/guides/howto/lm_bond_virtio_sriov.rst
index 68bb0ea..f9d3667 100644
--- a/doc/guides/howto/lm_bond_virtio_sriov.rst
+++ b/doc/guides/howto/lm_bond_virtio_sriov.rst
@@ -57,6 +57,10 @@ The switch is configured to broadcast traffic on all the NIC 
ports.
 Live Migration with SR-IOV VF test setup:
 -

+.. _figure_lm_overview:
+
+.. figure:: img/lm_overview.*
+
 Live Migration steps for VM with Virtio and VF PMD's:
 -

-- 
2.9.0



[dpdk-dev] [PATCH v3 1/2] doc: live migration of VM with Virtio and VF

2016-07-07 Thread Bernard Iremonger
This patch describes the procedure to be be followed
to perform Live Migration of a VM with Virtio and VF PMD's
using the bonding PMD.

It includes sample host and VM scripts used in the procedure,
and a sample switch configuration.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/howto/index.rst|  38 ++
 doc/guides/howto/lm_bond_virtio_sriov.rst | 689 ++
 doc/guides/index.rst  |   1 +
 3 files changed, 728 insertions(+)
 create mode 100644 doc/guides/howto/index.rst
 create mode 100644 doc/guides/howto/lm_bond_virtio_sriov.rst

diff --git a/doc/guides/howto/index.rst b/doc/guides/howto/index.rst
new file mode 100644
index 000..4b97a32
--- /dev/null
+++ b/doc/guides/howto/index.rst
@@ -0,0 +1,38 @@
+..  BSD LICENSE
+Copyright(c) 2016 Intel Corporation. All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Intel Corporation nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+How To User Guide
+=
+
+.. toctree::
+:maxdepth: 3
+:numbered:
+
+lm_bond_virtio_sriov
diff --git a/doc/guides/howto/lm_bond_virtio_sriov.rst 
b/doc/guides/howto/lm_bond_virtio_sriov.rst
new file mode 100644
index 000..68bb0ea
--- /dev/null
+++ b/doc/guides/howto/lm_bond_virtio_sriov.rst
@@ -0,0 +1,689 @@
+..  BSD LICENSE
+Copyright(c) 2016 Intel Corporation. All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Intel Corporation nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Live Migration of VM with SR-IOV VF:
+
+
+Live Migration overview for VM with Virtio and VF PMD's:
+
+
+It is not possible to migrate a Virtual Machine which has an SR-IOV Virtual 
Function.
+To get around this problem the bonding PMD is used.
+
+A bonded device is created in the VM.
+The virtio and VF PMD's are added as slaves to the bonded device.
+The VF is set as the primary slave of the bonded device.
+
+A bridge must be set up on the Host connecting t

[dpdk-dev] [PATCH v3 0/2] doc: live migration procedure

2016-07-07 Thread Bernard Iremonger
This pachset set describes the procedure to Live migrate
a VM with Virtio and VF PMD's using the bonding PMD.

Changes in v3:
rename directory from how_to to howto
move to after FAQ in the index

Changes in v2:
change primary port before removing slave port
remove unused variables from QEMU scripts
identify NIC's in bridge setup scripts

Bernard Iremonger (2):
  doc: live migration of VM with Virtio and VF
  doc: add live migration overview image

 doc/guides/howto/img/lm_overview.svg  | 666 
 doc/guides/howto/index.rst|  38 ++
 doc/guides/howto/lm_bond_virtio_sriov.rst | 693 ++
 doc/guides/index.rst  |   1 +
 4 files changed, 1398 insertions(+)
 create mode 100644 doc/guides/howto/img/lm_overview.svg
 create mode 100644 doc/guides/howto/index.rst
 create mode 100644 doc/guides/howto/lm_bond_virtio_sriov.rst

-- 
2.9.0



[dpdk-dev] [PATCH v2 2/2] doc: add live migration overview image

2016-07-06 Thread Bernard Iremonger
This patch adds an image of the Live Migration test configuration.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/how_to/img/lm_overview.svg  | 666 +
 doc/guides/how_to/lm_bond_virtio_sriov.rst |   3 +
 2 files changed, 669 insertions(+)
 create mode 100644 doc/guides/how_to/img/lm_overview.svg

diff --git a/doc/guides/how_to/img/lm_overview.svg 
b/doc/guides/how_to/img/lm_overview.svg
new file mode 100644
index 000..d913ae0
--- /dev/null
+++ b/doc/guides/how_to/img/lm_overview.svg
@@ -0,0 +1,666 @@
+
+
+
+http://purl.org/dc/elements/1.1/;
+   xmlns:cc="http://creativecommons.org/ns#;
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
+   xmlns:svg="http://www.w3.org/2000/svg;
+   xmlns="http://www.w3.org/2000/svg;
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape;
+   width="1052.8693"
+   height="762.99158"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="lm_overview.svg">
+  
+
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+
+  
+image/svg+xml
+http://purl.org/dc/dcmitype/StillImage; />
+
+  
+
+  
+  
+
+
+
+
+
+
+
+
+VM 1 
+Switch with 10Gb ports
+Server 1
+Server 2
+  10 Gb Traffic Generator
+VM 2 
+Linux, KVM, QEMU 
+Linux, KVM, QEMU 
+10 Gb NIC
+10 Gb NIC
+
+
+10 Gb NIC
+10 Gb NIC
+
+DPDK Testpmd App.
+bonded device withvirtio and VF slaves
+
+DPDK Testpmd App.
+bonded device withvirtio and VF slaves
+Kernel PF driver
+Kernel PF driver
+SW bridge with Tapand PF connected 
+NFS ServerVM disk image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+SW bridge with Tapand PF connected 
+10 Gb Migration Link
+  
+
diff --git a/doc/guides/how_to/lm_bond_virtio_sriov.rst 
b/doc/guides/how_to/lm_bond_virtio_sriov.rst
index 66b5e62..f9d3667 100644
--- a/doc/guides/how_to/lm_bond_virtio_sriov.rst
+++ b/doc/guides/how_to/lm_bond_virtio_sriov.rst
@@ -57,6 +57,9 @@ The switch is configured to broadcast traffic on all the NIC 
ports.
 Live Migration with SR-IOV VF test setup:
 -

+.. _figure_lm_overview:
+
+.. figure:: img/lm_overview.*

 Live Migration steps for VM with Virtio and VF PMD's:
 -
-- 
2.9.0



[dpdk-dev] [PATCH v2 1/2] doc: live migration of VM with Virtio and VF

2016-07-06 Thread Bernard Iremonger
This patch describes the procedure to be be followed
to perform Live Migration of a VM with Virtio and VF PMD's
using the bonding PMD.

It includes sample host and VM scripts used in the procedure,
and a sample switch configuration.

Signed-off-by: Bernard Iremonger 
---
 doc/guides/how_to/index.rst|  38 ++
 doc/guides/how_to/lm_bond_virtio_sriov.rst | 690 +
 doc/guides/index.rst   |   3 +-
 3 files changed, 730 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/how_to/index.rst
 create mode 100644 doc/guides/how_to/lm_bond_virtio_sriov.rst

diff --git a/doc/guides/how_to/index.rst b/doc/guides/how_to/index.rst
new file mode 100644
index 000..4b97a32
--- /dev/null
+++ b/doc/guides/how_to/index.rst
@@ -0,0 +1,38 @@
+..  BSD LICENSE
+Copyright(c) 2016 Intel Corporation. All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Intel Corporation nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+How To User Guide
+=
+
+.. toctree::
+:maxdepth: 3
+:numbered:
+
+lm_bond_virtio_sriov
diff --git a/doc/guides/how_to/lm_bond_virtio_sriov.rst 
b/doc/guides/how_to/lm_bond_virtio_sriov.rst
new file mode 100644
index 000..66b5e62
--- /dev/null
+++ b/doc/guides/how_to/lm_bond_virtio_sriov.rst
@@ -0,0 +1,690 @@
+..  BSD LICENSE
+Copyright(c) 2016 Intel Corporation. All rights reserved.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+* Neither the name of Intel Corporation nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Live Migration of VM with SR-IOV VF:
+
+
+Live Migration overview for VM with Virtio and VF PMD's:
+
+
+It is not possible to migrate a Virtual Machine which has an SR-IOV Virtual 
Function.
+To get around this problem the bonding PMD is used.
+
+A bonded device is created in the VM.
+The virtio and VF PMD's are added as slaves to the bonded device.
+The VF is set as the primary slave of the bonded device.
+
+A bridge must be set up on the Hos

[dpdk-dev] [PATCH v2 0/2] doc: live migration procedure

2016-07-06 Thread Bernard Iremonger
This pachset set describes the procedure to Live migrate
a VM with Virtio and VF PMD's using the bonding PMD.

Changes in v2:
change primary port before removing slave port
remove unused variables from QEMU scripts
identify NIC's in bridge setup scripts

Bernard Iremonger (2):
  doc: live migration of VM with Virtio and VF
  doc: add live migration overview image

 doc/guides/how_to/img/lm_overview.svg  | 666 +++
 doc/guides/how_to/index.rst|  38 ++
 doc/guides/how_to/lm_bond_virtio_sriov.rst | 693 +
 doc/guides/index.rst   |   3 +-
 4 files changed, 1399 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/how_to/img/lm_overview.svg
 create mode 100644 doc/guides/how_to/index.rst
 create mode 100644 doc/guides/how_to/lm_bond_virtio_sriov.rst

-- 
2.9.0



[dpdk-dev] [PATCH] doc: update release notes

2016-07-01 Thread Bernard Iremonger
add release note for live migration of a VM with SRIOV VF

Signed-off-by: Bernard Iremonger 
---
 doc/guides/rel_notes/release_16_07.rst | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/guides/rel_notes/release_16_07.rst 
b/doc/guides/rel_notes/release_16_07.rst
index 569f562..350b259 100644
--- a/doc/guides/rel_notes/release_16_07.rst
+++ b/doc/guides/rel_notes/release_16_07.rst
@@ -179,6 +179,9 @@ New Features
   For information on this feature,  please see the "I40E Poll Mode Driver"
   section of the "Network Interface Controller Drivers" document.

+* **Added support for live migration of a VM with SRIOV VF.**
+
+  Live migration of a VM with Virtio and VF PMD's using the bonding PMD.

 Resolved Issues
 ---
-- 
2.6.3



[dpdk-dev] [PATCH 0/2] doc: live migration procedure

2016-07-01 Thread Bernard Iremonger
This pachset set describes the procedure to Live migrate
a VM with Virtio and VF PMD's using the bonding PMD.

Bernard Iremonger (2):
  doc: live migration of VM with Virtio and VF
  doc: add live migration overview image

 doc/guides/how_to/img/lm_overview.svg  | 666 
 doc/guides/how_to/index.rst|  38 ++
 doc/guides/how_to/lm_bond_virtio_sriov.rst | 690 +
 doc/guides/index.rst   |   3 +-
 4 files changed, 1396 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/how_to/img/lm_overview.svg
 create mode 100644 doc/guides/how_to/index.rst
 create mode 100644 doc/guides/how_to/lm_bond_virtio_sriov.rst

-- 
2.6.3



  1   2   3   4   5   6   >