[dpdk-dev] [PATCH v2 00/13] Mellanox ConnectX-4 PMD (mlx5)

2015-10-31 Thread Thomas Monjalon
2015-10-30 19:52, Adrien Mazarguil:
> This PMD adds basic support for Mellanox ConnectX-4 (mlx5) families of
> 10/25/40/50/100 Gb/s adapters through the Verbs framework.
> 
> Its design is very similar to that of mlx4 from which most of its code is
> borrowed without the mistake of putting it all in a single huge file.
> 
> It is disabled by default due to its dependency on libibverbs.
> 
> Changes in v2:
> - Removed useless port inactive warning.
> - Simplified code by replacing configured MAC addresses RX queue bit-field
>   with flow pointer checks.
> - Replaced allmulti/promisc status bits with request bits to fix
>   inconsistencies when restoring these modes.
> - Updated comments about maximum number of MAC addresses and VLAN filters.
> - Improved performance with better prefetching.
> - Fixed deadlock in case of error during port start.
> - Simplified VLAN filtering configuration storage using a basic list instead
>   of a table (with holes).

Applied, thanks


[dpdk-dev] [PATCH 1/3] mlx4: improve RX performance with better prefetching

2015-10-31 Thread Thomas Monjalon
Series applied, thanks


[dpdk-dev] [PATCH v3 2/4] fm10k: add VMDQ support in MAC/VLAN filter

2015-10-31 Thread He, Shaopeng
Hi, Thomas

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Saturday, October 31, 2015 12:18 AM
> To: He, Shaopeng
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 2/4] fm10k: add VMDQ support in
> MAC/VLAN filter
> 
> Sorry it does not compile with clang.
> 
> 2015-10-27 17:21, Shaopeng He:
> > +   for (i = 0; i < (int)vmdq_conf->nb_pool_maps; i++) {
> 
> fm10k_ethdev.c:1168:16: error: comparison of integers of different signs:
> 'uint32_t' (aka 'unsigned int') and 'int' [-Werror,-Wsign-compare]
Thanks for the comments, I will send another version




[dpdk-dev] [PATCH v4 0/4] fm10k: add VMDQ support

2015-10-31 Thread Shaopeng He
This patch series adds VMDQ support for fm10k.
It includes the functions to configure VMDQ mode and
add MAC address for each VMDQ queue pool.
It also includes logic to do sanity check for
multi-queue settings.

Changes in v4:
- Fix a clang compile issue
- Rebase to latest code

Changes in v3:
- Keep device default MAC address even in VMDQ mode after
  queue pool config was changed, because some applications
  (e.g. vmdq_app) always need a valid MAC address there

Changes in v2:
- Reword some comments and commit messages
- Update release note

Shaopeng He (4):
  fm10k: add multi-queue checking
  fm10k: add VMDQ support in MAC/VLAN filter
  fm10k: add VMDQ support in multi-queue configure
  doc: update release note for fm10k VMDQ support

 doc/guides/rel_notes/release_2_2.rst |   5 +
 drivers/net/fm10k/fm10k.h|   3 +
 drivers/net/fm10k/fm10k_ethdev.c | 358 +++
 3 files changed, 289 insertions(+), 77 deletions(-)

-- 
1.9.3



[dpdk-dev] [PATCH v4 2/4] fm10k: add VMDQ support in MAC/VLAN filter

2015-10-31 Thread Shaopeng He
The patch does below things for fm10k MAC/VLAN filter:
- Add separate functions for VMDQ and main VSI to change
  MAC filter.
- Disable modification to VLAN filter in VMDQ mode.
- In device close phase, delete logic ports to remove all
  MAC/VLAN filters belonging to those ports.

Signed-off-by: Shaopeng He 
Acked-by: Jingjing Wu 
Acked-by: Michael Qiu 
---
 drivers/net/fm10k/fm10k.h|   3 +
 drivers/net/fm10k/fm10k_ethdev.c | 150 +--
 2 files changed, 99 insertions(+), 54 deletions(-)

diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index c089882..439e95f 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -126,6 +126,9 @@
 struct fm10k_macvlan_filter_info {
uint16_t vlan_num;   /* Total VLAN number */
uint16_t mac_num;/* Total mac number */
+   uint16_t nb_queue_pools; /* Active queue pools number */
+   /* VMDQ ID for each MAC address */
+   uint8_t  mac_vmdq_id[FM10K_MAX_MACADDR_NUM];
uint32_t vfta[FM10K_VFTA_SIZE];/* VLAN bitmap */
 };

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 75d1fa3..76c050a 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -45,6 +45,8 @@
 #define FM10K_MBXLOCK_DELAY_US 20
 #define UINT64_LOWER_32BITS_MASK 0xULL

+#define MAIN_VSI_POOL_NUMBER 0
+
 /* Max try times to acquire switch status */
 #define MAX_QUERY_SWITCH_STATE_TIMES 10
 /* Wait interval to get switch status */
@@ -61,10 +63,8 @@ static void fm10k_dev_allmulticast_disable(struct 
rte_eth_dev *dev);
 static inline int fm10k_glort_valid(struct fm10k_hw *hw);
 static int
 fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on);
-static void
-fm10k_MAC_filter_set(struct rte_eth_dev *dev, const u8 *mac, bool add);
-static void
-fm10k_MACVLAN_remove_all(struct rte_eth_dev *dev);
+static void fm10k_MAC_filter_set(struct rte_eth_dev *dev,
+   const u8 *mac, bool add, uint32_t pool);
 static void fm10k_tx_queue_release(void *queue);
 static void fm10k_rx_queue_release(void *queue);

@@ -883,10 +883,17 @@ static void
 fm10k_dev_close(struct rte_eth_dev *dev)
 {
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   uint16_t nb_lport;
+   struct fm10k_macvlan_filter_info *macvlan;

PMD_INIT_FUNC_TRACE();

-   fm10k_MACVLAN_remove_all(dev);
+   macvlan = FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data->dev_private);
+   nb_lport = macvlan->nb_queue_pools ? macvlan->nb_queue_pools : 1;
+   fm10k_mbx_lock(hw);
+   hw->mac.ops.update_lport_state(hw, hw->mac.dglort_map,
+   nb_lport, false);
+   fm10k_mbx_unlock(hw);

/* Stop mailbox service first */
fm10k_close_mbx_service(hw);
@@ -1024,6 +1031,11 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t 
vlan_id, int on)
hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
macvlan = FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data->dev_private);

+   if (macvlan->nb_queue_pools > 0) { /* VMDQ mode */
+   PMD_INIT_LOG(ERR, "Cannot change VLAN filter in VMDQ mode");
+   return (-EINVAL);
+   }
+
if (vlan_id > ETH_VLAN_ID_MAX) {
PMD_INIT_LOG(ERR, "Invalid vlan_id: must be < 4096");
return (-EINVAL);
@@ -1101,38 +1113,80 @@ fm10k_vlan_offload_set(__rte_unused struct rte_eth_dev 
*dev, int mask)
}
 }

-/* Add/Remove a MAC address, and update filters */
-static void
-fm10k_MAC_filter_set(struct rte_eth_dev *dev, const u8 *mac, bool add)
+/* Add/Remove a MAC address, and update filters to main VSI */
+static void fm10k_MAC_filter_set_main_vsi(struct rte_eth_dev *dev,
+   const u8 *mac, bool add, uint32_t pool)
 {
-   uint32_t i, j, k;
-   struct fm10k_hw *hw;
+   struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct fm10k_macvlan_filter_info *macvlan;
+   uint32_t i, j, k;

-   hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
macvlan = FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data->dev_private);

-   i = 0;
-   for (j = 0; j < FM10K_VFTA_SIZE; j++) {
-   if (macvlan->vfta[j]) {
-   for (k = 0; k < FM10K_UINT32_BIT_SIZE; k++) {
-   if (macvlan->vfta[j] & (1 << k)) {
-   if (i + 1 > macvlan->vlan_num) {
-   PMD_INIT_LOG(ERR, "vlan number "
-   "not match");
-   return;
-   }
-   fm10k_mbx_lock(hw);
-   fm10k_update_uc_addr(hw,
-   hw->mac.dglort_map, mac,
- 

[dpdk-dev] [PATCH v4 3/4] fm10k: add VMDQ support in multi-queue configure

2015-10-31 Thread Shaopeng He
Add separate functions to configure VMDQ and RSS.
Update dglort map and logic ports accordingly.
Reset MAC/VLAN filter after VMDQ config was changed.

Signed-off-by: Shaopeng He 
Acked-by: Jingjing Wu 
Acked-by: Michael Qiu 
---
 drivers/net/fm10k/fm10k_ethdev.c | 164 +--
 1 file changed, 141 insertions(+), 23 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 76c050a..941dae7 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -337,8 +337,41 @@ fm10k_dev_configure(struct rte_eth_dev *dev)
return 0;
 }

+/* fls = find last set bit = 32 minus the number of leading zeros */
+#ifndef fls
+#define fls(x) (((x) == 0) ? 0 : (32 - __builtin_clz((x
+#endif
+
 static void
-fm10k_dev_mq_rx_configure(struct rte_eth_dev *dev)
+fm10k_dev_vmdq_rx_configure(struct rte_eth_dev *dev)
+{
+   struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   struct rte_eth_vmdq_rx_conf *vmdq_conf;
+   uint32_t i;
+
+   vmdq_conf = &dev->data->dev_conf.rx_adv_conf.vmdq_rx_conf;
+
+   for (i = 0; i < vmdq_conf->nb_pool_maps; i++) {
+   if (!vmdq_conf->pool_map[i].pools)
+   continue;
+   fm10k_mbx_lock(hw);
+   fm10k_update_vlan(hw, vmdq_conf->pool_map[i].vlan_id, 0, true);
+   fm10k_mbx_unlock(hw);
+   }
+}
+
+static void
+fm10k_dev_pf_main_vsi_reset(struct rte_eth_dev *dev)
+{
+   struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   /* Add default mac address */
+   fm10k_MAC_filter_set(dev, hw->mac.addr, true,
+   MAIN_VSI_POOL_NUMBER);
+}
+
+static void
+fm10k_dev_rss_configure(struct rte_eth_dev *dev)
 {
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
@@ -409,6 +442,78 @@ fm10k_dev_mq_rx_configure(struct rte_eth_dev *dev)
FM10K_WRITE_REG(hw, FM10K_MRQC(0), mrqc);
 }

+static void
+fm10k_dev_logic_port_update(struct rte_eth_dev *dev,
+   uint16_t nb_lport_old, uint16_t nb_lport_new)
+{
+   struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   uint32_t i;
+
+   fm10k_mbx_lock(hw);
+   /* Disable previous logic ports */
+   if (nb_lport_old)
+   hw->mac.ops.update_lport_state(hw, hw->mac.dglort_map,
+   nb_lport_old, false);
+   /* Enable new logic ports */
+   hw->mac.ops.update_lport_state(hw, hw->mac.dglort_map,
+   nb_lport_new, true);
+   fm10k_mbx_unlock(hw);
+
+   for (i = 0; i < nb_lport_new; i++) {
+   /* Set unicast mode by default. App can change
+* to other mode in other API func.
+*/
+   fm10k_mbx_lock(hw);
+   hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map + i,
+   FM10K_XCAST_MODE_NONE);
+   fm10k_mbx_unlock(hw);
+   }
+}
+
+static void
+fm10k_dev_mq_rx_configure(struct rte_eth_dev *dev)
+{
+   struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   struct rte_eth_vmdq_rx_conf *vmdq_conf;
+   struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
+   struct fm10k_macvlan_filter_info *macvlan;
+   uint16_t nb_queue_pools = 0; /* pool number in configuration */
+   uint16_t nb_lport_new, nb_lport_old;
+
+   macvlan = FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data->dev_private);
+   vmdq_conf = &dev->data->dev_conf.rx_adv_conf.vmdq_rx_conf;
+
+   fm10k_dev_rss_configure(dev);
+
+   /* only PF supports VMDQ */
+   if (hw->mac.type != fm10k_mac_pf)
+   return;
+
+   if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_VMDQ_FLAG)
+   nb_queue_pools = vmdq_conf->nb_queue_pools;
+
+   /* no pool number change, no need to update logic port and VLAN/MAC */
+   if (macvlan->nb_queue_pools == nb_queue_pools)
+   return;
+
+   nb_lport_old = macvlan->nb_queue_pools ? macvlan->nb_queue_pools : 1;
+   nb_lport_new = nb_queue_pools ? nb_queue_pools : 1;
+   fm10k_dev_logic_port_update(dev, nb_lport_old, nb_lport_new);
+
+   /* reset MAC/VLAN as it's based on VMDQ or PF main VSI */
+   memset(dev->data->mac_addrs, 0,
+   ETHER_ADDR_LEN * FM10K_MAX_MACADDR_NUM);
+   ether_addr_copy((const struct ether_addr *)hw->mac.addr,
+   &dev->data->mac_addrs[0]);
+   memset(macvlan, 0, sizeof(*macvlan));
+   macvlan->nb_queue_pools = nb_queue_pools;
+
+   if (nb_queue_pools)
+   fm10k_dev_vmdq_rx_configure(dev);
+   else
+   fm10k_dev_pf_main_vsi_reset(dev);
+}
+
 static int
 fm10k_dev_tx_init(struct rte_eth_dev *dev)
 {
@@ -517,7 +622,7 @@ fm10k_dev_rx_init(struct rte_eth_dev *dev)
FM10K_WRITE_FLUSH(hw);
}

-   /* Configure RSS if applicable */
+   

[dpdk-dev] [PATCH v4 4/4] doc: update release note for fm10k VMDQ support

2015-10-31 Thread Shaopeng He
Signed-off-by: Shaopeng He 
Acked-by: Jingjing Wu 
Acked-by: Michael Qiu 
---
 doc/guides/rel_notes/release_2_2.rst | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 116162e..c00344b 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -45,6 +45,11 @@ New Features

 * **Added port hotplug support to xenvirt.**

+* **Added fm10k VMDQ support.**
+
+  Added functions to configure VMDQ mode and add MAC address for each VMDQ
+  queue pool. Also included logic to do sanity check for multi-queue settings.
+

 Resolved Issues
 ---
-- 
1.9.3



[dpdk-dev] [PATCH v4 1/4] fm10k: add multi-queue checking

2015-10-31 Thread Shaopeng He
Add multi-queue checking in device configure function.
Currently, VMDQ and RSS are supported.

Signed-off-by: Shaopeng He 
Acked-by: Jingjing Wu 
Acked-by: Michael Qiu 
---
 drivers/net/fm10k/fm10k_ethdev.c | 44 
 1 file changed, 44 insertions(+)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index b104fc2..75d1fa3 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -283,12 +283,56 @@ tx_queue_disable(struct fm10k_hw *hw, uint16_t qnum)
 }

 static int
+fm10k_check_mq_mode(struct rte_eth_dev *dev)
+{
+   enum rte_eth_rx_mq_mode rx_mq_mode = dev->data->dev_conf.rxmode.mq_mode;
+   struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   struct rte_eth_vmdq_rx_conf *vmdq_conf;
+   uint16_t nb_rx_q = dev->data->nb_rx_queues;
+
+   vmdq_conf = &dev->data->dev_conf.rx_adv_conf.vmdq_rx_conf;
+
+   if (rx_mq_mode & ETH_MQ_RX_DCB_FLAG) {
+   PMD_INIT_LOG(ERR, "DCB mode is not supported.");
+   return -EINVAL;
+   }
+
+   if (!(rx_mq_mode & ETH_MQ_RX_VMDQ_FLAG))
+   return 0;
+
+   if (hw->mac.type == fm10k_mac_vf) {
+   PMD_INIT_LOG(ERR, "VMDQ mode is not supported in VF.");
+   return -EINVAL;
+   }
+
+   /* Check VMDQ queue pool number */
+   if (vmdq_conf->nb_queue_pools >
+   sizeof(vmdq_conf->pool_map[0].pools) * CHAR_BIT ||
+   vmdq_conf->nb_queue_pools > nb_rx_q) {
+   PMD_INIT_LOG(ERR, "Too many of queue pools: %d",
+   vmdq_conf->nb_queue_pools);
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
+static int
 fm10k_dev_configure(struct rte_eth_dev *dev)
 {
+   int ret;
+
PMD_INIT_FUNC_TRACE();

if (dev->data->dev_conf.rxmode.hw_strip_crc == 0)
PMD_INIT_LOG(WARNING, "fm10k always strip CRC");
+   /* multipe queue mode checking */
+   ret  = fm10k_check_mq_mode(dev);
+   if (ret != 0) {
+   PMD_DRV_LOG(ERR, "fm10k_check_mq_mode fails with %d.",
+   ret);
+   return ret;
+   }

return 0;
 }
-- 
1.9.3



[dpdk-dev] [PATCH v2 0/7] interrupt mode for fm10k

2015-10-31 Thread He, Shaopeng
Hi, Thomas

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Friday, October 30, 2015 9:54 PM
> To: He, Shaopeng
> Cc: Qiu, Michael; Chen, Jing D; dev at dpdk.org
> Subject: Re: [PATCH v2 0/7] interrupt mode for fm10k
> 
> Hi,
> 
> The problem is that i40e interrupt patches are not merge-able.
> They are not enough reviewed especially for igb/ixgbe and vfio changes.
Thanks for your time, understood.

Best regards,
--Shaopeng

> 
> 
> 2015-10-30 10:40, He, Shaopeng:
> > Hi, Thomas
> >
> > The previous patch set which this one is based on, has a v2 sent today
> > as "[PATCH v2 00/11] interrupt mode for i40e"
> > http://dpdk.org/ml/archives/dev/2015-October/026710.html.
> >
> > I have verified that will not affect this patch set. Because this
> > patch set only depends on the framework part change in that patch set,
> > most likely, later version of that patch set (if have any) will not affect 
> > this
> patch set too.
> >
> > Could you please help to apply this patch set after you merge the
> > final version of " interrupt mode for i40e"?
> >
> > Thank you very much!
> > --Shaopeng



[dpdk-dev] Reshuffling of rte_mbuf structure.

2015-10-31 Thread shesha Sreenivasamurthy (shesha)
In Cisco, we are using DPDK for a very high speed packet processor application. 
We don't use NIC TCP offload / RSS hashing. Putting those fields in the first 
cache-line - and the obligatory mb->next datum in the second cache line - 
causes significant LSU pressure and performance degradation. If it does not 
affect other applications, I would like to propose reshuffling of fields so 
that the obligator "next" field falls in first cache line and RSS hashing goes 
to next. If this re-shuffling indeed hurts other applications, another idea is 
to make it compile time configurable. Please provide feedback.

--
- Thanks
char * (*shesha) (uint64_t cache, uint8_t F00D)
{ return 0xC0DE; }


[dpdk-dev] Fw: |ERROR| pw 8279-8293 maintainers: claim responsibility for ARMv7

2015-10-31 Thread Jan Viktorin
?Hello,

Again, I cannot see any relation with the arm patchset and this failure. It 
shouldn't affect other (x86) code at all.

>From where can I get the affc455438f4cbd3b14e2d9a24fbc154e22d68d3 commit? Can 
>somebody do a bisect or something? Is it a bug in the niantic driver? I am 
>confused...?

Jan?Viktorin
RehiveTech
Sent?from?a?mobile?device

? P?vodn? zpr?va ?
Od: sys_stv at intel.com
Odesl?no: sobota, 31. ??jna 2015 6:53
Komu: test-report at dpdk.org; viktorin at rehivetech.com
P?edm?t: |ERROR| pw 8279-8293 maintainers: claim responsibility for ARMv7

Test-Label: Intel Niantic on Fedora
Test-Status: ERROR
Patchwork: http://www.dpdk.org/dev/patchwork/patch/8293/

DPDK git baseline: affc455438f4cbd3b14e2d9a24fbc154e22d68d3
Patchwork ID: 8279-8293
http://www.dpdk.org/dev/patchwork/patch/8293/
Submitter: Jan Viktorin 
Date: Fri, 30 Oct 2015 01:25:42 +0100

Source Compilation:
OS: fedora
Nic: niantic
i686-native-linuxapp-gcc: compile pass
x86_64-native-linuxapp-gcc: compile pass

DTS validation: 
OS: fedora
Nic: Niantic
TestType: auto
GCC: 4
x86_64-native-linuxapp-gcc: total 75, passed 74, failed 1.
Failed Case List:
Target: x86_64-native-linuxapp-gcc
OS: fedora
Failed DTS case: 
checksum_checking: 
http://dpdk.org/browse/tools/dts/tree/test_plans/pmd_test_plan.rst

DTS Validation Error:


TEST SUITE : TestPmd

---
Begin: Test Casetest_checksum_checking
--
FAILED 'packet pass assert error, expected 60 RX bytes, actual 0'
--
[ SUITE_DUT_CMD] ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x1f -n 4 
-- -i --coremask=0x2 --portmask=0x3 --nb-cores=2 --enable-rx-cksum 
--disable-hw-vlan --disable-rss --crc-strip --rxd=1024 --txd=1024 --rxfreet=0 
--txqflags=0
[ SUITE_DUT_CMD] set fwd csum
[ SUITE_DUT_CMD] start
[ SUITE_DUT_CMD] show port stats 0
[ SUITE_DUT_CMD] show port stats 1
[SUITE_TESTER_CMD] echo -n '' > scapyResult.txt
[SUITE_TESTER_CMD] killall scapy 2>/dev/null; echo tester
[SUITE_TESTER_CMD] scapy
[SUITE_TESTER_CMD] nutmac="90:e2:ba:4a:54:81"
[SUITE_TESTER_CMD] sendp([Ether(dst=nutmac, 
src="52:00:00:00:00:00")/IP(len=46)/UDP(chksum=0x0)/Raw(load="P"*18)], 
iface="p785p2")
[SUITE_TESTER_CMD] exit()
[ SUITE_DUT_CMD] show port stats 0
[ SUITE_DUT_CMD] show port stats 1
[ SUITE_DUT_CMD] stop
[ SUITE_DUT_CMD] quit
[ SUITE_DUT_CMD] ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x1f -n 4 
-- -i --coremask=0x2 --portmask=0x3 --nb-cores=2 --enable-rx-cksum 
--disable-hw-vlan --disable-rss --crc-strip --rxd=1024 --txd=1024 --rxfreet=8 
--txqflags=0
[ SUITE_DUT_CMD] set fwd csum
[ SUITE_DUT_CMD] start
[ SUITE_DUT_CMD] show port stats 0
[ SUITE_DUT_CMD] show port stats 1
[SUITE_TESTER_CMD] echo -n '' > scapyResult.txt
[SUITE_TESTER_CMD] killall scapy 2>/dev/null; echo tester
[SUITE_TESTER_CMD] scapy
[SUITE_TESTER_CMD] nutmac="90:e2:ba:4a:54:81"
[SUITE_TESTER_CMD] sendp([Ether(dst=nutmac, 
src="52:00:00:00:00:00")/IP(len=46)/UDP(chksum=0x0)/Raw(load="P"*18)], 
iface="p785p2")
[SUITE_TESTER_CMD] exit()
[ SUITE_DUT_CMD] show port stats 0
[ SUITE_DUT_CMD] show port stats 1
[ SUITE_DUT_CMD] stop
[ SUITE_DUT_CMD] quit
[ SUITE_DUT_CMD] ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x1f -n 4 
-- -i --coremask=0x2 --portmask=0x3 --nb-cores=2 --enable-rx-cksum 
--disable-hw-vlan --disable-rss --crc-strip --rxd=1024 --txd=1024 --rxfreet=16 
--txqflags=0
[ SUITE_DUT_CMD] set fwd csum
[ SUITE_DUT_CMD] start
[ SUITE_DUT_CMD] show port stats 0
[ SUITE_DUT_CMD] show port stats 1
[SUITE_TESTER_CMD] echo -n '' > scapyResult.txt
[SUITE_TESTER_CMD] killall scapy 2>/dev/null; echo tester
[SUITE_TESTER_CMD] scapy
[SUITE_TESTER_CMD] nutmac="90:e2:ba:4a:54:81"
[SUITE_TESTER_CMD] sendp([Ether(dst=nutmac, 
src="52:00:00:00:00:00")/IP(len=46)/UDP(chksum=0x0)/Raw(load="P"*18)], 
iface="p785p2")
[SUITE_TESTER_CMD] exit()
[ SUITE_DUT_CMD] show port stats 0
[ SUITE_DUT_CMD] show port stats 1
[ SUITE_DUT_CMD] stop
[ SUITE_DUT_CMD] quit
[ SUITE_DUT_CMD] ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x1f -n 4 
-- -i --coremask=0x2 --portmask=0x3 --nb-cores=2 --enable-rx-cksum 
--disable-hw-vlan --disable-rss --crc-strip --rxd=1024 --txd=1024 --rxfreet=32 
--txqflags=0
[ SUITE_DUT_CMD] set fwd csum
[ SUITE_DUT_CMD] start
[ SUITE_DUT_CMD] show port stats 0
[ SUITE_DUT_CMD] show port stats 1
[SUITE_TESTER_CMD] echo -n '' > scapyResult.txt
[SUITE_TESTER_CMD] killall scapy 2>/dev/null; echo tester
[SUITE_TESTER_CMD] scapy
[SUITE_TESTER_CMD] nutmac="90:e2:ba:4a:54:81"
[SUITE_TESTER_CMD] sendp([Ether(dst=nutmac, 
src="52:00:00:00:00:00")/IP(len=46)/UDP(chksum=0x0)/Raw(load="P"*18)], 
iface="p785p2")
[SUITE_TESTER_CMD] ex

[dpdk-dev] [PATCH v2 1/1] vmxnet3: add PCI Port Hotplug support

2015-10-31 Thread Yong Wang
On 10/22/15, 7:28 AM, "Bernard Iremonger"  
wrote:


>Signed-off-by: Bernard Iremonger 

Acked-by: Yong Wang 

Any specific reason you changed assignment of adapter_stopped from TRUE/FALSE 
to 1/0?
I saw mixed uses of TRUE/FALSE, true/false and 1/0 all over the DPDK code base.

>---
> doc/guides/rel_notes/release_2_2.rst |  1 +
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 33 +
> 2 files changed, 30 insertions(+), 4 deletions(-)
>
>diff --git a/doc/guides/rel_notes/release_2_2.rst 
>b/doc/guides/rel_notes/release_2_2.rst
>index 4f75cff..9b0c046 100644
>--- a/doc/guides/rel_notes/release_2_2.rst
>+++ b/doc/guides/rel_notes/release_2_2.rst
>@@ -9,6 +9,7 @@ New Features
>   *  Added support for Jumbo Frames.
>   *  Optimize forwarding performance for Chelsio T5 40GbE cards.
> 
>+* **Added port hotplug support to the vmxnet3 PMD.**
> 
> Resolved Issues
> ---
>diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c 
>b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>index a70be5c..d5337ac 100644
>--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
>+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>@@ -70,6 +70,7 @@
> #define PROCESS_SYS_EVENTS 0
> 
> static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);
>+static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);
> static int vmxnet3_dev_configure(struct rte_eth_dev *dev);
> static int vmxnet3_dev_start(struct rte_eth_dev *dev);
> static void vmxnet3_dev_stop(struct rte_eth_dev *dev);
>@@ -294,13 +295,37 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
>   return 0;
> }
> 
>+static int
>+eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev)
>+{
>+  struct vmxnet3_hw *hw = eth_dev->data->dev_private;
>+
>+  PMD_INIT_FUNC_TRACE();
>+
>+  if (rte_eal_process_type() != RTE_PROC_PRIMARY)
>+  return 0;
>+
>+  if (hw->adapter_stopped == 0)
>+  vmxnet3_dev_close(eth_dev);
>+
>+  eth_dev->dev_ops = NULL;
>+  eth_dev->rx_pkt_burst = NULL;
>+  eth_dev->tx_pkt_burst = NULL;
>+
>+  rte_free(eth_dev->data->mac_addrs);
>+  eth_dev->data->mac_addrs = NULL;
>+
>+  return 0;
>+}
>+
> static struct eth_driver rte_vmxnet3_pmd = {
>   .pci_drv = {
>   .name = "rte_vmxnet3_pmd",
>   .id_table = pci_id_vmxnet3_map,
>-  .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
>+  .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE,
>   },
>   .eth_dev_init = eth_vmxnet3_dev_init,
>+  .eth_dev_uninit = eth_vmxnet3_dev_uninit,
>   .dev_private_size = sizeof(struct vmxnet3_hw),
> };
> 
>@@ -579,7 +604,7 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev)
> 
>   PMD_INIT_FUNC_TRACE();
> 
>-  if (hw->adapter_stopped == TRUE) {
>+  if (hw->adapter_stopped == 1) {
>   PMD_INIT_LOG(DEBUG, "Device already closed.");
>   return;
>   }
>@@ -595,7 +620,7 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev)
>   /* reset the device */
>   VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_RESET_DEV);
>   PMD_INIT_LOG(DEBUG, "Device reset.");
>-  hw->adapter_stopped = FALSE;
>+  hw->adapter_stopped = 0;
> 
>   vmxnet3_dev_clear_queues(dev);
> 
>@@ -615,7 +640,7 @@ vmxnet3_dev_close(struct rte_eth_dev *dev)
>   PMD_INIT_FUNC_TRACE();
> 
>   vmxnet3_dev_stop(dev);
>-  hw->adapter_stopped = TRUE;
>+  hw->adapter_stopped = 1;
> }
> 
> static void
>-- 
>1.9.1
>


[dpdk-dev] [PATCH v7 13/28] vmxnet3: copy pci device info to eth_dev data

2015-10-31 Thread Yong Wang

On 10/30/15, 8:08 AM, "Bernard Iremonger"  
wrote:





>Signed-off-by: Bernard Iremonger 
>Acked-by: Bruce Richardson 
>---

Acked-by: Yong Wang 

> drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c 
>b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>index a70be5c..2beee3e 100644
>--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
>+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>@@ -235,6 +235,8 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
>   if (rte_eal_process_type() != RTE_PROC_PRIMARY)
>   return 0;
> 
>+  rte_eth_copy_dev_info(eth_dev, pci_dev);
>+
>   /* Vendor and Device ID need to be set before init of shared code */
>   hw->device_id = pci_dev->id.device_id;
>   hw->vendor_id = pci_dev->id.vendor_id;
>-- 
>1.9.1
>


[dpdk-dev] [PATCHv7 7/9] vmxnet3: add HW specific desc_lim data into dev_info

2015-10-31 Thread Yong Wang
On 10/27/15, 5:51 AM, "Konstantin Ananyev"  
wrote:


>Signed-off-by: Konstantin Ananyev 
>---

Acked-by: Yong Wang 

Do you plan to implement rxq_info_get and txq_info_get for vmxnet3 in 
subsequent patches?

> drivers/net/vmxnet3/vmxnet3_ethdev.c | 12 
> 1 file changed, 12 insertions(+)
>
>diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c 
>b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>index a70be5c..3745b7d 100644
>--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
>+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>@@ -677,6 +677,18 @@ vmxnet3_dev_info_get(__attribute__((unused))struct 
>rte_eth_dev *dev, struct rte_
>   dev_info->default_txconf.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
>   ETH_TXQ_FLAGS_NOOFFLOADS;
>   dev_info->flow_type_rss_offloads = VMXNET3_RSS_OFFLOAD_ALL;
>+
>+  dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
>+  .nb_max = VMXNET3_RX_RING_MAX_SIZE,
>+  .nb_min = VMXNET3_DEF_RX_RING_SIZE,
>+  .nb_align = 1,
>+  };
>+
>+  dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
>+  .nb_max = VMXNET3_TX_RING_MAX_SIZE,
>+  .nb_min = VMXNET3_DEF_TX_RING_SIZE,
>+  .nb_align = 1,
>+  };
> }
> 
> /* return 0 means link status changed, -1 means not changed */
>-- 
>1.8.5.3
>


[dpdk-dev] vmxnet3 can not active device in 5.5

2015-10-31 Thread Yong Wang
On 10/22/15, 8:54 PM, "Bin Zhang"  wrote:


>Hi,
>
>I got this issue in recent update esxi 5.5

Can you share more info on the specific version of ESXi you upgrade from/to and 
the configs you used to initialize vmxnet3 pmd?

If this is 5.5U3, by any chance you are using a rx ring size that?s larger than 
2048?

>
>VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_ACTIVATE_DEV)
>status = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD);
>
>status is not 0, so device can not be activated.
>
>Has anybody got same problem?
>
>Thanks,
>Bin
>
>-- 
>This message is for the designated and authorized recipient only and may 
>contain privileged, proprietary, confidential or otherwise private 
>information relating to vArmour Networks, Inc. and is the sole property of 
>vArmour Networks, Inc.  Any views or opinions expressed are solely those of 
>the author and do not necessarily represent those of vArmour Networks, Inc. 
>If you have received this message in error, or if you are not authorized to 
>receive it, please notify the sender immediately and delete the original 
>message and any attachments from your system immediately. If you are not a 
>designated or authorized recipient, any other use or retention of this 
>message or its contents is prohibited.


[dpdk-dev] [PATCH v3 0/9] enable DCB feature on Intel XL710/X710 NIC

2015-10-31 Thread Jingjing Wu
The patch set enables DCB feature on Intel XL710/X710 NICs, including:
  - Receive queue classification based on traffic class
  - Round Robin ETS schedule (rx and tx).
  - Priority flow control
To make the testpmd and ethdev lib more generic on DCB feature, this
patch set also
  - adds a new API to get DCB related information on NICs.
  - changes the DCB test forwarding in testpmd to be on traffic class.
  - move specific validation from lib and application to drivers.
Additionally, this patch set also corrects some coding style issues.

v2 changes:
 - add a command in testpmd to display dcb info
 - update testpmd guide and release note

v3 changes:
 - add API change in release note
 - add new function in rte_ether_version.map
 - rebase doc update to the same commit with code change

Jingjing Wu (9):
  ethdev: rename dcb_queue to dcb_tc in dcb config struct
  ethdev: move the multi-queue checking to specific drivers
  i40e: enable DCB feature on FVL
  ixgbe: enable DCB+RSS multi-queue mode
  ethdev: new API to get dcb related information
  ixgbe: get_dcb_info ops implement
  i40e: get_dcb_info ops implement
  app/testpmd: set up DCB forwarding based on traffic class
  app/testpmd: add command to display DCB info

 app/test-pmd/cmdline.c  |  54 ++-
 app/test-pmd/config.c   | 202 +-
 app/test-pmd/testpmd.c  | 151 
 app/test-pmd/testpmd.h  |  24 +-
 doc/guides/rel_notes/release_2_2.rst|   6 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  12 +-
 drivers/net/e1000/igb_ethdev.c  |  84 +++-
 drivers/net/i40e/i40e_ethdev.c  | 574 +++-
 drivers/net/i40e/i40e_ethdev.h  |  14 +
 drivers/net/i40e/i40e_rxtx.c|  32 +-
 drivers/net/i40e/i40e_rxtx.h|   2 +
 drivers/net/ixgbe/ixgbe_ethdev.c| 250 
 drivers/net/ixgbe/ixgbe_ethdev.h|   3 +
 drivers/net/ixgbe/ixgbe_rxtx.c  |  58 +--
 examples/vmdq_dcb/main.c|   4 +-
 lib/librte_ether/rte_ethdev.c   | 217 +--
 lib/librte_ether/rte_ethdev.h   |  68 +++-
 lib/librte_ether/rte_ether_version.map  |   7 +
 18 files changed, 1309 insertions(+), 453 deletions(-)

-- 
2.4.0



[dpdk-dev] [PATCH v3 1/9] ethdev: rename dcb_queue to dcb_tc in dcb config struct

2015-10-31 Thread Jingjing Wu
Signed-off-by: Jingjing Wu 
---
 app/test-pmd/testpmd.c   |  8 
 doc/guides/rel_notes/release_2_2.rst |  4 
 drivers/net/ixgbe/ixgbe_rxtx.c   | 10 +-
 examples/vmdq_dcb/main.c |  4 ++--
 lib/librte_ether/rte_ethdev.h| 14 +++---
 5 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 3cd3cd0..4c6aec6 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1878,8 +1878,8 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct 
dcb_config *dcb_conf)
vmdq_rx_conf.pool_map[i].pools = 1 << (i % 
vmdq_rx_conf.nb_queue_pools);
}
for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-   vmdq_rx_conf.dcb_queue[i] = i;
-   vmdq_tx_conf.dcb_queue[i] = i;
+   vmdq_rx_conf.dcb_tc[i] = i;
+   vmdq_tx_conf.dcb_tc[i] = i;
}

/*set DCB mode of RX and TX of multiple queues*/
@@ -1909,8 +1909,8 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, struct 
dcb_config *dcb_conf)
tx_conf.nb_tcs = dcb_conf->num_tcs;

for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++){
-   rx_conf.dcb_queue[i] = i;
-   tx_conf.dcb_queue[i] = i;
+   rx_conf.dcb_tc[i] = i;
+   tx_conf.dcb_tc[i] = i;
}
eth_conf->rxmode.mq_mode = ETH_MQ_RX_DCB;
eth_conf->txmode.mq_mode = ETH_MQ_TX_DCB;
diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 116162e..1857e1d 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -138,6 +138,10 @@ API Changes

 * The devargs union field virtual is renamed to virt for C++ compatibility.

+* The dcb_queue is renamed to dcb_tc in following dcb configuration
+  structures: rte_eth_dcb_rx_conf, rte_eth_vmdq_dcb_tx_conf,
+  rte_eth_dcb_tx_conf, rte_eth_vmdq_dcb_conf.
+

 ABI Changes
 ---
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 1158562..6a62d67 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -2928,7 +2928,7 @@ ixgbe_vmdq_dcb_configure(struct rte_eth_dev *dev)
 * mapping is done with 3 bits per priority,
 * so shift by i*3 each time
 */
-   queue_mapping |= ((cfg->dcb_queue[i] & 0x07) << (i * 3));
+   queue_mapping |= ((cfg->dcb_tc[i] & 0x07) << (i * 3));

IXGBE_WRITE_REG(hw, IXGBE_RTRUP2TC, queue_mapping);

@@ -3063,7 +3063,7 @@ ixgbe_vmdq_dcb_rx_config(struct rte_eth_dev *dev,
}
/* User Priority to Traffic Class mapping */
for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-   j = vmdq_rx_conf->dcb_queue[i];
+   j = vmdq_rx_conf->dcb_tc[i];
tc = &dcb_config->tc_config[j];
tc->path[IXGBE_DCB_RX_CONFIG].up_to_tc_bitmap =
(uint8_t)(1 << j);
@@ -3091,7 +3091,7 @@ ixgbe_dcb_vt_tx_config(struct rte_eth_dev *dev,

/* User Priority to Traffic Class mapping */
for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-   j = vmdq_tx_conf->dcb_queue[i];
+   j = vmdq_tx_conf->dcb_tc[i];
tc = &dcb_config->tc_config[j];
tc->path[IXGBE_DCB_TX_CONFIG].up_to_tc_bitmap =
(uint8_t)(1 << j);
@@ -3113,7 +3113,7 @@ ixgbe_dcb_rx_config(struct rte_eth_dev *dev,

/* User Priority to Traffic Class mapping */
for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-   j = rx_conf->dcb_queue[i];
+   j = rx_conf->dcb_tc[i];
tc = &dcb_config->tc_config[j];
tc->path[IXGBE_DCB_RX_CONFIG].up_to_tc_bitmap =
(uint8_t)(1 << j);
@@ -3134,7 +3134,7 @@ ixgbe_dcb_tx_config(struct rte_eth_dev *dev,

/* User Priority to Traffic Class mapping */
for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-   j = tx_conf->dcb_queue[i];
+   j = tx_conf->dcb_tc[i];
tc = &dcb_config->tc_config[j];
tc->path[IXGBE_DCB_TX_CONFIG].up_to_tc_bitmap =
(uint8_t)(1 << j);
diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index c31c2ce..b90ac28 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -107,7 +107,7 @@ static const struct rte_eth_conf vmdq_dcb_conf_default = {
.default_pool = 0,
.nb_pool_maps = 0,
.pool_map = {{0, 0},},
-   .dcb_queue = {0},
+   .dcb_tc = {0},
 

[dpdk-dev] [PATCH v3 2/9] ethdev: move the multi-queue checking to specific drivers

2015-10-31 Thread Jingjing Wu
Differnet NIC has its specific constraint on the multi-queue
configuration, so move the checking from ethdev lib to drivers.

Signed-off-by: Jingjing Wu 
---
 drivers/net/e1000/igb_ethdev.c   |  84 -
 drivers/net/ixgbe/ixgbe_ethdev.c | 171 +
 drivers/net/ixgbe/ixgbe_ethdev.h |   3 +
 lib/librte_ether/rte_ethdev.c| 199 ---
 4 files changed, 257 insertions(+), 200 deletions(-)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 3ab082e..7a8fa93 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -865,16 +865,98 @@ rte_igbvf_pmd_init(const char *name __rte_unused, const 
char *params __rte_unuse
 }

 static int
+igb_check_mq_mode(struct rte_eth_dev *dev)
+{
+   enum rte_eth_rx_mq_mode rx_mq_mode = dev->data->dev_conf.rxmode.mq_mode;
+   enum rte_eth_tx_mq_mode tx_mq_mode = dev->data->dev_conf.txmode.mq_mode;
+   uint16_t nb_rx_q = dev->data->nb_rx_queues;
+   uint16_t nb_tx_q = dev->data->nb_rx_queues;
+
+   if ((rx_mq_mode & ETH_MQ_RX_DCB_FLAG) ||
+   tx_mq_mode == ETH_MQ_TX_DCB ||
+   tx_mq_mode == ETH_MQ_TX_VMDQ_DCB) {
+   PMD_INIT_LOG(ERR, "DCB mode is not supported.");
+   return -EINVAL;
+   }
+   if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
+   /* Check multi-queue mode.
+* To no break software we accept ETH_MQ_RX_NONE as this might
+* be used to turn off VLAN filter.
+*/
+
+   if (rx_mq_mode == ETH_MQ_RX_NONE ||
+   rx_mq_mode == ETH_MQ_RX_VMDQ_ONLY) {
+   dev->data->dev_conf.rxmode.mq_mode = 
ETH_MQ_RX_VMDQ_ONLY;
+   RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 1;
+   } else {
+   /* Only support one queue on VFs.
+* RSS together with SRIOV is not supported.
+*/
+   PMD_INIT_LOG(ERR, "SRIOV is active,"
+   " wrong mq_mode rx %d.",
+   rx_mq_mode);
+   return -EINVAL;
+   }
+   /* TX mode is not used here, so mode might be ignored.*/
+   if (tx_mq_mode != ETH_MQ_TX_VMDQ_ONLY) {
+   /* SRIOV only works in VMDq enable mode */
+   PMD_INIT_LOG(WARNING, "SRIOV is active,"
+   " TX mode %d is not supported. "
+   " Driver will behave as %d mode.",
+   tx_mq_mode, ETH_MQ_TX_VMDQ_ONLY);
+   }
+
+   /* check valid queue number */
+   if ((nb_rx_q > 1) || (nb_tx_q > 1)) {
+   PMD_INIT_LOG(ERR, "SRIOV is active,"
+   " only support one queue on VFs.");
+   return -EINVAL;
+   }
+   } else {
+   /* To no break software that set invalid mode, only display
+* warning if invalid mode is used.
+*/
+   if (rx_mq_mode != ETH_MQ_RX_NONE &&
+   rx_mq_mode != ETH_MQ_RX_VMDQ_ONLY &&
+   rx_mq_mode != ETH_MQ_RX_RSS) {
+   /* RSS together with VMDq not supported*/
+   PMD_INIT_LOG(ERR, "RX mode %d is not supported.",
+rx_mq_mode);
+   return -EINVAL;
+   }
+
+   if (tx_mq_mode != ETH_MQ_TX_NONE &&
+   tx_mq_mode != ETH_MQ_TX_VMDQ_ONLY) {
+   PMD_INIT_LOG(WARNING, "TX mode %d is not supported."
+   " Due to txmode is meaningless in this"
+   " driver, just ignore.",
+   tx_mq_mode);
+   }
+   }
+   return 0;
+}
+
+static int
 eth_igb_configure(struct rte_eth_dev *dev)
 {
struct e1000_interrupt *intr =
E1000_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
+   int ret;

PMD_INIT_FUNC_TRACE();
+
+   /* multipe queue mode checking */
+   ret  = igb_check_mq_mode(dev);
+   if (ret != 0) {
+   PMD_DRV_LOG(ERR, "igb_check_mq_mode fails with %d.",
+   ret);
+   return ret;
+   }
+
intr->flags |= E1000_FLAG_NEED_LINK_UPDATE;
PMD_INIT_FUNC_TRACE();

-   return (0);
+   return 0;
 }

 static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4373661..ece2e73 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1640,14 +1640,185 @@ ixgbe_vmdq_vlan_hw_filter_enable(struct rte_eth_dev 
*dev)
 }

 static int
+ixgbe_check_vf_rss_rxq_num(struct rte_eth_dev 

[dpdk-dev] [PATCH v3 3/9] i40e: enable DCB feature on FVL

2015-10-31 Thread Jingjing Wu
This patch enables DCB feature on Intel XL710/X710 NICs. It includes:
  Receive queue classification based on traffic class
  Round Robin ETS schedule (rx and tx)
  Priority flow control

Signed-off-by: Jingjing Wu 
---
 doc/guides/rel_notes/release_2_2.rst |   2 +
 drivers/net/i40e/i40e_ethdev.c   | 532 ++-
 drivers/net/i40e/i40e_ethdev.h   |  14 +
 drivers/net/i40e/i40e_rxtx.c |  32 ++-
 drivers/net/i40e/i40e_rxtx.h |   2 +
 5 files changed, 568 insertions(+), 14 deletions(-)

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 1857e1d..ddfd322 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -45,6 +45,8 @@ New Features

 * **Added port hotplug support to xenvirt.**

+* **Added support DCB on PF to the i40e driver.**
+

 Resolved Issues
 ---
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 016838a..ce4efb2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -56,6 +56,7 @@
 #include "base/i40e_adminq_cmd.h"
 #include "base/i40e_type.h"
 #include "base/i40e_register.h"
+#include "base/i40e_dcb.h"
 #include "i40e_ethdev.h"
 #include "i40e_rxtx.h"
 #include "i40e_pf.h"
@@ -134,6 +135,10 @@
 #define I40E_PRTTSYN_TSYNENA  0x8000
 #define I40E_PRTTSYN_TSYNTYPE 0x0e00

+#define I40E_MAX_PERCENT100
+#define I40E_DEFAULT_DCB_APP_NUM1
+#define I40E_DEFAULT_DCB_APP_PRIO   3
+
 static int eth_i40e_dev_init(struct rte_eth_dev *eth_dev);
 static int eth_i40e_dev_uninit(struct rte_eth_dev *eth_dev);
 static int i40e_dev_configure(struct rte_eth_dev *dev);
@@ -189,6 +194,8 @@ static int i40e_pf_parameter_init(struct rte_eth_dev *dev);
 static int i40e_pf_setup(struct i40e_pf *pf);
 static int i40e_dev_rxtx_init(struct i40e_pf *pf);
 static int i40e_vmdq_setup(struct rte_eth_dev *dev);
+static int i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb);
+static int i40e_dcb_setup(struct rte_eth_dev *dev);
 static void i40e_stat_update_32(struct i40e_hw *hw, uint32_t reg,
bool offset_loaded, uint64_t *offset, uint64_t *stat);
 static void i40e_stat_update_48(struct i40e_hw *hw,
@@ -517,11 +524,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 ((hw->nvm.version >> 4) & 0xff),
 (hw->nvm.version & 0xf), hw->nvm.eetrack);

-   /* Disable LLDP */
-   ret = i40e_aq_stop_lldp(hw, true, NULL);
-   if (ret != I40E_SUCCESS) /* Its failure can be ignored */
-   PMD_INIT_LOG(INFO, "Failed to stop lldp");
-
/* Clear PXE mode */
i40e_clear_pxe_mode(hw);

@@ -642,6 +644,13 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
/* initialize mirror rule list */
TAILQ_INIT(&pf->mirror_list);

+   /* Init dcb to sw mode by default */
+   ret = i40e_dcb_init_configure(dev, TRUE);
+   if (ret != I40E_SUCCESS) {
+   PMD_INIT_LOG(INFO, "Failed to init dcb.");
+   pf->flags &= ~I40E_FLAG_DCB;
+   }
+
return 0;

 err_mac_alloc:
@@ -728,7 +737,7 @@ i40e_dev_configure(struct rte_eth_dev *dev)
I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode;
-   int ret;
+   int i, ret;

/* Initialize to TRUE. If any of Rx queues doesn't meet the
 * bulk allocation or vector Rx preconditions we will reset it.
@@ -773,8 +782,27 @@ i40e_dev_configure(struct rte_eth_dev *dev)
if (ret)
goto err;
}
+
+   if (mq_mode & ETH_MQ_RX_DCB_FLAG) {
+   ret = i40e_dcb_setup(dev);
+   if (ret) {
+   PMD_DRV_LOG(ERR, "failed to configure DCB.");
+   goto err_dcb;
+   }
+   }
+
return 0;
+
+err_dcb:
+   /* need to release vmdq resource if exists */
+   for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
+   i40e_vsi_release(pf->vmdq[i].vsi);
+   pf->vmdq[i].vsi = NULL;
+   }
+   rte_free(pf->vmdq);
+   pf->vmdq = NULL;
 err:
+   /* need to release fdir resource if exists */
i40e_fdir_teardown(pf);
return ret;
 }
@@ -2517,6 +2545,9 @@ i40e_pf_parameter_init(struct rte_eth_dev *dev)
 */
}

+   if (hw->func_caps.dcb)
+   pf->flags |= I40E_FLAG_DCB;
+
if (sum_vsis > pf->max_num_vsi ||
sum_queues > hw->func_caps.num_rx_qp) {
PMD_INIT_LOG(ERR, "VSI/QUEUE setting can't be satisfied");
@@ -2922,7 +2953,7 @@ i40e_vsi_config_tc_queue_mapping(struct i40e_vsi *vsi,
 struct i40e_aqc_vsi_properties_data *info,
 uint8_t enabled_tcmap)
 {
-   int ret, total_tc = 0, i;
+

[dpdk-dev] [PATCH v3 5/9] ethdev: new API to get dcb related information

2015-10-31 Thread Jingjing Wu
This patch adds one new API to get dcb related info.
  rte_eth_dev_get_dcb_info

Signed-off-by: Jingjing Wu 
---
 lib/librte_ether/rte_ethdev.c  | 18 
 lib/librte_ether/rte_ethdev.h  | 54 ++
 lib/librte_ether/rte_ether_version.map |  7 +
 3 files changed, 79 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index c7247c3..721cef6 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3143,3 +3143,21 @@ rte_eth_dev_set_eeprom(uint8_t port_id, struct 
rte_dev_eeprom_info *info)
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
return (*dev->dev_ops->set_eeprom)(dev, info);
 }
+
+int
+rte_eth_dev_get_dcb_info(uint8_t port_id,
+struct rte_eth_dcb_info *dcb_info)
+{
+   struct rte_eth_dev *dev;
+
+   if (!rte_eth_dev_is_valid_port(port_id)) {
+   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+   return -ENODEV;
+   }
+
+   dev = &rte_eth_devices[port_id];
+   memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
+
+   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
+   return (*dev->dev_ops->get_dcb_info)(dev, dcb_info);
+}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 377da6a..2e05189 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -854,6 +854,38 @@ struct rte_eth_xstats {
uint64_t value;
 };

+#define ETH_DCB_NUM_TCS8
+#define ETH_MAX_VMDQ_POOL  64
+
+/**
+ * A structure used to get the information of queue and
+ * TC mapping on both TX and RX paths.
+ */
+struct rte_eth_dcb_tc_queue_mapping {
+   /** rx queues assigned to tc per Pool */
+   struct {
+   uint8_t base;
+   uint8_t nb_queue;
+   } tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
+   /** rx queues assigned to tc per Pool */
+   struct {
+   uint8_t base;
+   uint8_t nb_queue;
+   } tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
+};
+
+/**
+ * A structure used to get the information of DCB.
+ * It includes TC UP mapping and queue TC mapping.
+ */
+struct rte_eth_dcb_info {
+   uint8_t nb_tcs;/**< number of TCs */
+   uint8_t prio_tc[ETH_DCB_NUM_USER_PRIORITIES]; /**< Priority to tc */
+   uint8_t tc_bws[ETH_DCB_NUM_TCS]; /**< TX BW percentage for each TC */
+   /** rx queues assigned to tc */
+   struct rte_eth_dcb_tc_queue_mapping tc_queue;
+};
+
 struct rte_eth_dev;

 struct rte_eth_dev_callback;
@@ -1207,6 +1239,10 @@ typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev,
 void *arg);
 /**< @internal Take operations to assigned filter type on an Ethernet device */

+typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
+struct rte_eth_dcb_info *dcb_info);
+/**< @internal Get dcb information on an Ethernet device */
+
 /**
  * @internal A structure containing the functions exported by an Ethernet 
driver.
  */
@@ -1312,6 +1348,9 @@ struct eth_dev_ops {
eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
/** Read the IEEE1588/802.1AS TX timestamp. */
eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
+
+   /** Get DCB information */
+   eth_get_dcb_info get_dcb_info;
 };

 /**
@@ -3321,6 +3360,21 @@ int rte_eth_dev_filter_ctrl(uint8_t port_id, enum 
rte_filter_type filter_type,
enum rte_filter_op filter_op, void *arg);

 /**
+ * Get DCB information on an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param dcb_info
+ *   dcb information.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if port identifier is invalid.
+ *   - (-ENOTSUP) if hardware doesn't support.
+ */
+int rte_eth_dev_get_dcb_info(uint8_t port_id,
+struct rte_eth_dcb_info *dcb_info);
+
+/**
  * Add a callback to be called on packet RX on a given port and queue.
  *
  * This API configures a function to be called for each burst of
diff --git a/lib/librte_ether/rte_ether_version.map 
b/lib/librte_ether/rte_ether_version.map
index 8345a6c..3c4dc2d 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -127,3 +127,10 @@ DPDK_2.1 {
rte_eth_timesync_read_tx_timestamp;

 } DPDK_2.0;
+
+DPDK_2.2 {
+   global:
+
+   rte_eth_dev_get_dcb_info;
+
+} DPDK_2.1;
-- 
2.4.0



[dpdk-dev] [PATCH v3 6/9] ixgbe: get_dcb_info ops implement

2015-10-31 Thread Jingjing Wu
This patch implements the get_dcb_info ops in ixgbe driver.

Signed-off-by: Jingjing Wu 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 79 
 1 file changed, 79 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index ece2e73..e9ce466 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -304,6 +304,8 @@ static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, 
uint16_t mtu);
 static int ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev,
  struct ether_addr *mc_addr_set,
  uint32_t nb_mc_addr);
+static int ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev,
+  struct rte_eth_dcb_info *dcb_info);

 static int ixgbe_get_reg_length(struct rte_eth_dev *dev);
 static int ixgbe_get_regs(struct rte_eth_dev *dev,
@@ -465,6 +467,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.get_eeprom_length= ixgbe_get_eeprom_length,
.get_eeprom   = ixgbe_get_eeprom,
.set_eeprom   = ixgbe_set_eeprom,
+   .get_dcb_info = ixgbe_dev_get_dcb_info,
 };

 /*
@@ -5734,6 +5737,82 @@ ixgbe_rss_update_sp(enum ixgbe_mac_type mac_type) {
}
 }

+static int
+ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev,
+   struct rte_eth_dcb_info *dcb_info)
+{
+   struct ixgbe_dcb_config *dcb_config =
+   IXGBE_DEV_PRIVATE_TO_DCB_CFG(dev->data->dev_private);
+   struct ixgbe_dcb_tc_config *tc;
+   uint8_t i, j;
+
+   if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_DCB_FLAG)
+   dcb_info->nb_tcs = dcb_config->num_tcs.pg_tcs;
+   else
+   dcb_info->nb_tcs = 1;
+
+   if (dcb_config->vt_mode) { /* vt is enabled*/
+   struct rte_eth_vmdq_dcb_conf *vmdq_rx_conf =
+   &dev->data->dev_conf.rx_adv_conf.vmdq_dcb_conf;
+   for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++)
+   dcb_info->prio_tc[i] = vmdq_rx_conf->dcb_tc[i];
+   for (i = 0; i < vmdq_rx_conf->nb_queue_pools; i++) {
+   for (j = 0; j < dcb_info->nb_tcs; j++) {
+   dcb_info->tc_queue.tc_rxq[i][j].base =
+   i * dcb_info->nb_tcs + j;
+   dcb_info->tc_queue.tc_rxq[i][j].nb_queue = 1;
+   dcb_info->tc_queue.tc_txq[i][j].base =
+   i * dcb_info->nb_tcs + j;
+   dcb_info->tc_queue.tc_txq[i][j].nb_queue = 1;
+   }
+   }
+   } else { /* vt is disabled*/
+   struct rte_eth_dcb_rx_conf *rx_conf =
+   &dev->data->dev_conf.rx_adv_conf.dcb_rx_conf;
+   for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++)
+   dcb_info->prio_tc[i] = rx_conf->dcb_tc[i];
+   if (dcb_info->nb_tcs == ETH_4_TCS) {
+   for (i = 0; i < dcb_info->nb_tcs; i++) {
+   dcb_info->tc_queue.tc_rxq[0][i].base = i * 32;
+   dcb_info->tc_queue.tc_rxq[0][i].nb_queue = 16;
+   }
+   dcb_info->tc_queue.tc_txq[0][0].base = 0;
+   dcb_info->tc_queue.tc_txq[0][1].base = 64;
+   dcb_info->tc_queue.tc_txq[0][2].base = 96;
+   dcb_info->tc_queue.tc_txq[0][3].base = 112;
+   dcb_info->tc_queue.tc_txq[0][0].nb_queue = 64;
+   dcb_info->tc_queue.tc_txq[0][1].nb_queue = 32;
+   dcb_info->tc_queue.tc_txq[0][2].nb_queue = 16;
+   dcb_info->tc_queue.tc_txq[0][3].nb_queue = 16;
+   } else if (dcb_info->nb_tcs == ETH_8_TCS) {
+   for (i = 0; i < dcb_info->nb_tcs; i++) {
+   dcb_info->tc_queue.tc_rxq[0][i].base = i * 16;
+   dcb_info->tc_queue.tc_rxq[0][i].nb_queue = 16;
+   }
+   dcb_info->tc_queue.tc_txq[0][0].base = 0;
+   dcb_info->tc_queue.tc_txq[0][1].base = 32;
+   dcb_info->tc_queue.tc_txq[0][2].base = 64;
+   dcb_info->tc_queue.tc_txq[0][3].base = 80;
+   dcb_info->tc_queue.tc_txq[0][4].base = 96;
+   dcb_info->tc_queue.tc_txq[0][5].base = 104;
+   dcb_info->tc_queue.tc_txq[0][6].base = 112;
+   dcb_info->tc_queue.tc_txq[0][7].base = 120;
+   dcb_info->tc_queue.tc_txq[0][0].nb_queue = 32;
+   dcb_info->tc_queue.tc_txq[0][1].nb_queue = 32;
+   dcb_info->tc_queue.tc_txq[0][2].nb_queue = 16;
+  

[dpdk-dev] [PATCH v3 7/9] i40e: get_dcb_info ops implement

2015-10-31 Thread Jingjing Wu
This patch implements the get_dcb_info ops in i40e driver.

Signed-off-by: Jingjing Wu 
---
 drivers/net/i40e/i40e_ethdev.c | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ce4efb2..480dd57 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -247,6 +247,8 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
enum rte_filter_type filter_type,
enum rte_filter_op filter_op,
void *arg);
+static int i40e_dev_get_dcb_info(struct rte_eth_dev *dev,
+ struct rte_eth_dcb_info *dcb_info);
 static void i40e_configure_registers(struct i40e_hw *hw);
 static void i40e_hw_init(struct i40e_hw *hw);
 static int i40e_config_qinq(struct i40e_hw *hw, struct i40e_vsi *vsi);
@@ -320,6 +322,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
.timesync_disable = i40e_timesync_disable,
.timesync_read_rx_timestamp   = i40e_timesync_read_rx_timestamp,
.timesync_read_tx_timestamp   = i40e_timesync_read_tx_timestamp,
+   .get_dcb_info = i40e_dev_get_dcb_info,
 };

 static struct eth_driver rte_i40e_pmd = {
@@ -7016,3 +7019,42 @@ i40e_dcb_setup(struct rte_eth_dev *dev)
}
return 0;
 }
+
+static int
+i40e_dev_get_dcb_info(struct rte_eth_dev *dev,
+ struct rte_eth_dcb_info *dcb_info)
+{
+   struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+   struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   struct i40e_vsi *vsi = pf->main_vsi;
+   struct i40e_dcbx_config *dcb_cfg = &hw->local_dcbx_config;
+   uint16_t bsf, tc_mapping;
+   int i;
+
+   if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_DCB_FLAG)
+   dcb_info->nb_tcs = rte_bsf32(vsi->enabled_tc + 1);
+   else
+   dcb_info->nb_tcs = 1;
+   for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
+   dcb_info->prio_tc[i] = dcb_cfg->etscfg.prioritytable[i];
+   for (i = 0; i < dcb_info->nb_tcs; i++)
+   dcb_info->tc_bws[i] = dcb_cfg->etscfg.tcbwtable[i];
+
+   for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
+   if (vsi->enabled_tc & (1 << i)) {
+   tc_mapping = rte_le_to_cpu_16(vsi->info.tc_mapping[i]);
+   /* only main vsi support multi TCs */
+   dcb_info->tc_queue.tc_rxq[0][i].base =
+   (tc_mapping & I40E_AQ_VSI_TC_QUE_OFFSET_MASK) >>
+   I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT;
+   dcb_info->tc_queue.tc_txq[0][i].base =
+   dcb_info->tc_queue.tc_rxq[0][i].base;
+   bsf = (tc_mapping & I40E_AQ_VSI_TC_QUE_NUMBER_MASK) >>
+   I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT;
+   dcb_info->tc_queue.tc_rxq[0][i].nb_queue = 1 << bsf;
+   dcb_info->tc_queue.tc_txq[0][i].nb_queue =
+   dcb_info->tc_queue.tc_rxq[0][i].nb_queue;
+   }
+   }
+   return 0;
+}
-- 
2.4.0



[dpdk-dev] [PATCH v3 4/9] ixgbe: enable DCB+RSS multi-queue mode

2015-10-31 Thread Jingjing Wu
This patch enables DCB+RSS multi-queue mode, and also fix some coding
style.

Signed-off-by: Jingjing Wu 
---
 drivers/net/ixgbe/ixgbe_rxtx.c | 48 +-
 1 file changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 6a62d67..ad66b09 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -3169,9 +3169,13 @@ ixgbe_dcb_rx_hw_config(struct ixgbe_hw *hw,
reg = (reg & ~IXGBE_MRQC_MRQE_MASK) |
IXGBE_MRQC_VMDQRT4TCEN;
else {
+   /* no matter the mode is DCB or DCB_RSS, just
+* set the MRQE to RSSXTCEN. RSS is controlled
+* by RSS_FIELD
+*/
IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, 0);
reg = (reg & ~IXGBE_MRQC_MRQE_MASK) |
-   IXGBE_MRQC_RT4TCEN;
+   IXGBE_MRQC_RTRSS4TCEN;
}
}
if (dcb_config->num_tcs.pg_tcs == 8) {
@@ -3181,7 +3185,7 @@ ixgbe_dcb_rx_hw_config(struct ixgbe_hw *hw,
else {
IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, 0);
reg = (reg & ~IXGBE_MRQC_MRQE_MASK) |
-   IXGBE_MRQC_RT8TCEN;
+   IXGBE_MRQC_RTRSS8TCEN;
}
}

@@ -3286,16 +3290,17 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
 *get dcb and VT rx configuration parameters
 *from rte_eth_conf
 */
-   ixgbe_vmdq_dcb_rx_config(dev,dcb_config);
+   ixgbe_vmdq_dcb_rx_config(dev, dcb_config);
/*Configure general VMDQ and DCB RX parameters*/
ixgbe_vmdq_dcb_configure(dev);
}
break;
case ETH_MQ_RX_DCB:
+   case ETH_MQ_RX_DCB_RSS:
dcb_config->vt_mode = false;
config_dcb_rx = DCB_RX_CONFIG;
/* Get dcb TX configuration parameters from rte_eth_conf */
-   ixgbe_dcb_rx_config(dev,dcb_config);
+   ixgbe_dcb_rx_config(dev, dcb_config);
/*Configure general DCB RX parameters*/
ixgbe_dcb_rx_hw_config(hw, dcb_config);
break;
@@ -3317,7 +3322,7 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
dcb_config->vt_mode = false;
config_dcb_tx = DCB_TX_CONFIG;
/*get DCB TX configuration parameters from rte_eth_conf*/
-   ixgbe_dcb_tx_config(dev,dcb_config);
+   ixgbe_dcb_tx_config(dev, dcb_config);
/*Configure general DCB TX parameters*/
ixgbe_dcb_tx_hw_config(hw, dcb_config);
break;
@@ -3458,14 +3463,15 @@ void ixgbe_configure_dcb(struct rte_eth_dev *dev)

/* check support mq_mode for DCB */
if ((dev_conf->rxmode.mq_mode != ETH_MQ_RX_VMDQ_DCB) &&
-   (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB))
+   (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB) &&
+   (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB_RSS))
return;

if (dev->data->nb_rx_queues != ETH_DCB_NUM_QUEUES)
return;

/** Configure DCB hardware **/
-   ixgbe_dcb_hw_configure(dev,dcb_cfg);
+   ixgbe_dcb_hw_configure(dev, dcb_cfg);

return;
 }
@@ -3707,21 +3713,25 @@ ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
 * any DCB/RSS w/o VMDq multi-queue setting
 */
switch (dev->data->dev_conf.rxmode.mq_mode) {
-   case ETH_MQ_RX_RSS:
-   ixgbe_rss_configure(dev);
-   break;
+   case ETH_MQ_RX_RSS:
+   case ETH_MQ_RX_DCB_RSS:
+   case ETH_MQ_RX_VMDQ_RSS:
+   ixgbe_rss_configure(dev);
+   break;

-   case ETH_MQ_RX_VMDQ_DCB:
-   ixgbe_vmdq_dcb_configure(dev);
-   break;
+   case ETH_MQ_RX_VMDQ_DCB:
+   ixgbe_vmdq_dcb_configure(dev);
+   break;

-   case ETH_MQ_RX_VMDQ_ONLY:
-   ixgbe_vmdq_rx_hw_configure(dev);
-   break;
+   case ETH_MQ_RX_VMDQ_ONLY:
+   ixgbe_vmdq_rx_hw_configure(dev);
+   break;

-   case ETH_MQ_RX_NONE:
-   /* if mq_mode is none, disable rss mode.*/
-

[dpdk-dev] [PATCH v3 8/9] app/testpmd: set up DCB forwarding based on traffic class

2015-10-31 Thread Jingjing Wu
This patch changes the testpmd DCB forwarding stream to make it
based on traffic class.
It also fixes some coding style issues.

Signed-off-by: Jingjing Wu 
---
 app/test-pmd/cmdline.c |  39 +++-
 app/test-pmd/config.c  | 159 +
 app/test-pmd/testpmd.c | 151 +-
 app/test-pmd/testpmd.h |  23 +--
 4 files changed, 176 insertions(+), 196 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b3c36f3..0254628 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1999,37 +1999,46 @@ cmd_config_dcb_parsed(void *parsed_result,
 __attribute__((unused)) void *data)
 {
struct cmd_config_dcb *res = parsed_result;
-   struct dcb_config dcb_conf;
portid_t port_id = res->port_id;
struct rte_port *port;
+   uint8_t pfc_en;
+   int ret;

port = &ports[port_id];
/** Check if the port is not started **/
if (port->port_status != RTE_PORT_STOPPED) {
-   printf("Please stop port %d first\n",port_id);
+   printf("Please stop port %d first\n", port_id);
return;
}

-   dcb_conf.num_tcs = (enum rte_eth_nb_tcs) res->num_tcs;
-   if ((dcb_conf.num_tcs != ETH_4_TCS) && (dcb_conf.num_tcs != ETH_8_TCS)){
-   printf("The invalid number of traffic class,only 4 or 8 
allowed\n");
+   if ((res->num_tcs != ETH_4_TCS) && (res->num_tcs != ETH_8_TCS)) {
+   printf("The invalid number of traffic class,"
+   " only 4 or 8 allowed.\n");
return;
}

-   /* DCB in VT mode */
-   if (!strncmp(res->vt_en, "on",2))
-   dcb_conf.dcb_mode = DCB_VT_ENABLED;
+   if (nb_fwd_lcores < res->num_tcs) {
+   printf("nb_cores shouldn't be less than number of TCs.\n");
+   return;
+   }
+   if (!strncmp(res->pfc_en, "on", 2))
+   pfc_en = 1;
else
-   dcb_conf.dcb_mode = DCB_ENABLED;
+   pfc_en = 0;

-   if (!strncmp(res->pfc_en, "on",2)) {
-   dcb_conf.pfc_en = 1;
-   }
+   /* DCB in VT mode */
+   if (!strncmp(res->vt_en, "on", 2))
+   ret = init_port_dcb_config(port_id, DCB_VT_ENABLED,
+   (enum rte_eth_nb_tcs)res->num_tcs,
+   pfc_en);
else
-   dcb_conf.pfc_en = 0;
+   ret = init_port_dcb_config(port_id, DCB_ENABLED,
+   (enum rte_eth_nb_tcs)res->num_tcs,
+   pfc_en);
+

-   if (init_port_dcb_config(port_id,&dcb_conf) != 0) {
-   printf("Cannot initialize network ports\n");
+   if (ret != 0) {
+   printf("Cannot initialize network ports.\n");
return;
}

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1ec6a77..ef87581 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1128,113 +1128,92 @@ rss_fwd_config_setup(void)
}
 }

-/*
- * In DCB and VT on,the mapping of 128 receive queues to 128 transmit queues.
- */
-static void
-dcb_rxq_2_txq_mapping(queueid_t rxq, queueid_t *txq)
-{
-   if(dcb_q_mapping == DCB_4_TCS_Q_MAPPING) {
-
-   if (rxq < 32)
-   /* tc0: 0-31 */
-   *txq = rxq;
-   else if (rxq < 64) {
-   /* tc1: 64-95 */
-   *txq =  (uint16_t)(rxq + 32);
-   }
-   else {
-   /* tc2: 96-111;tc3:112-127 */
-   *txq =  (uint16_t)(rxq/2 + 64);
-   }
-   }
-   else {
-   if (rxq < 16)
-   /* tc0 mapping*/
-   *txq = rxq;
-   else if (rxq < 32) {
-   /* tc1 mapping*/
-*txq = (uint16_t)(rxq + 16);
-   }
-   else if (rxq < 64) {
-   /*tc2,tc3 mapping */
-   *txq =  (uint16_t)(rxq + 32);
-   }
-   else {
-   /* tc4,tc5,tc6 and tc7 mapping */
-   *txq =  (uint16_t)(rxq/2 + 64);
-   }
-   }
-}
-
 /**
- * For the DCB forwarding test, each core is assigned on every port 
multi-transmit
- * queue.
+ * For the DCB forwarding test, each core is assigned on each traffic class.
  *
  * Each core is assigned a multi-stream, each stream being composed of
  * a RX queue to poll on a RX port for input messages, associated with
- * a TX queue of a TX port where to send forwarded packets.
- * All packets received on the RX queue of index "RxQj" of the RX port "RxPi"
- * are sent on the TX queue "TxQl" of the TX port "TxPk" according to the two
- * following rules:
- * In VT mode,
- *- TxPk = (RxPi + 1) if RxPi is even, (RxP

[dpdk-dev] [PATCH v3 9/9] app/testpmd: add command to display DCB info

2015-10-31 Thread Jingjing Wu
This patch adds a command to display DCB info in ports.

Signed-off-by: Jingjing Wu 
---
 app/test-pmd/cmdline.c  | 15 ++
 app/test-pmd/config.c   | 43 +
 app/test-pmd/testpmd.h  |  1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 
 4 files changed, 61 insertions(+), 10 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0254628..410f149 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -182,7 +182,7 @@ static void cmd_help_long_parsed(void *parsed_result,
"Display:\n"
"\n\n"

-   "show port (info|stats|xstats|fdir|stat_qmap) 
(port_id|all)\n"
+   "show port (info|stats|xstats|fdir|stat_qmap|dcb_tc) 
(port_id|all)\n"
"Display information for port_id, or all.\n\n"

"show port X rss reta (size) (mask0,mask1,...)\n"
@@ -5235,6 +5235,9 @@ static void cmd_showportall_parsed(void *parsed_result,
else if (!strcmp(res->what, "stat_qmap"))
FOREACH_PORT(i, ports)
nic_stats_mapping_display(i);
+   else if (!strcmp(res->what, "dcb_tc"))
+   FOREACH_PORT(i, ports)
+   port_dcb_info_display(i);
 }

 cmdline_parse_token_string_t cmd_showportall_show =
@@ -5244,13 +5247,13 @@ cmdline_parse_token_string_t cmd_showportall_port =
TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, port, "port");
 cmdline_parse_token_string_t cmd_showportall_what =
TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, what,
-"info#stats#xstats#fdir#stat_qmap");
+"info#stats#xstats#fdir#stat_qmap#dcb_tc");
 cmdline_parse_token_string_t cmd_showportall_all =
TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, all, "all");
 cmdline_parse_inst_t cmd_showportall = {
.f = cmd_showportall_parsed,
.data = NULL,
-   .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap all",
+   .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc 
all",
.tokens = {
(void *)&cmd_showportall_show,
(void *)&cmd_showportall_port,
@@ -5288,6 +5291,8 @@ static void cmd_showport_parsed(void *parsed_result,
 fdir_get_infos(res->portnum);
else if (!strcmp(res->what, "stat_qmap"))
nic_stats_mapping_display(res->portnum);
+   else if (!strcmp(res->what, "dcb_tc"))
+   port_dcb_info_display(res->portnum);
 }

 cmdline_parse_token_string_t cmd_showport_show =
@@ -5297,14 +5302,14 @@ cmdline_parse_token_string_t cmd_showport_port =
TOKEN_STRING_INITIALIZER(struct cmd_showport_result, port, "port");
 cmdline_parse_token_string_t cmd_showport_what =
TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what,
-"info#stats#xstats#fdir#stat_qmap");
+"info#stats#xstats#fdir#stat_qmap#dcb_tc");
 cmdline_parse_token_num_t cmd_showport_portnum =
TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, UINT8);

 cmdline_parse_inst_t cmd_showport = {
.f = cmd_showport_parsed,
.data = NULL,
-   .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap X (X = 
port number)",
+   .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc X 
(X = port number)",
.tokens = {
(void *)&cmd_showport_show,
(void *)&cmd_showport_port,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index ef87581..1b0d5d5 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2285,3 +2285,46 @@ mcast_addr_remove(uint8_t port_id, struct ether_addr 
*mc_addr)
mcast_addr_pool_remove(port, i);
eth_port_multicast_addr_list_set(port_id);
 }
+
+void
+port_dcb_info_display(uint8_t port_id)
+{
+   struct rte_eth_dcb_info dcb_info;
+   uint16_t i;
+   int ret;
+   static const char *border = "";
+
+   if (port_id_is_invalid(port_id, ENABLED_WARN))
+   return;
+
+   ret = rte_eth_dev_get_dcb_info(port_id, &dcb_info);
+   if (ret) {
+   printf("\n Failed to get dcb infos on port %-2d\n",
+   port_id);
+   return;
+   }
+   printf("\n  %s DCB infos for port %-2d  %s\n", border, port_id, border);
+   printf("  TC NUMBER: %d\n", dcb_info.nb_tcs);
+   printf("\n  TC :");
+   for (i = 0; i < dcb_info.nb_tcs; i++)
+   printf("\t%4d", i);
+   printf("\n  Priority :  ");
+   for (i = 0; i < dcb_info.nb_tcs; i++)
+   printf("\t%4d", dcb_info.prio_tc[i]);
+   printf("\n  BW percent :");
+   for (i = 0; i < dcb_info.nb_tcs; i++)
+   printf("\t%4d

[dpdk-dev] [PATCH] enic: fix vlan filtering

2015-10-31 Thread Sujith Sankar (ssujith)

On 30/10/15 9:43 pm, "David Marchand"  wrote:

>From: Julien Meunier 
>
>Report an error when something went wrong.
>
>Signed-off-by: Julien Meunier 
>Signed-off-by: David Marchand 
>---
> drivers/net/enic/enic_ethdev.c | 7 ---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/net/enic/enic_ethdev.c
>b/drivers/net/enic/enic_ethdev.c
>index e385560..5df9a6c 100644
>--- a/drivers/net/enic/enic_ethdev.c
>+++ b/drivers/net/enic/enic_ethdev.c
>@@ -271,13 +271,14 @@ static int enicpmd_vlan_filter_set(struct
>rte_eth_dev *eth_dev,
>   uint16_t vlan_id, int on)
> {
>   struct enic *enic = pmd_priv(eth_dev);
>+  int err;
> 
>   ENICPMD_FUNC_TRACE();
>   if (on)
>-  enic_add_vlan(enic, vlan_id);
>+  err = enic_add_vlan(enic, vlan_id);
>   else
>-  enic_del_vlan(enic, vlan_id);
>-  return 0;
>+  err = enic_del_vlan(enic, vlan_id);
>+  return err;

Acked.

Thanks,
-Sujith

> }
> 
> static void enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int
>mask)
>-- 
>1.9.1
>