[dpdk-dev] [PATCH] net/szedata2: fix incorrect device memory access

2017-01-24 Thread Matej Vido
Fixes: 8acba705b119 ("net/szedata2: localize handling of PCI resources")

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.h 
b/drivers/net/szedata2/rte_eth_szedata2.h
index b58adb6..afe8a38 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.h
+++ b/drivers/net/szedata2/rte_eth_szedata2.h
@@ -192,7 +192,7 @@ struct szedata {
 }
 
 #define SZEDATA2_PCI_RESOURCE_PTR(rsc, offset, type) \
-   ((type)((uint8_t *)(rsc)->addr) + (offset))
+   ((type)(((uint8_t *)(rsc)->addr) + (offset)))
 
 enum szedata2_link_speed {
SZEDATA2_LINK_SPEED_DEFAULT = 0,
-- 
1.8.4



Re: [dpdk-dev] [PATCH] net/szedata2: fix incorrect device memory access

2017-01-24 Thread Matej Vido

On 24.01.2017 12:58, Ferruh Yigit wrote:

On 1/24/2017 10:49 AM, Matej Vido wrote:

Fixes: 8acba705b119 ("net/szedata2: localize handling of PCI resources")

Signed-off-by: Matej Vido 

Unrelated from this patch, in maintainers file, you have your other mail
address: "Matej Vido ", do you want to update it?

Hi Ferruh,

yes, I will send the patch.



---
  drivers/net/szedata2/rte_eth_szedata2.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.h 
b/drivers/net/szedata2/rte_eth_szedata2.h
index b58adb6..afe8a38 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.h
+++ b/drivers/net/szedata2/rte_eth_szedata2.h
@@ -192,7 +192,7 @@ struct szedata {
  }
  
  #define SZEDATA2_PCI_RESOURCE_PTR(rsc, offset, type) \

-   ((type)((uint8_t *)(rsc)->addr) + (offset))
+   ((type)(((uint8_t *)(rsc)->addr) + (offset)))

Although output will be same, (in all uses, type is a pointer), this
seems the intention, so:

Reviewed-by: Ferruh Yigit 

btw, following will do same, right, not sure if it is better:
((type)(rsc)->addr + (offset))
This is also wrong. The intention of the macro is to add an offset to 
the base address and typecast the result.


Regards,
Matej


  
  enum szedata2_link_speed {

SZEDATA2_LINK_SPEED_DEFAULT = 0,





[dpdk-dev] [PATCH] maintainers: update email address

2017-01-24 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index f071138..21d0ef9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -311,7 +311,7 @@ F: drivers/net/enic/
 F: doc/guides/nics/enic.rst
 
 Combo szedata2
-M: Matej Vido 
+M: Matej Vido 
 F: drivers/net/szedata2/
 F: doc/guides/nics/szedata2.rst
 
-- 
2.7.4



Re: [dpdk-dev] [PATCH] net/szedata2: fix incorrect device memory access

2017-01-24 Thread Matej Vido

On 24.01.2017 16:11, Ferruh Yigit wrote:

On 1/24/2017 2:02 PM, Matej Vido wrote:

On 24.01.2017 12:58, Ferruh Yigit wrote:

On 1/24/2017 10:49 AM, Matej Vido wrote:

Fixes: 8acba705b119 ("net/szedata2: localize handling of PCI resources")

Signed-off-by: Matej Vido 

Unrelated from this patch, in maintainers file, you have your other mail
address: "Matej Vido ", do you want to update it?

Hi Ferruh,

yes, I will send the patch.

---
   drivers/net/szedata2/rte_eth_szedata2.h | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.h 
b/drivers/net/szedata2/rte_eth_szedata2.h
index b58adb6..afe8a38 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.h
+++ b/drivers/net/szedata2/rte_eth_szedata2.h
@@ -192,7 +192,7 @@ struct szedata {
   }
   
   #define SZEDATA2_PCI_RESOURCE_PTR(rsc, offset, type) \

-   ((type)((uint8_t *)(rsc)->addr) + (offset))
+   ((type)(((uint8_t *)(rsc)->addr) + (offset)))

Although output will be same, (in all uses, type is a pointer),

Of course won't be same, please forget about it J, I am confused.

So these two differs a lot, taking into account that offset numbers used
are big numbers (0x8000..), it should be accessing very unrelated addresses.

So how this was working before?


The macro was fine before the patch [1]. It hasn't been working since 
the acceptance of that patch, but I didn't manage to test the 
functionality until now.


[1] http://dpdk.org/ml/archives/dev/2016-December/053241.html

Regards,
Matej




this

seems the intention, so:

Reviewed-by: Ferruh Yigit 

btw, following will do same, right, not sure if it is better:
((type)(rsc)->addr + (offset))

This is also wrong. The intention of the macro is to add an offset to
the base address and typecast the result.

Regards,
Matej
   
   enum szedata2_link_speed {

SZEDATA2_LINK_SPEED_DEFAULT = 0,





Re: [dpdk-dev] [PATCH] net/szedata2: fix incorrect device memory access

2017-01-24 Thread Matej Vido

On 24.01.2017 16:24, Ferruh Yigit wrote:

On 1/24/2017 10:49 AM, Matej Vido wrote:

Fixes: 8acba705b119 ("net/szedata2: localize handling of PCI resources")

Signed-off-by: Matej Vido 

Reviewed-by: Ferruh Yigit 

Cc: sta...@dpdk.org

Applied to dpdk-next-net/master, thanks.
I'm not sure about the policy regarding the stable releases, but I think 
that this patch doesn't belong to stable as the bug was introduced and 
also fixed during the current 17.02 window. Or am I wrong?


Thanks,
Matej


[dpdk-dev] [PATCH v11 00/24] Introducing rte_driver/rte_device generalization

2016-09-21 Thread Matej Vido
Hi Shreyansh,

I have tested this patch-set with szedata2 driver and it works fine.

Regards,

Matej

On 20.09.2016 14:41, Shreyansh Jain wrote:
> Based on master (e15922d75)
>
> Background:
> ===
>
> It includes two different patch-sets floated on ML earlier:
>   * Original patch series is from David Marchand [1], [2].
>`- This focused mainly on PCI (PDEV) part
>`- v7 of this was posted by me [8] in August/2016
>   * Patch series [4] from Jan Viktorin
>`- This focused on VDEV and rte_device integration
>
> Introduction:
> =
>
> This patch series introduces a generic device model, moving away from PCI
> centric code layout. Key change is to introduce rte_driver/rte_device
> structures at the top level which are inherited by
> rte_XXX_driver/rte_XXX_device - where XXX belongs to {pci, vdev, soc (in
> future),...}.
>
> Key motivation for this series is to move away from PCI centric design of
> EAL to a more hierarchical device model - pivoted around a generic driver
> and device. Each specific driver and device can inherit the common
> properties of the generic set and build upon it through driver/device
> specific functions.
>
> Earlier, the EAL device initialization model was:
> (Refer: [3])
>
> --
>   Constructor:
>|- PMD_DRIVER_REGISTER(rte_driver)
>   `-  insert into dev_driver_list, rte_driver object
>
>   rte_eal_init():
>|- rte_eal_pci_init()
>|  `- scan and fill pci_device_list from sysfs
>|
>|- rte_eal_dev_init()
>|  `- For each rte_driver in dev_driver_list
>| `- call the rte_driver->init() function
>||- PMDs designed to call rte_eth_driver_register(eth_driver)
>||- eth_driver have rte_pci_driver embedded in them
>|`- rte_eth_driver_register installs the
>|   rte_pci_driver->devinit/devuninit callbacks.
>|
>|- rte_eal_pci_probe()
>|  |- For each device detected, dev_driver_list is parsed and matching is
>|  |  done.
>|  |- For each matching device, the rte_pci_driver->devinit() is called.
>|  |- Default map is to rte_eth_dev_init() which in turn creates a
>|  |  new ethernet device (eth_dev)
>|  |  `- eth_drv->eth_dev_init() is called which is implemented by
>`--|individual PMD drivers.
>
> --
>
> The structure of driver looks something like:
>
>   ++ ._.
>   | rte_driver <-| PMD |___
>   |  .init | `-`   \
>   +.---+  | \
>`-.| What PMD actually is
>   \   |  |
>+--v+ |
>| eth_driver| |
>| .eth_dev_init | |
>+.--+ |
> `-.  |
>\ |
> +v---+
> | rte_pci_driver |
> | .pci_devinit   |
> ++
>
>and all devices are part of a following linked lists:
>  - dev_driver_list for all rte_drivers
>  - pci_device_list for all devices, whether PCI or VDEV
>
>
> >From the above:
>   * a PMD initializes a rte_driver, eth_driver even though actually it is a
> pci_driver
>   * initialization routines are passed from rte_driver->pci_driver->eth_driver
> even though they should ideally be rte_eal_init()->rte_pci_driver()
>   * For a single driver/device type model, this is not necessarily a
> functional issue - but more of a design language.
>   * But, when number of driver/device type increase, this would create
> problem in how driver<=>device links are represented.
>
> Proposed Architecture:
> ==
>
> A nice representation has already been created by David in [3]. Copying that
> here:
>
>  +--+ +---+
>  |  | |   |
>  | rte_pci_device   | | rte_pci_driver|
>  |  | |   |
> +-+ | +--+ | | +---+ |
> | | | |  | | | |   | |
> | rte_eth_dev +---> rte_device   +-> rte_driver| |
> | | | |  char name[] | | | |  char name[]  | |
> +-+ | |  | | | |  int init(rte_device *)   | |
>  | +--+ | | |  int uninit(rte_device *) | |
>  |  | | |   | |
>  +--+ | +---+ |
>   |   |
>   +---+
>
> - for ethdev on top of vdev devices
>
>  +--+ +---+
>  |  | | 

Re: [dpdk-dev] [PATCH 1/5] net/szedata2: refactor ibuf and obuf names

2017-05-31 Thread Matej Vido

On 29.05.2017 14:40, Ferruh Yigit wrote:

On 5/26/2017 7:05 PM, Matej Vido wrote:

Signed-off-by: Matej Vido 

Hi Matej,

Overall patchset looks good to me, but can you please provide a little
more information in commit logs, please check comments on patches.

For this patch, it seems refactor naming is removing "cgmii", what is
the reason of this, is cgmii no more true or adding different interface?

Thanks,
ferruh

Hi Ferruh,

ok, I will address the comments in v2.

"cgmii" was too specific. There can be different ibuf/obuf modules in 
different firmwares. But the address space definition is the same for 
all ibuf/obuf modules in all firmwares so this patch makes the name 
general (and also shorter).


Regards,
Matej



---
  drivers/net/szedata2/rte_eth_szedata2.c |   80 +++---
  drivers/net/szedata2/rte_eth_szedata2.h |   48 +-
  2 files changed, 64 insertions(+), 64 deletions(-)

<...>




Re: [dpdk-dev] [PATCH 3/5] net/szedata2: refactor ibuf and obuf address definition

2017-05-31 Thread Matej Vido

On 29.05.2017 14:41, Ferruh Yigit wrote:

On 5/26/2017 7:05 PM, Matej Vido wrote:

This is to prepare for firmwares with multiple ibufs and obufs.
Offsets of ibufs and obufs are defined in array.

I was thinking ibufs and obufs as queues, but since link functions
updated per ibufs it looks like ports, can you please provide some
information what is ibufs and obufs?

What is the benefit of having multiple ibufs and obufs?

Hi Ferruh,

ibufs and obufs are the modules in FPGA firmware implementing the 
Ethernet port (MAC layer, to be exact). There is one ibuf+obuf per 
Ethernet port. Our cards and firmwares allow one 100GE physical port to 
be one Ethernet port, or split into 10 ports of 10GE. However, all DMA 
queues in the device are shared between all Ethernet ports. Packet from 
any port can be passed by crossbar logic to any DMA queue (and from any 
DMA queue to any port).


Regards,
Matej



Functions which operate on ibufs and obufs iterate over this array.

Signed-off-by: Matej Vido 

<...>




Re: [dpdk-dev] [PATCH 5/5] net/szedata2: add more supported firmwares

2017-05-31 Thread Matej Vido

On 29.05.2017 14:42, Ferruh Yigit wrote:

On 5/26/2017 7:05 PM, Matej Vido wrote:

Add IBUF and OBUF offsets definitions for new firmwares.

just to double check, is it required to add new pci device ids to
support these new cards?

Is dpdk supported nics (http://dpdk.org/doc/nics) needs to be updated?

Can you please update release notes to announce new cards support?

Hi Ferruh,

This patch set adds mainly the support of new firmwares for the cards 
that are already supported.
But you are right, there is also one new card which would need to add 
new pci device id. We have to check if we want to add the card in this 
patch set and I will update v2 accordingly.





Signed-off-by: Matej Vido 

<...>


+#elif RTE_LIBRTE_PMD_SZEDATA2_AS == 5
+
+const uint32_t szedata2_ibuf_base_table[] = {
+   0x8000,
+   0x8200,
+   0x8400,
+   0x8600,
+   0x8800
+};
+const uint32_t szedata2_obuf_base_table[] = {
+   0x9000,
+   0x9200,
+   0x9400,
+   0x9600,
+   0x9800
+};

AS = 5 is not documented in both documentation and source code comment,
can you please add this one too?
5 is for future use and experimental firmwares. Would it make sense to 
write this note in the comments but not in the documentation to avoid 
confusion or should it be mentioned in the documentation too?


Thanks,
Matej

+
  #else
  #error "RTE_LIBRTE_PMD_SZEDATA2_AS has wrong value, see comments in config 
file"
  #endif





[dpdk-dev] [PATCH v2 1/5] net/szedata2: refactor ibuf and obuf names

2017-06-12 Thread Matej Vido
Prefix "cgmii" is removed because it is too specific.
There are different ibuf/obuf modules in different firmwares
but the address space definition is the same.
This patch makes the name general.

Signed-off-by: Matej Vido 
---
v2:
  Added more detailed commit message.

 drivers/net/szedata2/rte_eth_szedata2.c | 80 -
 drivers/net/szedata2/rte_eth_szedata2.h | 48 ++--
 2 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index c70e9f3..5be08da 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1149,11 +1149,11 @@ struct pmd_internals {
struct rte_eth_link *dev_link = &dev->data->dev_link;
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_ibuf *);
+   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+   volatile struct szedata2_ibuf *);
 
-   switch (cgmii_link_speed(ibuf)) {
+   switch (get_link_speed(ibuf)) {
case SZEDATA2_LINK_SPEED_10G:
link.link_speed = ETH_SPEED_NUM_10G;
break;
@@ -1171,8 +1171,8 @@ struct pmd_internals {
/* szedata2 uses only full duplex */
link.link_duplex = ETH_LINK_FULL_DUPLEX;
 
-   link.link_status = (cgmii_ibuf_is_enabled(ibuf) &&
-   cgmii_ibuf_is_link_up(ibuf)) ? ETH_LINK_UP : 
ETH_LINK_DOWN;
+   link.link_status = (ibuf_is_enabled(ibuf) &&
+   ibuf_is_link_up(ibuf)) ? ETH_LINK_UP : ETH_LINK_DOWN;
 
link.link_autoneg = ETH_LINK_SPEED_FIXED;
 
@@ -1187,15 +1187,15 @@ struct pmd_internals {
 {
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_ibuf *);
-   volatile struct szedata2_cgmii_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_OBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_obuf *);
-
-   cgmii_ibuf_enable(ibuf);
-   cgmii_obuf_enable(obuf);
+   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+   volatile struct szedata2_ibuf *);
+   volatile struct szedata2_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_OBUF_BASE_OFF,
+   volatile struct szedata2_obuf *);
+
+   ibuf_enable(ibuf);
+   obuf_enable(obuf);
return 0;
 }
 
@@ -1204,15 +1204,15 @@ struct pmd_internals {
 {
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_ibuf *);
-   volatile struct szedata2_cgmii_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_OBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_obuf *);
-
-   cgmii_ibuf_disable(ibuf);
-   cgmii_obuf_disable(obuf);
+   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+   volatile struct szedata2_ibuf *);
+   volatile struct szedata2_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_OBUF_BASE_OFF,
+   volatile struct szedata2_obuf *);
+
+   ibuf_disable(ibuf);
+   obuf_disable(obuf);
return 0;
 }
 
@@ -1292,10 +1292,10 @@ struct pmd_internals {
 {
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_ibuf *);
-   cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_PROMISC);
+   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+   volatile struct sze

[dpdk-dev] [PATCH v2 5/5] net/szedata2: add more supported firmwares

2017-06-12 Thread Matej Vido
Add IBUF and OBUF offsets definitions for new firmwares.

Signed-off-by: Matej Vido 
---
v2:
  Added release note.
  Added description of AS = 5 in comment and in documentation.

 config/common_base |   8 +-
 doc/guides/nics/szedata2.rst   |  32 +--
 doc/guides/rel_notes/release_17_08.rst |   4 +
 drivers/net/szedata2/szedata2_iobuf.c  | 150 +++--
 4 files changed, 174 insertions(+), 20 deletions(-)

diff --git a/config/common_base b/config/common_base
index 0e0b732..f6aafd1 100644
--- a/config/common_base
+++ b/config/common_base
@@ -276,12 +276,8 @@ CONFIG_RTE_LIBRTE_SFC_EFX_DEBUG=n
 CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
 #
 # Defines firmware type address space.
-# RTE_LIBRTE_PMD_SZEDATA2_AS can be:
-# 0 - for firmwares:
-# NIC_100G1_LR4
-# HANIC_100G1_LR4
-# HANIC_100G1_SR10
-# Other values raise compile time error
+# See documentation for supported values.
+# Other values raise compile time error.
 CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS=0
 
 #
diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
index 60080a9..1a5d413 100644
--- a/doc/guides/nics/szedata2.rst
+++ b/doc/guides/nics/szedata2.rst
@@ -91,14 +91,34 @@ These configuration options can be modified before 
compilation in the
 
 *  ``CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS`` default value: **0**
 
-   This option defines type of firmware address space.
-   Currently supported value is:
+   This option defines type of firmware address space and must be set
+   according to the used card and mode.
+   Currently supported values are:
 
-   * **0** for firmwares:
+   * **0** - for cards (modes):
 
-  * NIC_100G1_LR4
-  * HANIC_100G1_LR4
-  * HANIC_100G1_SR10
+  * NFB-100G1 (100G1)
+
+   * **1** - for cards (modes):
+
+  * NFB-100G2Q (100G1)
+
+   * **2** - for cards (modes):
+
+  * NFB-40G2 (40G2)
+  * NFB-100G2C (100G2)
+  * NFB-100G2Q (40G2)
+
+   * **3** - for cards (modes):
+
+  * NFB-40G2 (10G8)
+  * NFB-100G2Q (10G8)
+
+   * **4** - for cards (modes):
+
+  * NFB-100G1 (10G10)
+
+   * **5** - for experimental firmwares and future use
 
 Using the SZEDATA2 PMD
 --
diff --git a/doc/guides/rel_notes/release_17_08.rst 
b/doc/guides/rel_notes/release_17_08.rst
index eb31da2..842f46f 100644
--- a/doc/guides/rel_notes/release_17_08.rst
+++ b/doc/guides/rel_notes/release_17_08.rst
@@ -71,6 +71,10 @@ New Features
   Rx queues can be armed with an interrupt which will trigger on the
   next packet arrival.
 
+* **Updated szedata2 PMD.**
+
+  Added support for firmwares with multiple Ethernet ports per physical port.
+
 
 Resolved Issues
 ---
diff --git a/drivers/net/szedata2/szedata2_iobuf.c 
b/drivers/net/szedata2/szedata2_iobuf.c
index 2d25e65..3b9a71f 100644
--- a/drivers/net/szedata2/szedata2_iobuf.c
+++ b/drivers/net/szedata2/szedata2_iobuf.c
@@ -39,21 +39,41 @@
 
 /*
  * IBUFs and OBUFs can generally be located at different offsets in different
- * firmwares.
- * This part defines base offsets of IBUFs and OBUFs through various firmwares.
- * Currently one firmware type is supported.
- * Type of firmware is set through configuration option
+ * firmwares (modes).
+ * This part defines base offsets of IBUFs and OBUFs for various cards
+ * and firmwares (modes).
+ * Type of firmware (mode) is set through configuration option
  * CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS.
  * Possible values are:
- * 0 - for firmwares:
- * NIC_100G1_LR4
- * HANIC_100G1_LR4
- * HANIC_100G1_SR10
+ * 0 - for cards (modes):
+ * NFB-100G1 (100G1)
+ *
+ * 1 - for cards (modes):
+ * NFB-100G2Q (100G1)
+ *
+ * 2 - for cards (modes):
+ * NFB-40G2 (40G2)
+ * NFB-100G2C (100G2)
+ * NFB-100G2Q (40G2)
+ *
+ * 3 - for cards (modes):
+ * NFB-40G2 (10G8)
+ * NFB-100G2Q (10G8)
+ *
+ * 4 - for cards (modes):
+ * NFB-100G1 (10G10)
+ *
+ * 5 - for experimental firmwares and future use
  */
 #if !defined(RTE_LIBRTE_PMD_SZEDATA2_AS)
 #error "RTE_LIBRTE_PMD_SZEDATA2_AS has to be defined"
 #elif RTE_LIBRTE_PMD_SZEDATA2_AS == 0
 
+/*
+ * Cards (modes):
+ * NFB-100G1 (100G1)
+ */
+
 const uint32_t szedata2_ibuf_base_table[] = {
0x8000
 };
@@ -61,6 +81,120 @@
0x9000
 };
 
+#elif RTE_LIBRTE_PMD_SZEDATA2_AS == 1
+
+/*
+ * Cards (modes):
+ * NFB-100G2Q (100G1)
+ */
+
+const uint32_t szedata2_ibuf_base_table[] = {
+   0x8800
+};
+const uint32_t szedata2_obuf_base_table[] = {
+   0x9800
+};
+
+#elif RTE_LIBRTE_PMD_SZEDATA2_AS == 2
+
+/*
+ * Cards (modes):
+ * NFB-40G2 (40G2)
+ * NFB-100G2C (100G2)
+ * NFB-100G2Q (40G2)
+ */
+
+const uint32_t szedata2_ibuf_base_table[] = {
+   0x8000,
+   0x8800
+};
+const uint32_t szedata2_obuf_base_table[] = {
+   0x9000,
+   0x9800
+};
+
+#elif RTE_LIBRTE_PMD_SZEDATA2_AS == 3
+
+/*
+ * Cards (modes):
+ * NFB-40G2 (10G8)
+ * NFB-100G2Q (10G8)
+ */
+
+const uint32_t szedata2_ibuf_

[dpdk-dev] [PATCH v2 4/5] net/szedata2: move ibuf and obuf to specific header

2017-06-12 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.h | 216 +-
 drivers/net/szedata2/szedata2_iobuf.h   | 261 
 2 files changed, 264 insertions(+), 213 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.h 
b/drivers/net/szedata2/rte_eth_szedata2.h
index 6b31a77..2571d54 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.h
+++ b/drivers/net/szedata2/rte_eth_szedata2.h
@@ -34,10 +34,9 @@
 #ifndef RTE_PMD_SZEDATA2_H_
 #define RTE_PMD_SZEDATA2_H_
 
-#include 
+#include 
 
-#include 
-#include 
+#include 
 
 /* PCI Vendor ID */
 #define PCI_VENDOR_ID_NETCOPE 0x1b26
@@ -114,213 +113,4 @@ struct szedata {
int numa_node;
 };
 
-static inline uint32_t
-szedata2_read32(const volatile void *addr)
-{
-   return rte_le_to_cpu_32(rte_read32(addr));
-}
-
-static inline void
-szedata2_write32(uint32_t value, volatile void *addr)
-{
-   rte_write32(rte_cpu_to_le_32(value), addr);
-}
-
-enum szedata2_link_speed {
-   SZEDATA2_LINK_SPEED_DEFAULT = 0,
-   SZEDATA2_LINK_SPEED_10G,
-   SZEDATA2_LINK_SPEED_40G,
-   SZEDATA2_LINK_SPEED_100G,
-};
-
-enum szedata2_mac_check_mode {
-   SZEDATA2_MAC_CHMODE_PROMISC   = 0x0,
-   SZEDATA2_MAC_CHMODE_ONLY_VALID= 0x1,
-   SZEDATA2_MAC_CHMODE_ALL_BROADCAST = 0x2,
-   SZEDATA2_MAC_CHMODE_ALL_MULTICAST = 0x3,
-};
-
-/*
- * Maximum possible number of MAC addresses (limited by IBUF status
- * register value MAC_COUNT which has 5 bits).
- */
-#define SZEDATA2_IBUF_MAX_MAC_COUNT 32
-
-/*
- * Structure describes IBUF address space
- */
-struct szedata2_ibuf {
-   /** Total Received Frames Counter low part */
-   uint32_t trfcl; /**< 0x00 */
-   /** Correct Frames Counter low part */
-   uint32_t cfcl; /**< 0x04 */
-   /** Discarded Frames Counter low part */
-   uint32_t dfcl; /**< 0x08 */
-   /** Counter of frames discarded due to buffer overflow low part */
-   uint32_t bodfcl; /**< 0x0C */
-   /** Total Received Frames Counter high part */
-   uint32_t trfch; /**< 0x10 */
-   /** Correct Frames Counter high part */
-   uint32_t cfch; /**< 0x14 */
-   /** Discarded Frames Counter high part */
-   uint32_t dfch; /**< 0x18 */
-   /** Counter of frames discarded due to buffer overflow high part */
-   uint32_t bodfch; /**< 0x1C */
-   /** IBUF enable register */
-   uint32_t ibuf_en; /**< 0x20 */
-   /** Error mask register */
-   uint32_t err_mask; /**< 0x24 */
-   /** IBUF status register */
-   uint32_t ibuf_st; /**< 0x28 */
-   /** IBUF command register */
-   uint32_t ibuf_cmd; /**< 0x2C */
-   /** Minimum frame length allowed */
-   uint32_t mfla; /**< 0x30 */
-   /** Frame MTU */
-   uint32_t mtu; /**< 0x34 */
-   /** MAC address check mode */
-   uint32_t mac_chmode; /**< 0x38 */
-   /** Octets Received OK Counter low part */
-   uint32_t orocl; /**< 0x3C */
-   /** Octets Received OK Counter high part */
-   uint32_t oroch; /**< 0x40 */
-   /** reserved */
-   uint8_t reserved[60]; /**< 0x4C */
-   /** IBUF memory for MAC addresses */
-   uint32_t mac_mem[2 * SZEDATA2_IBUF_MAX_MAC_COUNT]; /**< 0x80 */
-} __rte_packed;
-
-/*
- * @return
- * true if IBUF is enabled
- * false if IBUF is disabled
- */
-static inline bool
-ibuf_is_enabled(const volatile struct szedata2_ibuf *ibuf)
-{
-   return ((szedata2_read32(&ibuf->ibuf_en) & 0x1) != 0) ? true : false;
-}
-
-/*
- * Enables IBUF.
- */
-static inline void
-ibuf_enable(volatile struct szedata2_ibuf *ibuf)
-{
-   szedata2_write32(szedata2_read32(&ibuf->ibuf_en) | 0x1, &ibuf->ibuf_en);
-}
-
-/*
- * Disables IBUF.
- */
-static inline void
-ibuf_disable(volatile struct szedata2_ibuf *ibuf)
-{
-   szedata2_write32(szedata2_read32(&ibuf->ibuf_en) & ~0x1,
-   &ibuf->ibuf_en);
-}
-
-/*
- * @return
- * true if ibuf link is up
- * false if ibuf link is down
- */
-static inline bool
-ibuf_is_link_up(const volatile struct szedata2_ibuf *ibuf)
-{
-   return ((szedata2_read32(&ibuf->ibuf_st) & 0x80) != 0) ? true : false;
-}
-
-/*
- * @return
- * MAC address check mode
- */
-static inline enum szedata2_mac_check_mode
-ibuf_mac_mode_read(const volatile struct szedata2_ibuf *ibuf)
-{
-   switch (szedata2_read32(&ibuf->mac_chmode) & 0x3) {
-   case 0x0:
-   return SZEDATA2_MAC_CHMODE_PROMISC;
-   case 0x1:
-   return SZEDATA2_MAC_CHMODE_ONLY_VALID;
-   case 0x2:
-   return SZEDATA2_MAC_CHMODE_ALL_BROADCAST;
-   case 0x3:
-   return SZEDATA2_MAC_CHMODE_ALL_MULTICAST;
-   default:
-   return SZEDATA2_MAC_CHMODE_PROMISC;
-   }
-}
-
-/*
- * Writes "mode" in MAC 

[dpdk-dev] [PATCH v2 3/5] net/szedata2: refactor ibuf and obuf address definition

2017-06-12 Thread Matej Vido
This is to prepare for firmwares with multiple ibufs and obufs.
Ibufs and obufs are the modules in FPGA firmware implementing
the Ethernet port.
There is one ibuf+obuf per Ethernet port.
The cards and firmwares allow one physical port to be one Ethernet
port or split into more Ethernet ports, e.g. one 100GE physical
port can be one Ethernet port of 100GE or split into ten Ethernet
ports of 10GE.
All DMA queues in the device are shared between all Ethernet ports.
Offsets of ibufs and obufs are defined in array.
Functions which operate on ibufs and obufs iterate over this array.

Signed-off-by: Matej Vido 
---
v2:
  Added more detailed commit message.

 drivers/net/szedata2/Makefile   |   1 +
 drivers/net/szedata2/rte_eth_szedata2.c | 121 +---
 drivers/net/szedata2/rte_eth_szedata2.h |  64 -
 drivers/net/szedata2/szedata2_iobuf.c   |  69 ++
 drivers/net/szedata2/szedata2_iobuf.h   |  95 +
 5 files changed, 246 insertions(+), 104 deletions(-)
 create mode 100644 drivers/net/szedata2/szedata2_iobuf.c
 create mode 100644 drivers/net/szedata2/szedata2_iobuf.h

diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
index 836c3b2..0e96b92 100644
--- a/drivers/net/szedata2/Makefile
+++ b/drivers/net/szedata2/Makefile
@@ -48,6 +48,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += rte_eth_szedata2.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += szedata2_iobuf.c
 
 #
 # Export include files
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index f8ec331..49495fd 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -53,6 +53,7 @@
 #include 
 
 #include "rte_eth_szedata2.h"
+#include "szedata2_iobuf.h"
 
 #define RTE_ETH_SZEDATA2_MAX_RX_QUEUES 32
 #define RTE_ETH_SZEDATA2_MAX_TX_QUEUES 32
@@ -1140,6 +1141,33 @@ struct pmd_internals {
dev->data->nb_tx_queues = 0;
 }
 
+/**
+ * Function takes value from first IBUF status register.
+ * Values in IBUF and OBUF should be same.
+ *
+ * @param internals
+ * Pointer to device private structure.
+ * @return
+ * Link speed constant.
+ */
+static inline enum szedata2_link_speed
+get_link_speed(const struct pmd_internals *internals)
+{
+   const volatile struct szedata2_ibuf *ibuf =
+   ibuf_ptr_by_index(internals->pci_rsc, 0);
+   uint32_t speed = (szedata2_read32(&ibuf->ibuf_st) & 0x70) >> 4;
+   switch (speed) {
+   case 0x03:
+   return SZEDATA2_LINK_SPEED_10G;
+   case 0x04:
+   return SZEDATA2_LINK_SPEED_40G;
+   case 0x05:
+   return SZEDATA2_LINK_SPEED_100G;
+   default:
+   return SZEDATA2_LINK_SPEED_DEFAULT;
+   }
+}
+
 static int
 eth_link_update(struct rte_eth_dev *dev,
int wait_to_complete __rte_unused)
@@ -1149,11 +1177,11 @@ struct pmd_internals {
struct rte_eth_link *dev_link = &dev->data->dev_link;
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   const volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
-   const volatile struct szedata2_ibuf *);
+   const volatile struct szedata2_ibuf *ibuf;
+   uint32_t i;
+   bool link_is_up = false;
 
-   switch (get_link_speed(ibuf)) {
+   switch (get_link_speed(internals)) {
case SZEDATA2_LINK_SPEED_10G:
link.link_speed = ETH_SPEED_NUM_10G;
break;
@@ -1171,8 +1199,19 @@ struct pmd_internals {
/* szedata2 uses only full duplex */
link.link_duplex = ETH_LINK_FULL_DUPLEX;
 
-   link.link_status = (ibuf_is_enabled(ibuf) &&
-   ibuf_is_link_up(ibuf)) ? ETH_LINK_UP : ETH_LINK_DOWN;
+   for (i = 0; i < szedata2_ibuf_count; i++) {
+   ibuf = ibuf_ptr_by_index(internals->pci_rsc, i);
+   /*
+* Link is considered up if at least one ibuf is enabled
+* and up.
+*/
+   if (ibuf_is_enabled(ibuf) && ibuf_is_link_up(ibuf)) {
+   link_is_up = true;
+   break;
+   }
+   }
+
+   link.link_status = (link_is_up) ? ETH_LINK_UP : ETH_LINK_DOWN;
 
link.link_autoneg = ETH_LINK_SPEED_FIXED;
 
@@ -1187,15 +1226,12 @@ struct pmd_internals {
 {
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
-   volatile struct szedata2_ibuf *);
-   volatile st

[dpdk-dev] [PATCH v2 2/5] net/szedata2: refactor ibuf and obuf read and write

2017-06-12 Thread Matej Vido
Remove unused read and write functions.
Use rte_read*, rte_write* functions to access ibuf and obuf
address space.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c |   4 +-
 drivers/net/szedata2/rte_eth_szedata2.h | 184 +++-
 2 files changed, 64 insertions(+), 124 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 5be08da..f8ec331 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1149,9 +1149,9 @@ struct pmd_internals {
struct rte_eth_link *dev_link = &dev->data->dev_link;
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   const volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
-   volatile struct szedata2_ibuf *);
+   const volatile struct szedata2_ibuf *);
 
switch (get_link_speed(ibuf)) {
case SZEDATA2_LINK_SPEED_10G:
diff --git a/drivers/net/szedata2/rte_eth_szedata2.h 
b/drivers/net/szedata2/rte_eth_szedata2.h
index 4f56fcf..0b635d0 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.h
+++ b/drivers/net/szedata2/rte_eth_szedata2.h
@@ -37,6 +37,7 @@
 #include 
 
 #include 
+#include 
 
 /* PCI Vendor ID */
 #define PCI_VENDOR_ID_NETCOPE 0x1b26
@@ -113,82 +114,16 @@ struct szedata {
int numa_node;
 };
 
-/*
- * @return Byte from PCI resource at offset "offset".
- */
-static inline uint8_t
-pci_resource_read8(struct rte_mem_resource *rsc, uint32_t offset)
-{
-   return *((uint8_t *)((uint8_t *)rsc->addr + offset));
-}
-
-/*
- * @return Two bytes from PCI resource starting at offset "offset".
- */
-static inline uint16_t
-pci_resource_read16(struct rte_mem_resource *rsc, uint32_t offset)
-{
-   return rte_le_to_cpu_16(*((uint16_t *)((uint8_t *)rsc->addr +
-  offset)));
-}
-
-/*
- * @return Four bytes from PCI resource starting at offset "offset".
- */
 static inline uint32_t
-pci_resource_read32(struct rte_mem_resource *rsc, uint32_t offset)
-{
-   return rte_le_to_cpu_32(*((uint32_t *)((uint8_t *)rsc->addr +
-  offset)));
-}
-
-/*
- * @return Eight bytes from PCI resource starting at offset "offset".
- */
-static inline uint64_t
-pci_resource_read64(struct rte_mem_resource *rsc, uint32_t offset)
-{
-   return rte_le_to_cpu_64(*((uint64_t *)((uint8_t *)rsc->addr +
-  offset)));
-}
-
-/*
- * Write one byte to PCI resource address space at offset "offset".
- */
-static inline void
-pci_resource_write8(struct rte_mem_resource *rsc, uint32_t offset, uint8_t val)
+szedata2_read32(const volatile void *addr)
 {
-   *((uint8_t *)((uint8_t *)rsc->addr + offset)) = val;
+   return rte_le_to_cpu_32(rte_read32(addr));
 }
 
-/*
- * Write two bytes to PCI resource address space at offset "offset".
- */
 static inline void
-pci_resource_write16(struct rte_mem_resource *rsc, uint32_t offset,
-uint16_t val)
+szedata2_write32(uint32_t value, volatile void *addr)
 {
-   *((uint16_t *)((uint8_t *)rsc->addr + offset)) = rte_cpu_to_le_16(val);
-}
-
-/*
- * Write four bytes to PCI resource address space at offset "offset".
- */
-static inline void
-pci_resource_write32(struct rte_mem_resource *rsc, uint32_t offset,
-uint32_t val)
-{
-   *((uint32_t *)((uint8_t *)rsc->addr + offset)) = rte_cpu_to_le_32(val);
-}
-
-/*
- * Write eight bytes to PCI resource address space at offset "offset".
- */
-static inline void
-pci_resource_write64(struct rte_mem_resource *rsc, uint32_t offset,
-uint64_t val)
-{
-   *((uint64_t *)((uint8_t *)rsc->addr + offset)) = rte_cpu_to_le_64(val);
+   rte_write32(rte_cpu_to_le_32(value), addr);
 }
 
 #define SZEDATA2_PCI_RESOURCE_PTR(rsc, offset, type) \
@@ -209,57 +144,64 @@ enum szedata2_mac_check_mode {
 };
 
 /*
+ * Maximum possible number of MAC addresses (limited by IBUF status
+ * register value MAC_COUNT which has 5 bits).
+ */
+#define SZEDATA2_IBUF_MAX_MAC_COUNT 32
+
+/*
  * Structure describes IBUF address space
  */
 struct szedata2_ibuf {
/** Total Received Frames Counter low part */
-   uint32_t trfcl;
+   uint32_t trfcl; /**< 0x00 */
/** Correct Frames Counter low part */
-   uint32_t cfcl;
+   uint32_t cfcl; /**< 0x04 */
/** Discarded Frames Counter low part */
-   uint32_t dfcl;
+   uint32_t dfcl; /**< 0x08 */
/** Counter of frames discarded due to buffer overflow low part */
-   

[dpdk-dev] [PATCH] net/szedata2: remove unused macro

2017-06-14 Thread Matej Vido
Removed macro is not used since commit:
2f3193c ("pci: inherit common driver in PCI driver")

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 49495fd..9c0d57c 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -65,7 +65,6 @@
 #define RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED 8
 
 #define RTE_SZEDATA2_DRIVER_NAME net_szedata2
-#define RTE_SZEDATA2_PCI_DRIVER_NAME "rte_szedata2_pmd"
 
 #define SZEDATA2_DEV_PATH_FMT "/dev/szedataII%u"
 
-- 
1.8.4



[dpdk-dev] [PATCH] net/szedata2: use macro from common library

2017-06-14 Thread Matej Vido
Macro for alignment is defined in the common library.
Use macro from the common library in own macro definition.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.h 
b/drivers/net/szedata2/rte_eth_szedata2.h
index 2571d54..f25d4c5 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.h
+++ b/drivers/net/szedata2/rte_eth_szedata2.h
@@ -38,6 +38,8 @@
 
 #include 
 
+#include 
+
 /* PCI Vendor ID */
 #define PCI_VENDOR_ID_NETCOPE 0x1b26
 
@@ -58,7 +60,7 @@
  * Round 'what' to the nearest larger (or equal) multiple of '8'
  * (szedata2 packet is aligned to 8 bytes)
  */
-#define RTE_SZE2_ALIGN8(what) (((what) + ((8) - 1)) & (~((8) - 1)))
+#define RTE_SZE2_ALIGN8(what) RTE_ALIGN(what, 8)
 
 /*! main handle structure */
 struct szedata {
-- 
1.8.4



[dpdk-dev] [PATCH 2/2] maintainers: change section name for szedata2 driver

2017-04-07 Thread Matej Vido
The name of company is listed for other drivers.
Use the company name also for szedata2 driver.
Cards are available from Netcope rather than Cesnet.

Signed-off-by: Matej Vido 
---
 MAINTAINERS | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 382f740..503c953 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -318,11 +318,6 @@ M: Nelson Escobar 
 F: drivers/net/enic/
 F: doc/guides/nics/enic.rst
 
-Combo szedata2
-M: Matej Vido 
-F: drivers/net/szedata2/
-F: doc/guides/nics/szedata2.rst
-
 Intel e1000
 M: Wenzhuo Lu 
 F: drivers/net/e1000/
@@ -359,6 +354,11 @@ M: Nelio Laranjeiro 
 F: drivers/net/mlx5/
 F: doc/guides/nics/mlx5.rst
 
+Netcope szedata2
+M: Matej Vido 
+F: drivers/net/szedata2/
+F: doc/guides/nics/szedata2.rst
+
 Netronome nfp
 M: Alejandro Lucero 
 F: drivers/net/nfp/
-- 
2.7.4



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

2017-04-07 Thread Matej Vido
NICs are available from Netcope under the names NFB-*.
Change names and direct the links to Netcope web.

Signed-off-by: Matej Vido 
---
 doc/guides/nics/szedata2.rst | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
index cb1ec31..60080a9 100644
--- a/doc/guides/nics/szedata2.rst
+++ b/doc/guides/nics/szedata2.rst
@@ -31,16 +31,16 @@
 SZEDATA2 poll mode driver library
 =
 
-The SZEDATA2 poll mode driver library implements support for cards from COMBO
-family (**COMBO-80G**, **COMBO-100G**).
-The SZEDATA2 PMD uses interface provided by libsze2 library to communicate
-with COMBO cards over sze2 layer.
+The SZEDATA2 poll mode driver library implements support for the Netcope
+FPGA Boards (**NFB-***), FPGA-based programmable NICs.
+The SZEDATA2 PMD uses interface provided by the libsze2 library to communicate
+with the NFB cards over the sze2 layer.
 
-More information about family of
-`COMBO cards <https://www.liberouter.org/technologies/cards/>`_
+More information about the
+`NFB cards <http://www.netcope.com/en/products/fpga-boards>`_
 and used technology
-(`NetCOPE platform <https://www.liberouter.org/technologies/netcope/>`_) can be
-found on the `Liberouter website <https://www.liberouter.org/>`_.
+(`Netcope Development Kit 
<http://www.netcope.com/en/products/fpga-development-kit>`_)
+can be found on the `Netcope Technologies website <http://www.netcope.com/>`_.
 
 .. note::
 
@@ -77,7 +77,7 @@ separately:
sharing of resources for user space applications.
 
 Information about getting the dependencies can be found `here
-<https://www.liberouter.org/technologies/netcope/access-to-libsze2-library/>`_.
+<http://www.netcope.com/en/company/community-support/dpdk-libsze2>`_.
 
 Configuration
 -
-- 
2.7.4



[dpdk-dev] [PATCH 1/5] net/szedata2: refactor ibuf and obuf names

2017-05-26 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c |   80 +++---
 drivers/net/szedata2/rte_eth_szedata2.h |   48 +-
 2 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index c70e9f3..5be08da 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1149,11 +1149,11 @@ struct pmd_internals {
struct rte_eth_link *dev_link = &dev->data->dev_link;
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_ibuf *);
+   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+   volatile struct szedata2_ibuf *);
 
-   switch (cgmii_link_speed(ibuf)) {
+   switch (get_link_speed(ibuf)) {
case SZEDATA2_LINK_SPEED_10G:
link.link_speed = ETH_SPEED_NUM_10G;
break;
@@ -1171,8 +1171,8 @@ struct pmd_internals {
/* szedata2 uses only full duplex */
link.link_duplex = ETH_LINK_FULL_DUPLEX;
 
-   link.link_status = (cgmii_ibuf_is_enabled(ibuf) &&
-   cgmii_ibuf_is_link_up(ibuf)) ? ETH_LINK_UP : 
ETH_LINK_DOWN;
+   link.link_status = (ibuf_is_enabled(ibuf) &&
+   ibuf_is_link_up(ibuf)) ? ETH_LINK_UP : ETH_LINK_DOWN;
 
link.link_autoneg = ETH_LINK_SPEED_FIXED;
 
@@ -1187,15 +1187,15 @@ struct pmd_internals {
 {
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_ibuf *);
-   volatile struct szedata2_cgmii_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_OBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_obuf *);
-
-   cgmii_ibuf_enable(ibuf);
-   cgmii_obuf_enable(obuf);
+   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+   volatile struct szedata2_ibuf *);
+   volatile struct szedata2_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_OBUF_BASE_OFF,
+   volatile struct szedata2_obuf *);
+
+   ibuf_enable(ibuf);
+   obuf_enable(obuf);
return 0;
 }
 
@@ -1204,15 +1204,15 @@ struct pmd_internals {
 {
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_ibuf *);
-   volatile struct szedata2_cgmii_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_OBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_obuf *);
-
-   cgmii_ibuf_disable(ibuf);
-   cgmii_obuf_disable(obuf);
+   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+   volatile struct szedata2_ibuf *);
+   volatile struct szedata2_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_OBUF_BASE_OFF,
+   volatile struct szedata2_obuf *);
+
+   ibuf_disable(ibuf);
+   obuf_disable(obuf);
return 0;
 }
 
@@ -1292,10 +1292,10 @@ struct pmd_internals {
 {
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_CGMII_IBUF_BASE_OFF,
-   volatile struct szedata2_cgmii_ibuf *);
-   cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_PROMISC);
+   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
+   volatile struct szedata2_ibuf *);
+   ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_PROMISC);
 }
 
 static void
@@ -1303,10 +1303,10 @@ struct pmd_internals {
 {
struct pmd_internals *internals = (struct pmd_internals *)
dev->data-&g

[dpdk-dev] [PATCH 2/5] net/szedata2: refactor ibuf and obuf read and write

2017-05-26 Thread Matej Vido
Remove unused read and write functions.
Use rte_read*, rte_write* functions to access ibuf and obuf
address space.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c |4 +-
 drivers/net/szedata2/rte_eth_szedata2.h |  184 +++
 2 files changed, 64 insertions(+), 124 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 5be08da..f8ec331 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1149,9 +1149,9 @@ struct pmd_internals {
struct rte_eth_link *dev_link = &dev->data->dev_link;
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   const volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
-   volatile struct szedata2_ibuf *);
+   const volatile struct szedata2_ibuf *);
 
switch (get_link_speed(ibuf)) {
case SZEDATA2_LINK_SPEED_10G:
diff --git a/drivers/net/szedata2/rte_eth_szedata2.h 
b/drivers/net/szedata2/rte_eth_szedata2.h
index 4f56fcf..0b635d0 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.h
+++ b/drivers/net/szedata2/rte_eth_szedata2.h
@@ -37,6 +37,7 @@
 #include 
 
 #include 
+#include 
 
 /* PCI Vendor ID */
 #define PCI_VENDOR_ID_NETCOPE 0x1b26
@@ -113,82 +114,16 @@ struct szedata {
int numa_node;
 };
 
-/*
- * @return Byte from PCI resource at offset "offset".
- */
-static inline uint8_t
-pci_resource_read8(struct rte_mem_resource *rsc, uint32_t offset)
-{
-   return *((uint8_t *)((uint8_t *)rsc->addr + offset));
-}
-
-/*
- * @return Two bytes from PCI resource starting at offset "offset".
- */
-static inline uint16_t
-pci_resource_read16(struct rte_mem_resource *rsc, uint32_t offset)
-{
-   return rte_le_to_cpu_16(*((uint16_t *)((uint8_t *)rsc->addr +
-  offset)));
-}
-
-/*
- * @return Four bytes from PCI resource starting at offset "offset".
- */
 static inline uint32_t
-pci_resource_read32(struct rte_mem_resource *rsc, uint32_t offset)
-{
-   return rte_le_to_cpu_32(*((uint32_t *)((uint8_t *)rsc->addr +
-  offset)));
-}
-
-/*
- * @return Eight bytes from PCI resource starting at offset "offset".
- */
-static inline uint64_t
-pci_resource_read64(struct rte_mem_resource *rsc, uint32_t offset)
-{
-   return rte_le_to_cpu_64(*((uint64_t *)((uint8_t *)rsc->addr +
-  offset)));
-}
-
-/*
- * Write one byte to PCI resource address space at offset "offset".
- */
-static inline void
-pci_resource_write8(struct rte_mem_resource *rsc, uint32_t offset, uint8_t val)
+szedata2_read32(const volatile void *addr)
 {
-   *((uint8_t *)((uint8_t *)rsc->addr + offset)) = val;
+   return rte_le_to_cpu_32(rte_read32(addr));
 }
 
-/*
- * Write two bytes to PCI resource address space at offset "offset".
- */
 static inline void
-pci_resource_write16(struct rte_mem_resource *rsc, uint32_t offset,
-uint16_t val)
+szedata2_write32(uint32_t value, volatile void *addr)
 {
-   *((uint16_t *)((uint8_t *)rsc->addr + offset)) = rte_cpu_to_le_16(val);
-}
-
-/*
- * Write four bytes to PCI resource address space at offset "offset".
- */
-static inline void
-pci_resource_write32(struct rte_mem_resource *rsc, uint32_t offset,
-uint32_t val)
-{
-   *((uint32_t *)((uint8_t *)rsc->addr + offset)) = rte_cpu_to_le_32(val);
-}
-
-/*
- * Write eight bytes to PCI resource address space at offset "offset".
- */
-static inline void
-pci_resource_write64(struct rte_mem_resource *rsc, uint32_t offset,
-uint64_t val)
-{
-   *((uint64_t *)((uint8_t *)rsc->addr + offset)) = rte_cpu_to_le_64(val);
+   rte_write32(rte_cpu_to_le_32(value), addr);
 }
 
 #define SZEDATA2_PCI_RESOURCE_PTR(rsc, offset, type) \
@@ -209,57 +144,64 @@ enum szedata2_mac_check_mode {
 };
 
 /*
+ * Maximum possible number of MAC addresses (limited by IBUF status
+ * register value MAC_COUNT which has 5 bits).
+ */
+#define SZEDATA2_IBUF_MAX_MAC_COUNT 32
+
+/*
  * Structure describes IBUF address space
  */
 struct szedata2_ibuf {
/** Total Received Frames Counter low part */
-   uint32_t trfcl;
+   uint32_t trfcl; /**< 0x00 */
/** Correct Frames Counter low part */
-   uint32_t cfcl;
+   uint32_t cfcl; /**< 0x04 */
/** Discarded Frames Counter low part */
-   uint32_t dfcl;
+   uint32_t dfcl; /**< 0x08 */
/** Counter of frames discarded due to buffer overflow low part */
-   

[dpdk-dev] [PATCH 3/5] net/szedata2: refactor ibuf and obuf address definition

2017-05-26 Thread Matej Vido
This is to prepare for firmwares with multiple ibufs and obufs.
Offsets of ibufs and obufs are defined in array.
Functions which operate on ibufs and obufs iterate over this array.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/Makefile   |1 +
 drivers/net/szedata2/rte_eth_szedata2.c |  121 +--
 drivers/net/szedata2/rte_eth_szedata2.h |   64 
 drivers/net/szedata2/szedata2_iobuf.c   |   69 ++
 drivers/net/szedata2/szedata2_iobuf.h   |   95 
 5 files changed, 246 insertions(+), 104 deletions(-)
 create mode 100644 drivers/net/szedata2/szedata2_iobuf.c
 create mode 100644 drivers/net/szedata2/szedata2_iobuf.h

diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
index 836c3b2..0e96b92 100644
--- a/drivers/net/szedata2/Makefile
+++ b/drivers/net/szedata2/Makefile
@@ -48,6 +48,7 @@ LIBABIVER := 1
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += rte_eth_szedata2.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += szedata2_iobuf.c
 
 #
 # Export include files
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index f8ec331..49495fd 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -53,6 +53,7 @@
 #include 
 
 #include "rte_eth_szedata2.h"
+#include "szedata2_iobuf.h"
 
 #define RTE_ETH_SZEDATA2_MAX_RX_QUEUES 32
 #define RTE_ETH_SZEDATA2_MAX_TX_QUEUES 32
@@ -1140,6 +1141,33 @@ struct pmd_internals {
dev->data->nb_tx_queues = 0;
 }
 
+/**
+ * Function takes value from first IBUF status register.
+ * Values in IBUF and OBUF should be same.
+ *
+ * @param internals
+ * Pointer to device private structure.
+ * @return
+ * Link speed constant.
+ */
+static inline enum szedata2_link_speed
+get_link_speed(const struct pmd_internals *internals)
+{
+   const volatile struct szedata2_ibuf *ibuf =
+   ibuf_ptr_by_index(internals->pci_rsc, 0);
+   uint32_t speed = (szedata2_read32(&ibuf->ibuf_st) & 0x70) >> 4;
+   switch (speed) {
+   case 0x03:
+   return SZEDATA2_LINK_SPEED_10G;
+   case 0x04:
+   return SZEDATA2_LINK_SPEED_40G;
+   case 0x05:
+   return SZEDATA2_LINK_SPEED_100G;
+   default:
+   return SZEDATA2_LINK_SPEED_DEFAULT;
+   }
+}
+
 static int
 eth_link_update(struct rte_eth_dev *dev,
int wait_to_complete __rte_unused)
@@ -1149,11 +1177,11 @@ struct pmd_internals {
struct rte_eth_link *dev_link = &dev->data->dev_link;
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   const volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
-   const volatile struct szedata2_ibuf *);
+   const volatile struct szedata2_ibuf *ibuf;
+   uint32_t i;
+   bool link_is_up = false;
 
-   switch (get_link_speed(ibuf)) {
+   switch (get_link_speed(internals)) {
case SZEDATA2_LINK_SPEED_10G:
link.link_speed = ETH_SPEED_NUM_10G;
break;
@@ -1171,8 +1199,19 @@ struct pmd_internals {
/* szedata2 uses only full duplex */
link.link_duplex = ETH_LINK_FULL_DUPLEX;
 
-   link.link_status = (ibuf_is_enabled(ibuf) &&
-   ibuf_is_link_up(ibuf)) ? ETH_LINK_UP : ETH_LINK_DOWN;
+   for (i = 0; i < szedata2_ibuf_count; i++) {
+   ibuf = ibuf_ptr_by_index(internals->pci_rsc, i);
+   /*
+* Link is considered up if at least one ibuf is enabled
+* and up.
+*/
+   if (ibuf_is_enabled(ibuf) && ibuf_is_link_up(ibuf)) {
+   link_is_up = true;
+   break;
+   }
+   }
+
+   link.link_status = (link_is_up) ? ETH_LINK_UP : ETH_LINK_DOWN;
 
link.link_autoneg = ETH_LINK_SPEED_FIXED;
 
@@ -1187,15 +1226,12 @@ struct pmd_internals {
 {
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
-   volatile struct szedata2_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_IBUF_BASE_OFF,
-   volatile struct szedata2_ibuf *);
-   volatile struct szedata2_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
-   internals->pci_rsc, SZEDATA2_OBUF_BASE_OFF,
-   volatile struct szedata2_obuf *);
-
-   ibuf_enable(ibuf);
-   obuf_enable(obuf);
+   uint32_t i;
+
+   for (i = 0; i < szedata2_ibuf_count; i++)
+   ibuf_enable(ibuf_ptr_by_index(internals->pci_rsc, i));
+   for (i = 0; i < szedata2_obuf_count; i+

[dpdk-dev] [PATCH 4/5] net/szedata2: move ibuf and obuf to specific header

2017-05-26 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.h |  216 +-
 drivers/net/szedata2/szedata2_iobuf.h   |  261 +++
 2 files changed, 264 insertions(+), 213 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.h 
b/drivers/net/szedata2/rte_eth_szedata2.h
index 6b31a77..2571d54 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.h
+++ b/drivers/net/szedata2/rte_eth_szedata2.h
@@ -34,10 +34,9 @@
 #ifndef RTE_PMD_SZEDATA2_H_
 #define RTE_PMD_SZEDATA2_H_
 
-#include 
+#include 
 
-#include 
-#include 
+#include 
 
 /* PCI Vendor ID */
 #define PCI_VENDOR_ID_NETCOPE 0x1b26
@@ -114,213 +113,4 @@ struct szedata {
int numa_node;
 };
 
-static inline uint32_t
-szedata2_read32(const volatile void *addr)
-{
-   return rte_le_to_cpu_32(rte_read32(addr));
-}
-
-static inline void
-szedata2_write32(uint32_t value, volatile void *addr)
-{
-   rte_write32(rte_cpu_to_le_32(value), addr);
-}
-
-enum szedata2_link_speed {
-   SZEDATA2_LINK_SPEED_DEFAULT = 0,
-   SZEDATA2_LINK_SPEED_10G,
-   SZEDATA2_LINK_SPEED_40G,
-   SZEDATA2_LINK_SPEED_100G,
-};
-
-enum szedata2_mac_check_mode {
-   SZEDATA2_MAC_CHMODE_PROMISC   = 0x0,
-   SZEDATA2_MAC_CHMODE_ONLY_VALID= 0x1,
-   SZEDATA2_MAC_CHMODE_ALL_BROADCAST = 0x2,
-   SZEDATA2_MAC_CHMODE_ALL_MULTICAST = 0x3,
-};
-
-/*
- * Maximum possible number of MAC addresses (limited by IBUF status
- * register value MAC_COUNT which has 5 bits).
- */
-#define SZEDATA2_IBUF_MAX_MAC_COUNT 32
-
-/*
- * Structure describes IBUF address space
- */
-struct szedata2_ibuf {
-   /** Total Received Frames Counter low part */
-   uint32_t trfcl; /**< 0x00 */
-   /** Correct Frames Counter low part */
-   uint32_t cfcl; /**< 0x04 */
-   /** Discarded Frames Counter low part */
-   uint32_t dfcl; /**< 0x08 */
-   /** Counter of frames discarded due to buffer overflow low part */
-   uint32_t bodfcl; /**< 0x0C */
-   /** Total Received Frames Counter high part */
-   uint32_t trfch; /**< 0x10 */
-   /** Correct Frames Counter high part */
-   uint32_t cfch; /**< 0x14 */
-   /** Discarded Frames Counter high part */
-   uint32_t dfch; /**< 0x18 */
-   /** Counter of frames discarded due to buffer overflow high part */
-   uint32_t bodfch; /**< 0x1C */
-   /** IBUF enable register */
-   uint32_t ibuf_en; /**< 0x20 */
-   /** Error mask register */
-   uint32_t err_mask; /**< 0x24 */
-   /** IBUF status register */
-   uint32_t ibuf_st; /**< 0x28 */
-   /** IBUF command register */
-   uint32_t ibuf_cmd; /**< 0x2C */
-   /** Minimum frame length allowed */
-   uint32_t mfla; /**< 0x30 */
-   /** Frame MTU */
-   uint32_t mtu; /**< 0x34 */
-   /** MAC address check mode */
-   uint32_t mac_chmode; /**< 0x38 */
-   /** Octets Received OK Counter low part */
-   uint32_t orocl; /**< 0x3C */
-   /** Octets Received OK Counter high part */
-   uint32_t oroch; /**< 0x40 */
-   /** reserved */
-   uint8_t reserved[60]; /**< 0x4C */
-   /** IBUF memory for MAC addresses */
-   uint32_t mac_mem[2 * SZEDATA2_IBUF_MAX_MAC_COUNT]; /**< 0x80 */
-} __rte_packed;
-
-/*
- * @return
- * true if IBUF is enabled
- * false if IBUF is disabled
- */
-static inline bool
-ibuf_is_enabled(const volatile struct szedata2_ibuf *ibuf)
-{
-   return ((szedata2_read32(&ibuf->ibuf_en) & 0x1) != 0) ? true : false;
-}
-
-/*
- * Enables IBUF.
- */
-static inline void
-ibuf_enable(volatile struct szedata2_ibuf *ibuf)
-{
-   szedata2_write32(szedata2_read32(&ibuf->ibuf_en) | 0x1, &ibuf->ibuf_en);
-}
-
-/*
- * Disables IBUF.
- */
-static inline void
-ibuf_disable(volatile struct szedata2_ibuf *ibuf)
-{
-   szedata2_write32(szedata2_read32(&ibuf->ibuf_en) & ~0x1,
-   &ibuf->ibuf_en);
-}
-
-/*
- * @return
- * true if ibuf link is up
- * false if ibuf link is down
- */
-static inline bool
-ibuf_is_link_up(const volatile struct szedata2_ibuf *ibuf)
-{
-   return ((szedata2_read32(&ibuf->ibuf_st) & 0x80) != 0) ? true : false;
-}
-
-/*
- * @return
- * MAC address check mode
- */
-static inline enum szedata2_mac_check_mode
-ibuf_mac_mode_read(const volatile struct szedata2_ibuf *ibuf)
-{
-   switch (szedata2_read32(&ibuf->mac_chmode) & 0x3) {
-   case 0x0:
-   return SZEDATA2_MAC_CHMODE_PROMISC;
-   case 0x1:
-   return SZEDATA2_MAC_CHMODE_ONLY_VALID;
-   case 0x2:
-   return SZEDATA2_MAC_CHMODE_ALL_BROADCAST;
-   case 0x3:
-   return SZEDATA2_MAC_CHMODE_ALL_MULTICAST;
-   default:
-   return SZEDATA2_MAC_CHMODE_PROMISC;
-   }
-}
-
-/*
- * Writes "mode" in MAC 

[dpdk-dev] [PATCH 5/5] net/szedata2: add more supported firmwares

2017-05-26 Thread Matej Vido
Add IBUF and OBUF offsets definitions for new firmwares.

Signed-off-by: Matej Vido 
---
 config/common_base|8 +--
 doc/guides/nics/szedata2.rst  |   32 ++--
 drivers/net/szedata2/szedata2_iobuf.c |  148 +++--
 3 files changed, 168 insertions(+), 20 deletions(-)

diff --git a/config/common_base b/config/common_base
index 67ef2ec..25df77a 100644
--- a/config/common_base
+++ b/config/common_base
@@ -279,12 +279,8 @@ CONFIG_RTE_LIBRTE_SFC_EFX_DEBUG=n
 CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
 #
 # Defines firmware type address space.
-# RTE_LIBRTE_PMD_SZEDATA2_AS can be:
-# 0 - for firmwares:
-# NIC_100G1_LR4
-# HANIC_100G1_LR4
-# HANIC_100G1_SR10
-# Other values raise compile time error
+# See documentation for supported values.
+# Other values raise compile time error.
 CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS=0
 
 #
diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
index 60080a9..cb4d965 100644
--- a/doc/guides/nics/szedata2.rst
+++ b/doc/guides/nics/szedata2.rst
@@ -91,14 +91,34 @@ These configuration options can be modified before 
compilation in the
 
 *  ``CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS`` default value: **0**
 
-   This option defines type of firmware address space.
-   Currently supported value is:
+   This option defines type of firmware address space and must be set
+   according to the used card and mode.
+   Currently supported values are:
 
-   * **0** for firmwares:
+   * **0** - for cards (modes):
 
-  * NIC_100G1_LR4
-  * HANIC_100G1_LR4
-  * HANIC_100G1_SR10
+  * NFB-100G1 (100G1)
+
+   * **1** - for cards (modes):
+
+  * NFB-100G2Q (100G1)
+
+   * **2** - for cards (modes):
+
+  * NFB-40G2 (40G2)
+  * NFB-100G2C (100G2)
+  * NFB-100G2Q (40G2)
+  * NFB-200G2QL (100G2, 40G2)
+
+   * **3** - for cards (modes):
+
+  * NFB-40G2 (10G8)
+  * NFB-100G2Q (10G8)
+  * NFB-200G2QL (10G8)
+
+   * **4** - for cards (modes):
+
+  * NFB-100G1 (10G10)
 
 Using the SZEDATA2 PMD
 --
diff --git a/drivers/net/szedata2/szedata2_iobuf.c 
b/drivers/net/szedata2/szedata2_iobuf.c
index 2d25e65..821fe78 100644
--- a/drivers/net/szedata2/szedata2_iobuf.c
+++ b/drivers/net/szedata2/szedata2_iobuf.c
@@ -39,21 +39,41 @@
 
 /*
  * IBUFs and OBUFs can generally be located at different offsets in different
- * firmwares.
- * This part defines base offsets of IBUFs and OBUFs through various firmwares.
- * Currently one firmware type is supported.
- * Type of firmware is set through configuration option
+ * firmwares (modes).
+ * This part defines base offsets of IBUFs and OBUFs for various cards
+ * and firmwares (modes).
+ * Type of firmware (mode) is set through configuration option
  * CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS.
  * Possible values are:
- * 0 - for firmwares:
- * NIC_100G1_LR4
- * HANIC_100G1_LR4
- * HANIC_100G1_SR10
+ * 0 - for cards (modes):
+ * NFB-100G1 (100G1)
+ *
+ * 1 - for cards (modes):
+ * NFB-100G2Q (100G1)
+ *
+ * 2 - for cards (modes):
+ * NFB-40G2 (40G2)
+ * NFB-100G2C (100G2)
+ * NFB-100G2Q (40G2)
+ * NFB-200G2QL (100G2, 40G2)
+ *
+ * 3 - for cards (modes):
+ * NFB-40G2 (10G8)
+ * NFB-100G2Q (10G8)
+ * NFB-200G2QL (10G8)
+ *
+ * 4 - for cards (modes):
+ * NFB-100G1 (10G10)
  */
 #if !defined(RTE_LIBRTE_PMD_SZEDATA2_AS)
 #error "RTE_LIBRTE_PMD_SZEDATA2_AS has to be defined"
 #elif RTE_LIBRTE_PMD_SZEDATA2_AS == 0
 
+/*
+ * Cards (modes):
+ * NFB-100G1 (100G1)
+ */
+
 const uint32_t szedata2_ibuf_base_table[] = {
0x8000
 };
@@ -61,6 +81,118 @@
0x9000
 };
 
+#elif RTE_LIBRTE_PMD_SZEDATA2_AS == 1
+
+/*
+ * Cards (modes):
+ * NFB-100G2Q (100G1)
+ */
+
+const uint32_t szedata2_ibuf_base_table[] = {
+   0x8800
+};
+const uint32_t szedata2_obuf_base_table[] = {
+   0x9800
+};
+
+#elif RTE_LIBRTE_PMD_SZEDATA2_AS == 2
+
+/*
+ * Cards (modes):
+ * NFB-40G2 (40G2)
+ * NFB-100G2C (100G2)
+ * NFB-100G2Q (40G2)
+ * NFB-200G2QL (100G2, 40G2)
+ */
+
+const uint32_t szedata2_ibuf_base_table[] = {
+   0x8000,
+   0x8800
+};
+const uint32_t szedata2_obuf_base_table[] = {
+   0x9000,
+   0x9800
+};
+
+#elif RTE_LIBRTE_PMD_SZEDATA2_AS == 3
+
+/*
+ * Cards (modes):
+ * NFB-40G2 (10G8)
+ * NFB-100G2Q (10G8)
+ * NFB-200G2QL (10G8)
+ */
+
+const uint32_t szedata2_ibuf_base_table[] = {
+   0x8000,
+   0x8200,
+   0x8400,
+   0x8600,
+   0x8800,
+   0x8A00,
+   0x8C00,
+   0x8E00
+};
+const uint32_t szedata2_obuf_base_table[] = {
+   0x9000,
+   0x9200,
+   0x9400,
+   0x9600,
+   0x9800,
+   0x9A00,
+   0x9C00,
+   0x9E00
+};
+
+#elif RTE_LIBRTE_PMD_SZEDATA2_AS == 4
+
+/*
+ * Cards (modes):
+ * NFB-100G1 (10G10)
+ */
+
+const uint32_t szedata2_ibuf_base_table[] = {
+   0x8000,
+   0x8200,
+   0x8400,
+   0x8600,
+   0x8800,
+   

[dpdk-dev] [PATCH] doc: announce ABI change for link speed

2015-12-15 Thread Matej Vido
Acked-by: Matej Vido 

D?a 15.12.2015 o 08:21 Thomas Monjalon nap?sal(a):
> A rework was prepared by Marc Sune:
> http://dpdk.org/ml/archives/dev/2015-October/026037.html
> The goal is to retrieve the supported link speed of a device
> and to allow 100G devices while having a consistent API.
>
> Signed-off-by: Thomas Monjalon 


[dpdk-dev] [PATCH] maintainers: update for szedata2 PMD

2018-07-17 Thread Matej Vido
I will no longer be maintaining szedata2 PMD. Jan will take over this
role.

Signed-off-by: Matej Vido 
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 227e32c..43b0a3e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -617,7 +617,7 @@ F: doc/guides/nics/netvsc.rst
 F: doc/guides/nics/features/netvsc.ini
 
 Netcope szedata2
-M: Matej Vido 
+M: Jan Remes 
 F: drivers/net/szedata2/
 F: doc/guides/nics/szedata2.rst
 F: doc/guides/nics/features/szedata2.ini
-- 
2.7.4



Re: [dpdk-dev] [PATCH v2 2/3] net/szedata2: add support for new NIC

2018-04-18 Thread Matej Vido

On 13.04.2018 18:29, Ferruh Yigit wrote:

On 4/13/2018 4:03 PM, Jan Remeš wrote:

It is mentioned on the website with the packages itself. The current
version works with the reworked PMD - there is a headline which says:
"DPDK from 18.05" (since we expect the patches to land in the upcoming
release; we will update it if this does not happen).

The older version is still available on the website, with appropriate
installation steps and a headline that says "DPDK up to 18.02".

Is this form of documentation sufficient for you or would you like to
see it mentioned in the DPDK documentation as well?

I think it is better to have some level of information in DPDK documentation 
too.

There is already a release note update in this set, do you think does it make
sense to mention new dependency there?

I will get patches right now, please send doc/release notes updates as
incremental patches.

Hi Ferruh,

we will send the follow-up patches updating both documentation and 
release notes soon.


Thanks,
Matej



Thanks,
   Jan
Jan Remeš | Software Developer
Netcope Technologies, a.s.

T: +420 530 510 680
A: Sochorova 3232/34, Brno, 616 00, Czech Republic
W: www.netcope.com




On Fri, Apr 13, 2018 at 4:26 PM, Ferruh Yigit  wrote:

On 4/13/2018 9:17 AM, Jan Remeš wrote:

Hi Matej,

Where szedata_get_area_numa_node() is defined?
Is it possible that you are missing a patch?

Thanks,
ferruh

Hi Ferruh,

the new PMD requires an updated version of libsze2 and drivers. We
have just published the updated packages here:
https://www.netcope.com/en/company/community-support/dpdk-libsze2.

DPDK documentation mentions about libsze2 dependency but there is no version
mentioned.

And I have not seen any note that says a new version of library is required,
perhaps I missed it, is there a documentation which says which version of DPDK
requires which version of the dependencies?

What is the way of tracing this dependency?


Sorry for the hickup.

Best regards,
   Jan





[dpdk-dev] [PATCH 1/1] doc: update doc and release notes for szedata2 driver

2018-04-27 Thread Matej Vido
New version of the packages with dependencies for the szedata2
driver is needed due to the new API of the libsze2 library which
is used in the driver.
The documentation and the release notes are updated to contain
the information about the required versions.

Signed-off-by: Matej Vido 
Acked-by: Jan Remes 
---
 doc/guides/nics/szedata2.rst   | 9 +
 doc/guides/rel_notes/release_18_05.rst | 4 
 2 files changed, 13 insertions(+)

diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
index 96fed30..a34fffc 100644
--- a/doc/guides/nics/szedata2.rst
+++ b/doc/guides/nics/szedata2.rst
@@ -54,6 +54,15 @@ separately:
 Information about getting the dependencies can be found `here
 <http://www.netcope.com/en/company/community-support/dpdk-libsze2>`_.
 
+Versions of the packages
+~~~
+
+The minimum version of the provided packages:
+
+* for DPDK from 18.05: **4.4.1**
+
+* for DPDK up to 18.02 (including): **3.0.5**
+
 Configuration
 -
 
diff --git a/doc/guides/rel_notes/release_18_05.rst 
b/doc/guides/rel_notes/release_18_05.rst
index 3d18298..cce82ba 100644
--- a/doc/guides/rel_notes/release_18_05.rst
+++ b/doc/guides/rel_notes/release_18_05.rst
@@ -81,6 +81,10 @@ New Features
 * **Updated szedata2 PMD.**
 
   Added support for new NFB-200G2QL card.
+  New API was introduced in the libsze2 library which the szedata2 PMD depends
+  on thus the new version of the library was needed.
+  New versions of the packages are available and the minimum required version
+  is 4.4.1.
 
 * **Added support for Broadcom NetXtreme-S (BCM58800) family of controllers 
(aka Stingray)**
 
-- 
2.7.4



[dpdk-dev] [PATCH 1/1] net/szedata2: convert to new offload API

2018-04-03 Thread Matej Vido
Offload API is currently used only to setup correct receive function
for scattered packets.
Use offloads member instead of bitfield and advertise correct
capabilities.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 1d02aee..3cfe388 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1016,7 +1016,7 @@ struct pmd_internals {
 eth_dev_configure(struct rte_eth_dev *dev)
 {
struct rte_eth_dev_data *data = dev->data;
-   if (data->dev_conf.rxmode.enable_scatter == 1) {
+   if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_SCATTER) {
dev->rx_pkt_burst = eth_szedata2_rx_scattered;
data->scattered_rx = 1;
} else {
@@ -1031,6 +1031,7 @@ struct pmd_internals {
struct rte_eth_dev_info *dev_info)
 {
struct pmd_internals *internals = dev->data->dev_private;
+
dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
dev_info->if_index = 0;
dev_info->max_mac_addrs = 1;
@@ -1038,6 +1039,10 @@ struct pmd_internals {
dev_info->max_rx_queues = internals->max_rx_queues;
dev_info->max_tx_queues = internals->max_tx_queues;
dev_info->min_rx_bufsize = 0;
+   dev_info->rx_offload_capa = DEV_RX_OFFLOAD_SCATTER;
+   dev_info->tx_offload_capa = 0;
+   dev_info->rx_queue_offload_capa = 0;
+   dev_info->tx_queue_offload_capa = 0;
dev_info->speed_capa = ETH_LINK_SPEED_100G;
 }
 
@@ -1514,14 +1519,10 @@ struct pmd_internals {
internals->max_rx_queues, internals->max_tx_queues);
 
/* Set rx, tx burst functions */
-   if (data->dev_conf.rxmode.enable_scatter == 1 ||
-   data->scattered_rx == 1) {
+   if (data->scattered_rx == 1)
dev->rx_pkt_burst = eth_szedata2_rx_scattered;
-   data->scattered_rx = 1;
-   } else {
+   else
dev->rx_pkt_burst = eth_szedata2_rx;
-   data->scattered_rx = 0;
-   }
dev->tx_pkt_burst = eth_szedata2_tx;
 
/* Set function callbacks for Ethernet API */
-- 
1.8.3.1



[dpdk-dev] [PATCH 0/4] net/szedata2: fixes or improvements

2018-04-04 Thread Matej Vido
Matej Vido (4):
  net/szedata2: fix total stats
  net/szedata2: use dynamically allocated queues
  net/szedata2: add stat of mbuf allocation failures
  net/szedata2: fix format string for pci address

 drivers/net/szedata2/rte_eth_szedata2.c | 171 ++--
 1 file changed, 121 insertions(+), 50 deletions(-)

-- 
1.8.3.1



[dpdk-dev] [PATCH 1/4] net/szedata2: fix total stats

2018-04-04 Thread Matej Vido
Counters from all queues have to be summed up for total stats
even though the number of queue stats counters is not sufficient.

Fixes: 83556fd2c0fc ("szedata2: change to physical device type")
Cc: sta...@dpdk.org

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 3cfe388..fc11d68 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1058,22 +1058,29 @@ struct pmd_internals {
uint64_t tx_err_total = 0;
uint64_t rx_total_bytes = 0;
uint64_t tx_total_bytes = 0;
-   const struct pmd_internals *internals = dev->data->dev_private;
 
-   for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && i < nb_rx; i++) {
-   stats->q_ipackets[i] = internals->rx_queue[i].rx_pkts;
-   stats->q_ibytes[i] = internals->rx_queue[i].rx_bytes;
-   rx_total += stats->q_ipackets[i];
-   rx_total_bytes += stats->q_ibytes[i];
+   for (i = 0; i < nb_rx; i++) {
+   struct szedata2_rx_queue *rxq = dev->data->rx_queues[i];
+
+   if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
+   stats->q_ipackets[i] = rxq->rx_pkts;
+   stats->q_ibytes[i] = rxq->rx_bytes;
+   }
+   rx_total += rxq->rx_pkts;
+   rx_total_bytes += rxq->rx_bytes;
}
 
-   for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && i < nb_tx; i++) {
-   stats->q_opackets[i] = internals->tx_queue[i].tx_pkts;
-   stats->q_obytes[i] = internals->tx_queue[i].tx_bytes;
-   stats->q_errors[i] = internals->tx_queue[i].err_pkts;
-   tx_total += stats->q_opackets[i];
-   tx_total_bytes += stats->q_obytes[i];
-   tx_err_total += stats->q_errors[i];
+   for (i = 0; i < nb_tx; i++) {
+   struct szedata2_tx_queue *txq = dev->data->tx_queues[i];
+
+   if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
+   stats->q_opackets[i] = txq->tx_pkts;
+   stats->q_obytes[i] = txq->tx_bytes;
+   stats->q_errors[i] = txq->err_pkts;
+   }
+   tx_total += txq->tx_pkts;
+   tx_total_bytes += txq->tx_bytes;
+   tx_err_total += txq->err_pkts;
}
 
stats->ipackets = rx_total;
-- 
1.8.3.1



[dpdk-dev] [PATCH 2/4] net/szedata2: use dynamically allocated queues

2018-04-04 Thread Matej Vido
Previously the queues were the part of private data structure of the
Ethernet device.
Now the queues are allocated at setup thus numa-aware allocation is
possible.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 99 -
 1 file changed, 74 insertions(+), 25 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index fc11d68..f41716d 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -86,8 +86,6 @@ struct szedata2_tx_queue {
 };
 
 struct pmd_internals {
-   struct szedata2_rx_queue rx_queue[RTE_ETH_SZEDATA2_MAX_RX_QUEUES];
-   struct szedata2_tx_queue tx_queue[RTE_ETH_SZEDATA2_MAX_TX_QUEUES];
uint16_t max_rx_queues;
uint16_t max_tx_queues;
char sze_dev[PATH_MAX];
@@ -1098,17 +1096,18 @@ struct pmd_internals {
uint16_t i;
uint16_t nb_rx = dev->data->nb_rx_queues;
uint16_t nb_tx = dev->data->nb_tx_queues;
-   struct pmd_internals *internals = dev->data->dev_private;
 
for (i = 0; i < nb_rx; i++) {
-   internals->rx_queue[i].rx_pkts = 0;
-   internals->rx_queue[i].rx_bytes = 0;
-   internals->rx_queue[i].err_pkts = 0;
+   struct szedata2_rx_queue *rxq = dev->data->rx_queues[i];
+   rxq->rx_pkts = 0;
+   rxq->rx_bytes = 0;
+   rxq->err_pkts = 0;
}
for (i = 0; i < nb_tx; i++) {
-   internals->tx_queue[i].tx_pkts = 0;
-   internals->tx_queue[i].tx_bytes = 0;
-   internals->tx_queue[i].err_pkts = 0;
+   struct szedata2_tx_queue *txq = dev->data->tx_queues[i];
+   txq->tx_pkts = 0;
+   txq->tx_bytes = 0;
+   txq->err_pkts = 0;
}
 }
 
@@ -1116,9 +1115,11 @@ struct pmd_internals {
 eth_rx_queue_release(void *q)
 {
struct szedata2_rx_queue *rxq = (struct szedata2_rx_queue *)q;
-   if (rxq->sze != NULL) {
-   szedata_close(rxq->sze);
-   rxq->sze = NULL;
+
+   if (rxq != NULL) {
+   if (rxq->sze != NULL)
+   szedata_close(rxq->sze);
+   rte_free(rxq);
}
 }
 
@@ -1126,9 +1127,11 @@ struct pmd_internals {
 eth_tx_queue_release(void *q)
 {
struct szedata2_tx_queue *txq = (struct szedata2_tx_queue *)q;
-   if (txq->sze != NULL) {
-   szedata_close(txq->sze);
-   txq->sze = NULL;
+
+   if (txq != NULL) {
+   if (txq->sze != NULL)
+   szedata_close(txq->sze);
+   rte_free(txq);
}
 }
 
@@ -1263,23 +1266,42 @@ struct pmd_internals {
 eth_rx_queue_setup(struct rte_eth_dev *dev,
uint16_t rx_queue_id,
uint16_t nb_rx_desc __rte_unused,
-   unsigned int socket_id __rte_unused,
+   unsigned int socket_id,
const struct rte_eth_rxconf *rx_conf __rte_unused,
struct rte_mempool *mb_pool)
 {
struct pmd_internals *internals = dev->data->dev_private;
-   struct szedata2_rx_queue *rxq = &internals->rx_queue[rx_queue_id];
+   struct szedata2_rx_queue *rxq;
int ret;
uint32_t rx = 1 << rx_queue_id;
uint32_t tx = 0;
 
+   if (dev->data->rx_queues[rx_queue_id] != NULL) {
+   eth_rx_queue_release(dev->data->rx_queues[rx_queue_id]);
+   dev->data->rx_queues[rx_queue_id] = NULL;
+   }
+
+   rxq = rte_zmalloc_socket("szedata2 rx queue",
+   sizeof(struct szedata2_rx_queue),
+   RTE_CACHE_LINE_SIZE, socket_id);
+   if (rxq == NULL) {
+   RTE_LOG(ERR, PMD, "rte_zmalloc_socket() failed for rx queue id "
+   "%" PRIu16 "!\n", rx_queue_id);
+   return -ENOMEM;
+   }
+
rxq->sze = szedata_open(internals->sze_dev);
-   if (rxq->sze == NULL)
+   if (rxq->sze == NULL) {
+   RTE_LOG(ERR, PMD, "szedata_open() failed for rx queue id "
+   "%" PRIu16 "!\n", rx_queue_id);
+   eth_rx_queue_release(rxq);
return -EINVAL;
+   }
ret = szedata_subscribe3(rxq->sze, &rx, &tx);
if (ret != 0 || rx == 0) {
-   szedata_close(rxq->sze);
-   rxq->sze = NULL;
+   RTE_LOG(ERR, PMD, "szedata_subscribe3() failed for rx queue id "
+   "%" PRIu16 "!\n", rx_queue_id);
+   eth_rx_queue_release(rxq);
return -EINVAL;
}
rxq->rx_channel = rx_queue_id;
@@ -129

[dpdk-dev] [PATCH 3/4] net/szedata2: add stat of mbuf allocation failures

2018-04-04 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 31 +++
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index f41716d..8278780 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -67,7 +67,16 @@
 
 #define SZEDATA2_DEV_PATH_FMT "/dev/szedataII%u"
 
+struct pmd_internals {
+   struct rte_eth_dev *dev;
+   uint16_t max_rx_queues;
+   uint16_t max_tx_queues;
+   char sze_dev[PATH_MAX];
+   struct rte_mem_resource *pci_rsc;
+};
+
 struct szedata2_rx_queue {
+   struct pmd_internals *priv;
struct szedata *sze;
uint8_t rx_channel;
uint16_t in_port;
@@ -78,6 +87,7 @@ struct szedata2_rx_queue {
 };
 
 struct szedata2_tx_queue {
+   struct pmd_internals *priv;
struct szedata *sze;
uint8_t tx_channel;
volatile uint64_t tx_pkts;
@@ -85,13 +95,6 @@ struct szedata2_tx_queue {
volatile uint64_t err_pkts;
 };
 
-struct pmd_internals {
-   uint16_t max_rx_queues;
-   uint16_t max_tx_queues;
-   char sze_dev[PATH_MAX];
-   struct rte_mem_resource *pci_rsc;
-};
-
 static struct ether_addr eth_addr = {
.addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 }
 };
@@ -130,8 +133,10 @@ struct pmd_internals {
for (i = 0; i < nb_pkts; i++) {
mbuf = rte_pktmbuf_alloc(sze_q->mb_pool);
 
-   if (unlikely(mbuf == NULL))
+   if (unlikely(mbuf == NULL)) {
+   sze_q->priv->dev->data->rx_mbuf_alloc_failed++;
break;
+   }
 
/* get the next sze packet */
if (sze->ct_rx_lck != NULL && !sze->ct_rx_rem_bytes &&
@@ -351,6 +356,8 @@ struct pmd_internals {
uint16_t packet_len1 = 0;
uint16_t packet_len2 = 0;
uint16_t hw_data_align;
+   uint64_t *mbuf_failed_ptr =
+   &sze_q->priv->dev->data->rx_mbuf_alloc_failed;
 
if (unlikely(sze_q->sze == NULL || nb_pkts == 0))
return 0;
@@ -538,6 +545,7 @@ struct pmd_internals {
sze->ct_rx_lck = ct_rx_lck_backup;
sze->ct_rx_rem_bytes = ct_rx_rem_bytes_backup;
sze->ct_rx_cur_ptr = ct_rx_cur_ptr_backup;
+   sze_q->priv->dev->data->rx_mbuf_alloc_failed++;
break;
}
 
@@ -587,6 +595,7 @@ struct pmd_internals {
ct_rx_rem_bytes_backup;
sze->ct_rx_cur_ptr =
ct_rx_cur_ptr_backup;
+   (*mbuf_failed_ptr)++;
goto finish;
}
 
@@ -630,6 +639,7 @@ struct pmd_internals {
ct_rx_rem_bytes_backup;
sze->ct_rx_cur_ptr =
ct_rx_cur_ptr_backup;
+   (*mbuf_failed_ptr)++;
goto finish;
}
 
@@ -1086,6 +1096,7 @@ struct pmd_internals {
stats->ibytes = rx_total_bytes;
stats->obytes = tx_total_bytes;
stats->oerrors = tx_err_total;
+   stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
 
return 0;
 }
@@ -1290,6 +1301,7 @@ struct pmd_internals {
return -ENOMEM;
}
 
+   rxq->priv = internals;
rxq->sze = szedata_open(internals->sze_dev);
if (rxq->sze == NULL) {
RTE_LOG(ERR, PMD, "szedata_open() failed for rx queue id "
@@ -1346,6 +1358,7 @@ struct pmd_internals {
return -ENOMEM;
}
 
+   txq->priv = internals;
txq->sze = szedata_open(internals->sze_dev);
if (txq->sze == NULL) {
RTE_LOG(ERR, PMD, "szedata_open() failed for tx queue id "
@@ -1543,6 +1556,8 @@ struct pmd_internals {
pci_addr->domain, pci_addr->bus, pci_addr->devid,
pci_addr->function);
 
+   internals->dev = dev;
+
/* Get index of szedata2 device file and create path to device file */
ret = get_szedata2_index(pci_addr, &szedata2_index);
if (ret != 0) {
-- 
1.8.3.1



[dpdk-dev] [PATCH 4/4] net/szedata2: fix format string for pci address

2018-04-04 Thread Matej Vido
For fscanf() function SCN macros should be used but PRI macros were
wrongly used.
Also use correct sizes of variables for read values.

Fixes: 83556fd2c0fc ("szedata2: change to physical device type")
Cc: sta...@dpdk.org

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 8278780..04dc8bf 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1488,9 +1488,9 @@ struct szedata2_tx_queue {
FILE *fd;
char pcislot_path[PATH_MAX];
uint32_t domain;
-   uint32_t bus;
-   uint32_t devid;
-   uint32_t function;
+   uint8_t bus;
+   uint8_t devid;
+   uint8_t function;
 
dir = opendir("/sys/class/combo");
if (dir == NULL)
@@ -1515,7 +1515,7 @@ struct szedata2_tx_queue {
if (fd == NULL)
continue;
 
-   ret = fscanf(fd, "%4" PRIx16 ":%2" PRIx8 ":%2" PRIx8 ".%" PRIx8,
+   ret = fscanf(fd, "%8" SCNx32 ":%2" SCNx8 ":%2" SCNx8 ".%" SCNx8,
&domain, &bus, &devid, &function);
fclose(fd);
if (ret != 4)
-- 
1.8.3.1



[dpdk-dev] [PATCH 1/2] doc: convert license header to SPDX tag for szedata2 doc

2018-04-04 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 doc/guides/nics/szedata2.rst | 29 +
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
index 1a5d413..4327e4e 100644
--- a/doc/guides/nics/szedata2.rst
+++ b/doc/guides/nics/szedata2.rst
@@ -1,32 +1,5 @@
-..  BSD LICENSE
+..  SPDX-License-Identifier: BSD-3-Clause
 Copyright 2015 - 2016 CESNET
-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 CESNET 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.
 
 SZEDATA2 poll mode driver library
 =
-- 
1.8.3.1



[dpdk-dev] [PATCH 2/2] net/szedata2: convert license headers to SPDX tags

2018-04-04 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/Makefile   | 32 ++--
 drivers/net/szedata2/rte_eth_szedata2.c | 33 ++---
 drivers/net/szedata2/rte_eth_szedata2.h | 33 ++---
 drivers/net/szedata2/szedata2_iobuf.c   | 33 ++---
 drivers/net/szedata2/szedata2_iobuf.h   | 33 ++---
 5 files changed, 10 insertions(+), 154 deletions(-)

diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
index 0ebd3ec..c5204cb 100644
--- a/drivers/net/szedata2/Makefile
+++ b/drivers/net/szedata2/Makefile
@@ -1,33 +1,5 @@
-#   BSD LICENSE
-#
-#   Copyright (c) 2015 CESNET
-#   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 CESNET 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.
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2015 CESNET
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 04dc8bf..d36d8c1 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1,34 +1,5 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright (c) 2015 - 2016 CESNET
- *   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 CESNET 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.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2015 - 2016 CESNET
  */
 
 #include 
diff --git a/drivers/net/szedata2/rte_eth_szedata2.h 
b/drivers/net/szedata2/rte_eth_szedata2.h
index f25d4c5..147d3d9 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.h
+++ b/drivers/net/szedata2/rte_eth_szedata2.h
@@ -1,34 +1,5 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright (c) 2015 - 2016 CESNET
- *   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 m

[dpdk-dev] [PATCH 1/1] net/szedata2: implement dynamic logging

2018-04-04 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 82 -
 drivers/net/szedata2/szedata2_logs.h| 22 +
 2 files changed, 71 insertions(+), 33 deletions(-)
 create mode 100644 drivers/net/szedata2/szedata2_logs.h

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index d36d8c1..fb9aac0 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -23,6 +23,7 @@
 #include 
 
 #include "rte_eth_szedata2.h"
+#include "szedata2_logs.h"
 #include "szedata2_iobuf.h"
 
 #define RTE_ETH_SZEDATA2_MAX_RX_QUEUES 32
@@ -66,6 +67,9 @@ struct szedata2_tx_queue {
volatile uint64_t err_pkts;
 };
 
+int szedata2_logtype_init;
+int szedata2_logtype_driver;
+
 static struct ether_addr eth_addr = {
.addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 }
 };
@@ -291,10 +295,10 @@ struct szedata2_tx_queue {
 * sze packet will not fit in one mbuf,
 * scattered mode is not enabled, drop packet
 */
-   RTE_LOG(ERR, PMD,
+   PMD_DRV_LOG(ERR,
"SZE segment %d bytes will not fit in one mbuf "
"(%d bytes), scattered mode is not enabled, "
-   "drop packet!!\n",
+   "drop packet!!",
packet_size, buf_size);
rte_pktmbuf_free(mbuf);
}
@@ -1267,23 +1271,23 @@ struct szedata2_tx_queue {
sizeof(struct szedata2_rx_queue),
RTE_CACHE_LINE_SIZE, socket_id);
if (rxq == NULL) {
-   RTE_LOG(ERR, PMD, "rte_zmalloc_socket() failed for rx queue id "
-   "%" PRIu16 "!\n", rx_queue_id);
+   PMD_INIT_LOG(ERR, "rte_zmalloc_socket() failed for rx queue id "
+   "%" PRIu16 "!", rx_queue_id);
return -ENOMEM;
}
 
rxq->priv = internals;
rxq->sze = szedata_open(internals->sze_dev);
if (rxq->sze == NULL) {
-   RTE_LOG(ERR, PMD, "szedata_open() failed for rx queue id "
-   "%" PRIu16 "!\n", rx_queue_id);
+   PMD_INIT_LOG(ERR, "szedata_open() failed for rx queue id "
+   "%" PRIu16 "!", rx_queue_id);
eth_rx_queue_release(rxq);
return -EINVAL;
}
ret = szedata_subscribe3(rxq->sze, &rx, &tx);
if (ret != 0 || rx == 0) {
-   RTE_LOG(ERR, PMD, "szedata_subscribe3() failed for rx queue id "
-   "%" PRIu16 "!\n", rx_queue_id);
+   PMD_INIT_LOG(ERR, "szedata_subscribe3() failed for rx queue id "
+   "%" PRIu16 "!", rx_queue_id);
eth_rx_queue_release(rxq);
return -EINVAL;
}
@@ -1296,8 +1300,8 @@ struct szedata2_tx_queue {
 
dev->data->rx_queues[rx_queue_id] = rxq;
 
-   RTE_LOG(DEBUG, PMD, "Configured rx queue id %" PRIu16 " on socket "
-   "%u.\n", rx_queue_id, socket_id);
+   PMD_INIT_LOG(DEBUG, "Configured rx queue id %" PRIu16 " on socket "
+   "%u.", rx_queue_id, socket_id);
 
return 0;
 }
@@ -1324,23 +1328,23 @@ struct szedata2_tx_queue {
sizeof(struct szedata2_tx_queue),
RTE_CACHE_LINE_SIZE, socket_id);
if (txq == NULL) {
-   RTE_LOG(ERR, PMD, "rte_zmalloc_socket() failed for tx queue id "
-   "%" PRIu16 "!\n", tx_queue_id);
+   PMD_INIT_LOG(ERR, "rte_zmalloc_socket() failed for tx queue id "
+   "%" PRIu16 "!", tx_queue_id);
return -ENOMEM;
}
 
txq->priv = internals;
txq->sze = szedata_open(internals->sze_dev);
if (txq->sze == NULL) {
-   RTE_LOG(ERR, PMD, "szedata_open() failed for tx queue id "
-   "%" PRIu16 "!\n", tx_queue_id);
+   PMD_INIT_LOG(ERR, "szedata_open() failed for tx queue id "
+   "%" PRIu16 "!", tx_queue_id);
eth_tx_queue_release(txq);
return -EINVAL;
}
ret = szedata_subscribe3(txq->sze, &rx, &tx);
if (ret !

[dpdk-dev] [PATCH 0/3] net/szedata2: patch set for new card support

2018-04-06 Thread Matej Vido
This patch set adds support for new card NFB-200G2QL.

Matej Vido (3):
  net/szedata2: remove operations affecting Ethernet interfaces
  net/szedata2: add support for new NIC
  net/szedata2: add kernel module dependency

 config/common_base |   5 -
 .../nics/img/szedata2_nfb200g_architecture.svg | 171 ++
 doc/guides/nics/szedata2.rst   |  66 +-
 doc/guides/rel_notes/release_18_05.rst |   4 +
 drivers/net/szedata2/Makefile  |   1 -
 drivers/net/szedata2/rte_eth_szedata2.c| 684 ++---
 drivers/net/szedata2/rte_eth_szedata2.h|   4 +-
 drivers/net/szedata2/szedata2_iobuf.c  | 174 --
 drivers/net/szedata2/szedata2_iobuf.h  | 327 --
 9 files changed, 667 insertions(+), 769 deletions(-)
 create mode 100644 doc/guides/nics/img/szedata2_nfb200g_architecture.svg
 delete mode 100644 drivers/net/szedata2/szedata2_iobuf.c
 delete mode 100644 drivers/net/szedata2/szedata2_iobuf.h

-- 
1.8.3.1



[dpdk-dev] [PATCH 1/3] net/szedata2: do not affect Ethernet interfaces

2018-04-06 Thread Matej Vido
NFB cards employ multiple Ethernet ports.
Until now, Ethernet port-related operations were performed on all of them
(since the whole card was represented as a single port).
With new NFB-200G2QL card, this is no longer viable.

Since there is no fixed mapping between the queues and Ethernet ports,
and since a single card can be represented as two ports in DPDK,
there is no way of telling which (if any) physical ports should be
associated with individual ports in DPDK.

This is also described in documentation in more detail.

Signed-off-by: Matej Vido 
Signed-off-by: Jan Remes 
---
 config/common_base |   5 -
 .../nics/img/szedata2_nfb200g_architecture.svg | 171 +++
 doc/guides/nics/szedata2.rst   |  66 +++--
 drivers/net/szedata2/Makefile  |   1 -
 drivers/net/szedata2/rte_eth_szedata2.c| 137 +
 drivers/net/szedata2/szedata2_iobuf.c  | 174 ---
 drivers/net/szedata2/szedata2_iobuf.h  | 327 -
 7 files changed, 225 insertions(+), 656 deletions(-)
 create mode 100644 doc/guides/nics/img/szedata2_nfb200g_architecture.svg
 delete mode 100644 drivers/net/szedata2/szedata2_iobuf.c
 delete mode 100644 drivers/net/szedata2/szedata2_iobuf.h

diff --git a/config/common_base b/config/common_base
index 7abf7c6..b182b01 100644
--- a/config/common_base
+++ b/config/common_base
@@ -307,11 +307,6 @@ CONFIG_RTE_LIBRTE_SFC_EFX_DEBUG=n
 # Compile software PMD backed by SZEDATA2 device
 #
 CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
-#
-# Defines firmware type address space.
-# See documentation for supported values.
-# Other values raise compile time error.
-CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS=0
 
 #
 # Compile burst-oriented Cavium Thunderx NICVF PMD driver
diff --git a/doc/guides/nics/img/szedata2_nfb200g_architecture.svg 
b/doc/guides/nics/img/szedata2_nfb200g_architecture.svg
new file mode 100644
index 000..6ee536b
--- /dev/null
+++ b/doc/guides/nics/img/szedata2_nfb200g_architecture.svg
@@ -0,0 +1,171 @@
+
+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";
+   id="svg2"
+   stroke-miterlimit="10"
+   stroke-linecap="square"
+   stroke="none"
+   fill="none"
+   viewBox="0.0 0.0 568.7322834645669 352.3937007874016"
+   version="1.1">
+  
+
+  
+image/svg+xml
+http://purl.org/dc/dcmitype/StillImage"; />
+
+  
+
+  
+  
+  
+
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+
diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
index 4327e4e..1b4b3eb 100644
--- a/doc/guides/nics/szedata2.rst
+++ b/doc/guides/nics/szedata2.rst
@@ -43,8 +43,10 @@ separately:
 
 *  **Kernel modules**
 
+   * combo6core
* combov3
-   * szedata2_cv3
+   * szedata2
+   * szedata2_cv3 or szedata2_cv3_fdt
 
Kernel modules manage initialization of hardware, allocation and
sharing of resources for user space applications.
@@ -62,45 +64,53 @@ These configuration options can be modified before 
compilation in the
 
Value **y** enables compilation of szedata2 PMD.
 
-*  ``CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS`` default value: **0**
-
-   This option defines type of firmware address space and must be set
-   according to the used card and mode.
-   Currently supported values are:
-
-   * **0** - for cards (modes):
-
-  * NFB-100G1 (100G1)
+Using the SZEDATA2 PMD
+--
 
-   * **1** - for cards (modes):
+From DPDK version 16.04 the type of SZEDATA2 PMD is changed to PMD_PDEV.
+SZEDATA2 device is automatically recognized during EAL initialization.
+No special command line options are needed.
 
-  * NFB-100G2Q (100G1)
+Kernel modules have to be loaded before running the DPDK application.
 
-   * **2** - for cards (modes):
+NFB card architecture
+-
 
-  * NFB-40G2 (40G2)
-  * NFB-100G2C (100G2)
-  * NFB-100G2Q (40G2)
+The NFB cards are multi-port multi-queue cards, where (generally) data from any
+Ethernet port may be sent to any queue.
+They were historically represented in DPDK as a single port.
 
-   * **3** - for cards (modes):
+However, the new NFB-200G2QL card employs an addon cable which allows to 
connect
+it to two physical PCI-E slots at the same time (see the diagram below).
+This is done to allow 200 Gbps of traffic to be transferred through the PCI-E
+bus (note that a single PCI-E 3.0 x16 slot provides only 125 Gbps theoretical
+throughput).
 
-  * NFB-40G2 (10G8)
-  * NFB-100G2Q (10G8)
+Since each slot may be connected to a different CPU and th

[dpdk-dev] [PATCH 2/3] net/szedata2: add support for new NIC

2018-04-06 Thread Matej Vido
This patch adds support for new NIC NFB-200G2QL.

At the probing stage numa nodes for the DMA queues are identified
and the appropriate number of ports is allocated.
DMA queues residing on the same numa node are grouped in the same
port.

Signed-off-by: Matej Vido 
---
 doc/guides/rel_notes/release_18_05.rst  |   4 +
 drivers/net/szedata2/rte_eth_szedata2.c | 545 +---
 drivers/net/szedata2/rte_eth_szedata2.h |   4 +-
 3 files changed, 441 insertions(+), 112 deletions(-)

diff --git a/doc/guides/rel_notes/release_18_05.rst 
b/doc/guides/rel_notes/release_18_05.rst
index 9cc77f8..87e36cf 100644
--- a/doc/guides/rel_notes/release_18_05.rst
+++ b/doc/guides/rel_notes/release_18_05.rst
@@ -58,6 +58,10 @@ New Features
   * Added support for NVGRE, VXLAN and GENEVE filters in flow API.
   * Added support for DROP action in flow API.
 
+* **Updated szedata2 PMD.**
+
+  Added support for new NFB-200G2QL card.
+
 
 API Changes
 ---
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 0f3ee94..c4b34e0 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -38,18 +38,53 @@
 
 #define SZEDATA2_DEV_PATH_FMT "/dev/szedataII%u"
 
+/**
+ * Format string for suffix used to differentiate between Ethernet ports
+ * on the same PCI device.
+ */
+#define SZEDATA2_ETH_DEV_NAME_SUFFIX_FMT "-port%u"
+
+/**
+ * Maximum number of ports for one device.
+ */
+#define SZEDATA2_MAX_PORTS 2
+
+/**
+ * Entry in list of PCI devices for this driver.
+ */
+struct pci_dev_list_entry;
+struct pci_dev_list_entry {
+   LIST_ENTRY(pci_dev_list_entry) next;
+   struct rte_pci_device *pci_dev;
+   unsigned int port_count;
+};
+
+/* List of PCI devices with number of ports for this driver. */
+LIST_HEAD(pci_dev_list, pci_dev_list_entry) szedata2_pci_dev_list =
+   LIST_HEAD_INITIALIZER(szedata2_pci_dev_list);
+
+struct port_info {
+   unsigned int rx_base_id;
+   unsigned int tx_base_id;
+   unsigned int rx_count;
+   unsigned int tx_count;
+   int numa_node;
+};
+
 struct pmd_internals {
struct rte_eth_dev *dev;
uint16_t max_rx_queues;
uint16_t max_tx_queues;
-   char sze_dev[PATH_MAX];
-   struct rte_mem_resource *pci_rsc;
+   unsigned int rxq_base_id;
+   unsigned int txq_base_id;
+   char *sze_dev_path;
 };
 
 struct szedata2_rx_queue {
struct pmd_internals *priv;
struct szedata *sze;
uint8_t rx_channel;
+   uint16_t qid;
uint16_t in_port;
struct rte_mempool *mb_pool;
volatile uint64_t rx_pkts;
@@ -61,6 +96,7 @@ struct szedata2_tx_queue {
struct pmd_internals *priv;
struct szedata *sze;
uint8_t tx_channel;
+   uint16_t qid;
volatile uint64_t tx_pkts;
volatile uint64_t tx_bytes;
volatile uint64_t err_pkts;
@@ -870,7 +906,7 @@ struct szedata2_tx_queue {
if (rxq->sze == NULL) {
uint32_t rx = 1 << rxq->rx_channel;
uint32_t tx = 0;
-   rxq->sze = szedata_open(internals->sze_dev);
+   rxq->sze = szedata_open(internals->sze_dev_path);
if (rxq->sze == NULL)
return -EINVAL;
ret = szedata_subscribe3(rxq->sze, &rx, &tx);
@@ -915,7 +951,7 @@ struct szedata2_tx_queue {
if (txq->sze == NULL) {
uint32_t rx = 0;
uint32_t tx = 1 << txq->tx_channel;
-   txq->sze = szedata_open(internals->sze_dev);
+   txq->sze = szedata_open(internals->sze_dev_path);
if (txq->sze == NULL)
return -EINVAL;
ret = szedata_subscribe3(txq->sze, &rx, &tx);
@@ -1180,12 +1216,15 @@ struct szedata2_tx_queue {
const struct rte_eth_rxconf *rx_conf __rte_unused,
struct rte_mempool *mb_pool)
 {
-   struct pmd_internals *internals = dev->data->dev_private;
struct szedata2_rx_queue *rxq;
int ret;
-   uint32_t rx = 1 << rx_queue_id;
+   struct pmd_internals *internals = dev->data->dev_private;
+   uint8_t rx_channel = internals->rxq_base_id + rx_queue_id;
+   uint32_t rx = 1 << rx_channel;
uint32_t tx = 0;
 
+   PMD_INIT_FUNC_TRACE();
+
if (dev->data->rx_queues[rx_queue_id] != NULL) {
eth_rx_queue_release(dev->data->rx_queues[rx_queue_id]);
dev->data->rx_queues[rx_queue_id] = NULL;
@@ -1201,7 +1240,7 @@ struct szedata2_tx_queue {
}
 
rxq->priv = internals;
-   rxq->sze = szedata_open(internals->sze_dev);
+   rxq->sze = szedata_open(internals->sze_dev_path);
if (rxq->sze == NULL) {
PMD_INIT_LOG(ERR, "szedata_open() failed f

[dpdk-dev] [PATCH 3/3] net/szedata2: add kernel module dependency

2018-04-06 Thread Matej Vido
New kernel module dependency is required to support NFB-200G2QL card.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index c4b34e0..c2a149a 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1918,7 +1918,7 @@ static int szedata2_eth_pci_remove(struct rte_pci_device 
*pci_dev)
 RTE_PMD_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver);
 RTE_PMD_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, 
rte_szedata2_pci_id_table);
 RTE_PMD_REGISTER_KMOD_DEP(RTE_SZEDATA2_DRIVER_NAME,
-   "* combo6core & combov3 & szedata2 & szedata2_cv3");
+   "* combo6core & combov3 & szedata2 & ( szedata2_cv3 | szedata2_cv3_fdt 
)");
 
 RTE_INIT(szedata2_init_log);
 static void
-- 
1.8.3.1



Re: [dpdk-dev] [PATCH 1/3] net/szedata2: do not affect Ethernet interfaces

2018-04-11 Thread Matej Vido

On 10.04.2018 17:28, Ferruh Yigit wrote:

On 4/6/2018 3:12 PM, Matej Vido wrote:

NFB cards employ multiple Ethernet ports.
Until now, Ethernet port-related operations were performed on all of them
(since the whole card was represented as a single port).
With new NFB-200G2QL card, this is no longer viable.

Since there is no fixed mapping between the queues and Ethernet ports,
and since a single card can be represented as two ports in DPDK,
there is no way of telling which (if any) physical ports should be
associated with individual ports in DPDK.

This is also described in documentation in more detail.

Signed-off-by: Matej Vido 
Signed-off-by: Jan Remes 
---
  config/common_base |   5 -
  .../nics/img/szedata2_nfb200g_architecture.svg | 171 +++

Hi Matej,

This patch fails to apply [1], can you please confirm you can apply it?

[1]
$ git apply --check
dpdk-dev-1-3-net-szedata2-do-not-affect-Ethernet-interfaces.patch
error: corrupt patch at line 270

Hi Ferruh,

I've got same error on patch downloaded from patchwork. It seems that 
the difference between the downloaded patch and the patch generated from 
git is that the long lines in svg file are split into multiple lines in 
the patch downloaded from patchwork. I suppose this could be the 
problem. Any idea how to send a patch containing svg file correctly?


Thanks,
Matej


Re: [dpdk-dev] [PATCH 1/3] net/szedata2: do not affect Ethernet interfaces

2018-04-12 Thread Matej Vido

On 11.04.2018 12:51, Ferruh Yigit wrote:

On 4/11/2018 10:36 AM, Matej Vido wrote:

On 10.04.2018 17:28, Ferruh Yigit wrote:

On 4/6/2018 3:12 PM, Matej Vido wrote:

NFB cards employ multiple Ethernet ports.
Until now, Ethernet port-related operations were performed on all of them
(since the whole card was represented as a single port).
With new NFB-200G2QL card, this is no longer viable.

Since there is no fixed mapping between the queues and Ethernet ports,
and since a single card can be represented as two ports in DPDK,
there is no way of telling which (if any) physical ports should be
associated with individual ports in DPDK.

This is also described in documentation in more detail.

Signed-off-by: Matej Vido 
Signed-off-by: Jan Remes 
---
   config/common_base |   5 -
   .../nics/img/szedata2_nfb200g_architecture.svg | 171 +++

Hi Matej,

This patch fails to apply [1], can you please confirm you can apply it?

[1]
$ git apply --check
dpdk-dev-1-3-net-szedata2-do-not-affect-Ethernet-interfaces.patch
error: corrupt patch at line 270

Hi Ferruh,

I've got same error on patch downloaded from patchwork. It seems that
the difference between the downloaded patch and the patch generated from
git is that the long lines in svg file are split into multiple lines in
the patch downloaded from patchwork. I suppose this could be the
problem. Any idea how to send a patch containing svg file correctly?

cc'ed Ogawa-san for support,

I remember he fixed similar issue in the past for spp, but I don't remember how?
Anyways I've hopefully fixed this by redrawing the image to avoid those 
long lines. I'm sending v2.


Thanks,
Matej



Thanks,
Matej





[dpdk-dev] [PATCH v2 0/3] net/szedata2: patch set for new card support

2018-04-12 Thread Matej Vido
This patch set adds support for new card NFB-200G2QL.

v2:
Rebased on top of dpdk-next-net/master (conflict in release notes
for patch 2).
Svg image in patch 1 replaced by redrawn image to avoid too long lines.

Matej Vido (3):
  net/szedata2: do not affect Ethernet interfaces
  net/szedata2: add support for new NIC
  net/szedata2: add kernel module dependency

 config/common_base |   5 -
 .../nics/img/szedata2_nfb200g_architecture.svg | 214 +++
 doc/guides/nics/szedata2.rst   |  66 +-
 doc/guides/rel_notes/release_18_05.rst |   4 +
 drivers/net/szedata2/Makefile  |   1 -
 drivers/net/szedata2/rte_eth_szedata2.c| 684 ++---
 drivers/net/szedata2/rte_eth_szedata2.h|   4 +-
 drivers/net/szedata2/szedata2_iobuf.c  | 174 --
 drivers/net/szedata2/szedata2_iobuf.h  | 327 --
 9 files changed, 710 insertions(+), 769 deletions(-)
 create mode 100644 doc/guides/nics/img/szedata2_nfb200g_architecture.svg
 delete mode 100644 drivers/net/szedata2/szedata2_iobuf.c
 delete mode 100644 drivers/net/szedata2/szedata2_iobuf.h

-- 
1.8.3.1



[dpdk-dev] [PATCH v2 2/3] net/szedata2: add support for new NIC

2018-04-12 Thread Matej Vido
This patch adds support for new NIC NFB-200G2QL.

At the probing stage numa nodes for the DMA queues are identified
and the appropriate number of ports is allocated.
DMA queues residing on the same numa node are grouped in the same
port.

Signed-off-by: Matej Vido 
---
v2:
Rebased on top of dpdk-next-net/master (conflict in release notes).
---
 doc/guides/rel_notes/release_18_05.rst  |   4 +
 drivers/net/szedata2/rte_eth_szedata2.c | 545 +---
 drivers/net/szedata2/rte_eth_szedata2.h |   4 +-
 3 files changed, 441 insertions(+), 112 deletions(-)

diff --git a/doc/guides/rel_notes/release_18_05.rst 
b/doc/guides/rel_notes/release_18_05.rst
index 8c0414a..e07d9b6 100644
--- a/doc/guides/rel_notes/release_18_05.rst
+++ b/doc/guides/rel_notes/release_18_05.rst
@@ -69,6 +69,10 @@ New Features
   See the :doc:`../nics/axgbe` nic driver guide for more details on this
   new driver.
 
+* **Updated szedata2 PMD.**
+
+  Added support for new NFB-200G2QL card.
+
 
 API Changes
 ---
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index a9dc1c7..5a8f2ed 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -38,18 +38,53 @@
 
 #define SZEDATA2_DEV_PATH_FMT "/dev/szedataII%u"
 
+/**
+ * Format string for suffix used to differentiate between Ethernet ports
+ * on the same PCI device.
+ */
+#define SZEDATA2_ETH_DEV_NAME_SUFFIX_FMT "-port%u"
+
+/**
+ * Maximum number of ports for one device.
+ */
+#define SZEDATA2_MAX_PORTS 2
+
+/**
+ * Entry in list of PCI devices for this driver.
+ */
+struct pci_dev_list_entry;
+struct pci_dev_list_entry {
+   LIST_ENTRY(pci_dev_list_entry) next;
+   struct rte_pci_device *pci_dev;
+   unsigned int port_count;
+};
+
+/* List of PCI devices with number of ports for this driver. */
+LIST_HEAD(pci_dev_list, pci_dev_list_entry) szedata2_pci_dev_list =
+   LIST_HEAD_INITIALIZER(szedata2_pci_dev_list);
+
+struct port_info {
+   unsigned int rx_base_id;
+   unsigned int tx_base_id;
+   unsigned int rx_count;
+   unsigned int tx_count;
+   int numa_node;
+};
+
 struct pmd_internals {
struct rte_eth_dev *dev;
uint16_t max_rx_queues;
uint16_t max_tx_queues;
-   char sze_dev[PATH_MAX];
-   struct rte_mem_resource *pci_rsc;
+   unsigned int rxq_base_id;
+   unsigned int txq_base_id;
+   char *sze_dev_path;
 };
 
 struct szedata2_rx_queue {
struct pmd_internals *priv;
struct szedata *sze;
uint8_t rx_channel;
+   uint16_t qid;
uint16_t in_port;
struct rte_mempool *mb_pool;
volatile uint64_t rx_pkts;
@@ -61,6 +96,7 @@ struct szedata2_tx_queue {
struct pmd_internals *priv;
struct szedata *sze;
uint8_t tx_channel;
+   uint16_t qid;
volatile uint64_t tx_pkts;
volatile uint64_t tx_bytes;
volatile uint64_t err_pkts;
@@ -870,7 +906,7 @@ struct szedata2_tx_queue {
if (rxq->sze == NULL) {
uint32_t rx = 1 << rxq->rx_channel;
uint32_t tx = 0;
-   rxq->sze = szedata_open(internals->sze_dev);
+   rxq->sze = szedata_open(internals->sze_dev_path);
if (rxq->sze == NULL)
return -EINVAL;
ret = szedata_subscribe3(rxq->sze, &rx, &tx);
@@ -915,7 +951,7 @@ struct szedata2_tx_queue {
if (txq->sze == NULL) {
uint32_t rx = 0;
uint32_t tx = 1 << txq->tx_channel;
-   txq->sze = szedata_open(internals->sze_dev);
+   txq->sze = szedata_open(internals->sze_dev_path);
if (txq->sze == NULL)
return -EINVAL;
ret = szedata_subscribe3(txq->sze, &rx, &tx);
@@ -1179,12 +1215,15 @@ struct szedata2_tx_queue {
const struct rte_eth_rxconf *rx_conf __rte_unused,
struct rte_mempool *mb_pool)
 {
-   struct pmd_internals *internals = dev->data->dev_private;
struct szedata2_rx_queue *rxq;
int ret;
-   uint32_t rx = 1 << rx_queue_id;
+   struct pmd_internals *internals = dev->data->dev_private;
+   uint8_t rx_channel = internals->rxq_base_id + rx_queue_id;
+   uint32_t rx = 1 << rx_channel;
uint32_t tx = 0;
 
+   PMD_INIT_FUNC_TRACE();
+
if (dev->data->rx_queues[rx_queue_id] != NULL) {
eth_rx_queue_release(dev->data->rx_queues[rx_queue_id]);
dev->data->rx_queues[rx_queue_id] = NULL;
@@ -1200,7 +1239,7 @@ struct szedata2_tx_queue {
}
 
rxq->priv = internals;
-   rxq->sze = szedata_open(internals->sze_dev);
+   rxq->sze = szedata_open(internals->sze_dev_path);
if (rxq->sze == NULL) {
  

[dpdk-dev] [PATCH v2 1/3] net/szedata2: do not affect Ethernet interfaces

2018-04-12 Thread Matej Vido
NFB cards employ multiple Ethernet ports.
Until now, Ethernet port-related operations were performed on all of them
(since the whole card was represented as a single port).
With new NFB-200G2QL card, this is no longer viable.

Since there is no fixed mapping between the queues and Ethernet ports,
and since a single card can be represented as two ports in DPDK,
there is no way of telling which (if any) physical ports should be
associated with individual ports in DPDK.

This is also described in documentation in more detail.

Signed-off-by: Matej Vido 
Signed-off-by: Jan Remes 
---
v2:
Rebased on top of dpdk-next-net/master.
Svg image replaced by redrawn image to avoid too long lines.
---
 config/common_base |   5 -
 .../nics/img/szedata2_nfb200g_architecture.svg | 214 ++
 doc/guides/nics/szedata2.rst   |  66 +++--
 drivers/net/szedata2/Makefile  |   1 -
 drivers/net/szedata2/rte_eth_szedata2.c| 137 +
 drivers/net/szedata2/szedata2_iobuf.c  | 174 ---
 drivers/net/szedata2/szedata2_iobuf.h  | 327 -
 7 files changed, 268 insertions(+), 656 deletions(-)
 create mode 100644 doc/guides/nics/img/szedata2_nfb200g_architecture.svg
 delete mode 100644 drivers/net/szedata2/szedata2_iobuf.c
 delete mode 100644 drivers/net/szedata2/szedata2_iobuf.h

diff --git a/config/common_base b/config/common_base
index 6c7e7fd..8d948c3 100644
--- a/config/common_base
+++ b/config/common_base
@@ -310,11 +310,6 @@ CONFIG_RTE_LIBRTE_SFC_EFX_DEBUG=n
 # Compile software PMD backed by SZEDATA2 device
 #
 CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
-#
-# Defines firmware type address space.
-# See documentation for supported values.
-# Other values raise compile time error.
-CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS=0
 
 #
 # Compile burst-oriented Cavium Thunderx NICVF PMD driver
diff --git a/doc/guides/nics/img/szedata2_nfb200g_architecture.svg 
b/doc/guides/nics/img/szedata2_nfb200g_architecture.svg
new file mode 100644
index 000..e152e4a
--- /dev/null
+++ b/doc/guides/nics/img/szedata2_nfb200g_architecture.svg
@@ -0,0 +1,214 @@
+
+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";
+   id="svg2"
+   stroke-miterlimit="10"
+   stroke-linecap="square"
+   stroke="none"
+   fill="none"
+   viewBox="0.0 0.0 568.7322834645669 352.3937007874016"
+   version="1.1">
+  
+
+  
+image/svg+xml
+http://purl.org/dc/dcmitype/StillImage"; />
+
+  
+
+  
+  
+  
+
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ETH 0
+ETH 1
+NFB-200G2QL card
+PCI-E master slot
+PCI-E slave slot
+QUEUE 0
+QUEUE 15
+QUEUE 16
+QUEUE 31
+CPU 0
+CPU 1
+  
+
diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
index 4327e4e..1b4b3eb 100644
--- a/doc/guides/nics/szedata2.rst
+++ b/doc/guides/nics/szedata2.rst
@@ -43,8 +43,10 @@ separately:
 
 *  **Kernel modules**
 
+   * combo6core
* combov3
-   * szedata2_cv3
+   * szedata2
+   * szedata2_cv3 or szedata2_cv3_fdt
 
Kernel modules manage initialization of hardware, allocation and
sharing of resources for user space applications.
@@ -62,45 +64,53 @@ These configuration options can be modified before 
compilation in the
 
Value **y** enables compilation of szedata2 PMD.
 
-*  ``CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS`` default value: **0**
-
-   This option defines type of firmware address space and must be set
-   according to the used card and mode.
-   Currently supported values are:
-
-   * **0** - for cards (modes):
-
-  * NFB-100G1 (100G1)
+Using the SZEDATA2 PMD
+--
 
-   * **1** - for cards (modes):
+From DPDK version 16.04 the type of SZEDATA2 PMD is changed to PMD_PDEV.
+SZEDATA2 device is automatically recognized during EAL initialization.
+No special command line options are needed.
 
-  * NFB-100G2Q (100G1)
+Kernel modules have to be loaded before running the DPDK application.
 
-   * **2** - for cards (modes):
+NFB card architecture
+-
 
-  * NFB-40G2 (40G2)
-  * NFB-100G2C (100G2)
-  * NFB-100G2Q (40G2)
+The NFB cards are multi-port multi-queue cards, where (generally) data from any
+Ethernet port may be sent to any queue.
+They were historically represented in DPDK as a single port.
 
-   * **3** - for cards (modes):
+However, the new NFB-200G2QL card employs an addon cable which allows to 
connect
+it to two physical PCI-E slots at the same time (see the diagram below).
+This is done to allow 200 Gbps of traffic to be transferred through th

[dpdk-dev] [PATCH v2 3/3] net/szedata2: add kernel module dependency

2018-04-12 Thread Matej Vido
New kernel module dependency is required to support NFB-200G2QL card.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 5a8f2ed..d81b777 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1917,7 +1917,7 @@ static int szedata2_eth_pci_remove(struct rte_pci_device 
*pci_dev)
 RTE_PMD_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver);
 RTE_PMD_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, 
rte_szedata2_pci_id_table);
 RTE_PMD_REGISTER_KMOD_DEP(RTE_SZEDATA2_DRIVER_NAME,
-   "* combo6core & combov3 & szedata2 & szedata2_cv3");
+   "* combo6core & combov3 & szedata2 & ( szedata2_cv3 | szedata2_cv3_fdt 
)");
 
 RTE_INIT(szedata2_init_log);
 static void
-- 
1.8.3.1



Re: [dpdk-dev] [PATCH 1/3] net/szedata2: do not affect Ethernet interfaces

2018-04-13 Thread Matej Vido

On 13.04.2018 06:25, Yasufumi Ogawa wrote:

On 2018/04/12 16:38, Matej Vido wrote:

On 11.04.2018 12:51, Ferruh Yigit wrote:

On 4/11/2018 10:36 AM, Matej Vido wrote:

On 10.04.2018 17:28, Ferruh Yigit wrote:

On 4/6/2018 3:12 PM, Matej Vido wrote:

NFB cards employ multiple Ethernet ports.
Until now, Ethernet port-related operations were performed on all 
of them

(since the whole card was represented as a single port).
With new NFB-200G2QL card, this is no longer viable.

Since there is no fixed mapping between the queues and Ethernet 
ports,

and since a single card can be represented as two ports in DPDK,
there is no way of telling which (if any) physical ports should be
associated with individual ports in DPDK.

This is also described in documentation in more detail.

Signed-off-by: Matej Vido 
Signed-off-by: Jan Remes 
---
   config/common_base |   5 -
   .../nics/img/szedata2_nfb200g_architecture.svg | 171 
+++

Hi Matej,

This patch fails to apply [1], can you please confirm you can 
apply it?


[1]
$ git apply --check
dpdk-dev-1-3-net-szedata2-do-not-affect-Ethernet-interfaces.patch
error: corrupt patch at line 270

Hi Ferruh,

I've got same error on patch downloaded from patchwork. It seems that
the difference between the downloaded patch and the patch generated 
from
git is that the long lines in svg file are split into multiple 
lines in

the patch downloaded from patchwork. I suppose this could be the
problem. Any idea how to send a patch containing svg file correctly?

cc'ed Ogawa-san for support,

I remember he fixed similar issue in the past for spp, but I don't 
remember how?
Anyways I've hopefully fixed this by redrawing the image to avoid 
those long lines. I'm sending v2.


Thanks,
Matej

Hi Matej, Ferruh,

I also encountered the same problem for 998 chars limitation of SMTP. 
I fixed it by replacing objects with simpler ones.


You can check this error by using '--validate' option of git send-email.

Thanks,
Yasufumi

Hi Yasufumi,

thanks for sharing your remarks. Eventually I resolved it likewise.

Regards,
Matej



Thanks,
Matej












Re: [dpdk-dev] [PATCH v3 0/4] increase port_id range

2017-09-13 Thread Matej Vido

On 11.09.2017 12:23, Ferruh Yigit wrote:

On 9/9/2017 3:47 PM, Zhiyong Yang wrote:

port_id is currently defined as uint8_t, which is limited to the range
0 to 255. A larger range is required for vdev scalability.

It is necessary for a redefinition of port_id to extend it from
1 bytes to 2 bytes. All ethdev APIs and usages related to port_id will
be changed at the same time.

Discussion about port_id is the following thread.
http://www.dpdk.org/dev/patchwork/patch/23208/

Changes in V2:
1. cover more PMDs to increase port_id range.
2. cover more examples to increase port_id range.
3. add 17.11 release note.

Changes in V3:
1.  cover mlx4 and mlx5.
2.  add to increase port_id range in test code.
3.  The patch "librte_mbuf: modify port initialization value" is merged
into the patchset.

Zhiyong Yang (4):
   ethdev: increase port_id range
   test: increase port_id range
   examples: increase port_id range
   librte_mbuf: modify port initialization value


PMD Maintainers, please review this patch for your PMD, this innocent
uint8_t to uint16_t change may break your PMD!

Regarding the szedata2 PMD this change is fine.

Thanks,
Matej


Re: [dpdk-dev] [PATCH] mmap(2) returns MAP_FAILED, not NULL, on failure

2017-12-03 Thread Matej Vido

On 02.12.2017 01:54, Ferruh Yigit wrote:

On 11/30/2017 10:51 PM, Michael McConville wrote:

Signed-off-by: Michael McConville 
---
lib/librte_eal/bsdapp/eal/eal_memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c 
b/lib/librte_eal/bsdapp/eal/eal_memory.c
index 6ba058578..2c8a4b592 100644
--- a/lib/librte_eal/bsdapp/eal/eal_memory.c
+++ b/lib/librte_eal/bsdapp/eal/eal_memory.c
@@ -155,7 +155,7 @@ rte_eal_hugepage_attach(void)
/* Map the shared hugepage_info into the process address spaces */
hpi = mmap(NULL, sizeof(struct hugepage_info), PROT_READ, MAP_PRIVATE,
fd_hugepage_info, 0);
-   if (hpi == NULL) {
+   if (hpi == MAP_FAILED) {

Hi Matej,

Can you fix same thing in szedata2 PMD please [1] ?

[1]
http://dpdk.org/browse/dpdk/tree/drivers/net/szedata2/rte_eth_szedata2.c?h=v17.11#n1556


Hi Ferruh,

I will send a patch.

Thanks,
Matej



RTE_LOG(ERR, EAL, "Could not mmap %s\n", 
eal_hugepage_info_path());
goto error;
}





[dpdk-dev] [PATCH] net/szedata2: fix check of mmap return value

2017-12-07 Thread Matej Vido
Fixes: 9eddbdb4b094 ("szedata2: support link state operations")
Cc: sta...@dpdk.org

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 74f151c..af0580a 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1553,7 +1553,7 @@ struct pmd_internals {
pci_dev->mem_resource[PCI_RESOURCE_NUMBER].len,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
close(fd);
-   if (pci_resource_ptr == NULL) {
+   if (pci_resource_ptr == MAP_FAILED) {
RTE_LOG(ERR, PMD, "Could not mmap file %s (fd = %d)\n",
rsc_filename, fd);
return -EINVAL;
-- 
1.8.4



[dpdk-dev] [PATCH 1/4] szedata2: rewrite PMD from virtual PMD_VDEV type to PMD_PDEV type

2016-01-28 Thread Matej Vido
PMD was of type PMD_VDEV which means that PCI device is not recognised
automatically during EAL initialization, but it has to be created by
EAL option --vdev.
Now, PMD is of type PMD_PDEV which means that PCI device is probed
and recognised during EAL initialization automatically.
Path to szedata2 device file is matched with device and the count
of available RX and TX DMA channels is found out during device
initialization.
Initialization, starting and stopping of queues is changed to better
correspond with Ethernet device API model. Function callbacks
(rx|tx)_queue_(start|stop) are added. Unnecessary items are removed
from ethernet device private data structure.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c |  900 ---
 drivers/net/szedata2/rte_eth_szedata2.h |8 +
 2 files changed, 366 insertions(+), 542 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 9f86c99..ef906f3 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -35,6 +35,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 

 #include 

@@ -47,10 +49,6 @@

 #include "rte_eth_szedata2.h"

-#define RTE_ETH_SZEDATA2_DEV_PATH_ARG "dev_path"
-#define RTE_ETH_SZEDATA2_RX_IFACES_ARG "rx_ifaces"
-#define RTE_ETH_SZEDATA2_TX_IFACES_ARG "tx_ifaces"
-
 #define RTE_ETH_SZEDATA2_MAX_RX_QUEUES 32
 #define RTE_ETH_SZEDATA2_MAX_TX_QUEUES 32
 #define RTE_ETH_SZEDATA2_TX_LOCK_SIZE (32 * 1024 * 1024)
@@ -60,6 +58,11 @@
  */
 #define RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED 8

+#define RTE_SZEDATA2_DRIVER_NAME "rte_szedata2_pmd"
+#define RTE_SZEDATA2_PCI_DRIVER_NAME "rte_szedata2_pmd"
+
+#define SZEDATA2_DEV_PATH_FMT "/dev/szedataII%u"
+
 struct szedata2_rx_queue {
struct szedata *sze;
uint8_t rx_channel;
@@ -74,57 +77,27 @@ struct szedata2_tx_queue {
struct szedata *sze;
uint8_t tx_channel;
volatile uint64_t tx_pkts;
-   volatile uint64_t err_pkts;
volatile uint64_t tx_bytes;
-};
-
-struct rxtx_szedata2 {
-   uint32_t num_of_rx;
-   uint32_t num_of_tx;
-   uint32_t sze_rx_mask_req;
-   uint32_t sze_tx_mask_req;
-   char *sze_dev;
+   volatile uint64_t err_pkts;
 };

 struct pmd_internals {
struct szedata2_rx_queue rx_queue[RTE_ETH_SZEDATA2_MAX_RX_QUEUES];
struct szedata2_tx_queue tx_queue[RTE_ETH_SZEDATA2_MAX_TX_QUEUES];
-   unsigned nb_rx_queues;
-   unsigned nb_tx_queues;
-   uint32_t num_of_rx;
-   uint32_t num_of_tx;
-   uint32_t sze_rx_req;
-   uint32_t sze_tx_req;
-   int if_index;
-   char *sze_dev;
-};
-
-static const char *valid_arguments[] = {
-   RTE_ETH_SZEDATA2_DEV_PATH_ARG,
-   RTE_ETH_SZEDATA2_RX_IFACES_ARG,
-   RTE_ETH_SZEDATA2_TX_IFACES_ARG,
-   NULL
+   uint16_t max_rx_queues;
+   uint16_t max_tx_queues;
+   char sze_dev[PATH_MAX];
 };

 static struct ether_addr eth_addr = {
.addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 }
 };
-static const char *drivername = "SZEdata2 PMD";
 static struct rte_eth_link pmd_link = {
.link_speed = ETH_LINK_SPEED_10G,
.link_duplex = ETH_LINK_FULL_DUPLEX,
.link_status = 0
 };

-
-static uint32_t
-count_ones(uint32_t num)
-{
-   num = num - ((num >> 1) & 0x); /* reuse input as temporary */
-   num = (num & 0x) + ((num >> 2) & 0x);/* temp */
-   return (((num + (num >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; /* count */
-}
-
 static uint16_t
 eth_szedata2_rx(void *queue,
struct rte_mbuf **bufs,
@@ -905,288 +878,139 @@ next_packet:
 }

 static int
-init_rx_channels(struct rte_eth_dev *dev, int v)
+eth_rx_queue_start(struct rte_eth_dev *dev, uint16_t rxq_id)
 {
-   struct pmd_internals *internals = dev->data->dev_private;
+   struct szedata2_rx_queue *rxq = dev->data->rx_queues[rxq_id];
int ret;
-   uint32_t i;
-   uint32_t count = internals->num_of_rx;
-   uint32_t num_sub = 0;
-   uint32_t x;
-   uint32_t rx;
-   uint32_t tx;
-
-   rx = internals->sze_rx_req;
-   tx = 0;
-
-   for (i = 0; i < count; i++) {
-   /*
-* Open, subscribe rx,tx channels and start device
-*/
-   if (v)
-   RTE_LOG(INFO, PMD, "Opening SZE device %u. time\n", i);
-
-   internals->rx_queue[num_sub].sze =
-   szedata_open(internals->sze_dev);
-   if (internals->rx_queue[num_sub].sze == NULL)
-   return -1;
-
-   /* separate least significant non-zero bit */
-   x = rx & ((~rx) + 1);
-
-   if (v)
-   R

[dpdk-dev] [PATCH 2/4] szedata2: add functions for setting link up/down and updating link info

2016-01-28 Thread Matej Vido
Mmap PCI resource file and add inline functions for reading from and
writing to PCI resource address space.
Add description of IBUF and OBUF address space.
Add configuration option for setting which firmware type will be used.
Right address space values for IBUFs and OBUFs offsets are used
according to configuration option CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS.
Setting link up/down and getting info about link status is done through
mmapped PCI resource address space.

Signed-off-by: Matej Vido 
---
 config/common_linuxapp  |   11 +
 drivers/net/szedata2/rte_eth_szedata2.c |  152 +--
 drivers/net/szedata2/rte_eth_szedata2.h |  315 ++-
 3 files changed, 462 insertions(+), 16 deletions(-)

diff --git a/config/common_linuxapp b/config/common_linuxapp
index 74bc515..43a795c 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -264,6 +264,17 @@ CONFIG_RTE_LIBRTE_NFP_DEBUG=n
 # Compile software PMD backed by SZEDATA2 device
 #
 CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
+##
+## Defines firmware type address space.
+## RTE_LIBRTE_PMD_SZEDATA2_AS can be:
+## 0 - for firmwares:
+## NIC_100G1_LR4
+## HANIC_100G1_LR4
+## HANIC_100G1_SR10
+##
+## Other values raise compile time error
+##
+CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS=0

 #
 # Compile burst-oriented VIRTIO PMD driver
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index ef906f3..d8c260b 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright (c) 2015 CESNET
+ *   Copyright (c) 2015 - 2016 CESNET
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 

 #include 

@@ -46,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "rte_eth_szedata2.h"

@@ -92,11 +96,6 @@ struct pmd_internals {
 static struct ether_addr eth_addr = {
.addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 }
 };
-static struct rte_eth_link pmd_link = {
-   .link_speed = ETH_LINK_SPEED_10G,
-   .link_duplex = ETH_LINK_FULL_DUPLEX,
-   .link_status = 0
-};

 static uint16_t
 eth_szedata2_rx(void *queue,
@@ -987,7 +986,6 @@ eth_dev_start(struct rte_eth_dev *dev)
goto err_tx;
}

-   dev->data->dev_link.link_status = 1;
return 0;

 err_tx:
@@ -1011,8 +1009,6 @@ eth_dev_stop(struct rte_eth_dev *dev)

for (i = 0; i < nb_rx; i++)
eth_rx_queue_stop(dev, i);
-
-   dev->data->dev_link.link_status = 0;
 }

 static int
@@ -1141,9 +1137,76 @@ eth_dev_close(struct rte_eth_dev *dev)
 }

 static int
-eth_link_update(struct rte_eth_dev *dev __rte_unused,
+eth_link_update(struct rte_eth_dev *dev,
int wait_to_complete __rte_unused)
 {
+   struct rte_eth_link link;
+   struct rte_eth_link *link_ptr = &link;
+   struct rte_eth_link *dev_link = &dev->data->dev_link;
+   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   dev, SZEDATA2_CGMII_IBUF_BASE_OFF,
+   volatile struct szedata2_cgmii_ibuf *);
+
+   switch (cgmii_link_speed(ibuf)) {
+   case SZEDATA2_LINK_SPEED_10G:
+   link.link_speed = ETH_LINK_SPEED_10G;
+   break;
+   case SZEDATA2_LINK_SPEED_40G:
+   link.link_speed = ETH_LINK_SPEED_40G;
+   break;
+   case SZEDATA2_LINK_SPEED_100G:
+   /*
+* TODO
+* If link_speed value from rte_eth_link structure
+* will be changed to support 100Gbps speed change
+* this value to 100G.
+*/
+   link.link_speed = ETH_LINK_SPEED_10G;
+   break;
+   default:
+   link.link_speed = ETH_LINK_SPEED_10G;
+   break;
+   }
+
+   /* szedata2 uses only full duplex */
+   link.link_duplex = ETH_LINK_FULL_DUPLEX;
+
+   link.link_status = (cgmii_ibuf_is_enabled(ibuf) &&
+   cgmii_ibuf_is_link_up(ibuf)) ? 1 : 0;
+
+   rte_atomic64_cmpset((uint64_t *)dev_link, *(uint64_t *)dev_link,
+   *(uint64_t *)link_ptr);
+
+   return 0;
+}
+
+static int
+eth_dev_set_link_up(struct rte_eth_dev *dev)
+{
+   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   dev, SZEDATA2_CGMII_IBUF_BASE_OFF,
+   volatile struct szedata2_cgmii_ibuf *);
+   volatile struct szedata2_cgmii_obuf *obuf = SZEDATA2_PCI_RESOURCE_PTR(
+   dev, SZEDATA2_CGMII_OBUF_BASE_OFF,
+   volatile struct szedata2_cgmii_obuf *);
+
+   cgmii_ibuf_enable(ibuf);
+   cgmii_obuf_e

[dpdk-dev] [PATCH 3/4] szedata2: add functions for enabling/disabling promiscuous, allmulticast modes

2016-01-28 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c |   45 +++
 drivers/net/szedata2/rte_eth_szedata2.h |   39 ++
 2 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index d8c260b..81c806e 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1281,6 +1281,42 @@ eth_mac_addr_set(struct rte_eth_dev *dev __rte_unused,
 {
 }

+static void
+eth_promiscuous_enable(struct rte_eth_dev *dev)
+{
+   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   dev, SZEDATA2_CGMII_IBUF_BASE_OFF,
+   volatile struct szedata2_cgmii_ibuf *);
+   cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_PROMISC);
+}
+
+static void
+eth_promiscuous_disable(struct rte_eth_dev *dev)
+{
+   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   dev, SZEDATA2_CGMII_IBUF_BASE_OFF,
+   volatile struct szedata2_cgmii_ibuf *);
+   cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ONLY_VALID);
+}
+
+static void
+eth_allmulticast_enable(struct rte_eth_dev *dev)
+{
+   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   dev, SZEDATA2_CGMII_IBUF_BASE_OFF,
+   volatile struct szedata2_cgmii_ibuf *);
+   cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ALL_MULTICAST);
+}
+
+static void
+eth_allmulticast_disable(struct rte_eth_dev *dev)
+{
+   volatile struct szedata2_cgmii_ibuf *ibuf = SZEDATA2_PCI_RESOURCE_PTR(
+   dev, SZEDATA2_CGMII_IBUF_BASE_OFF,
+   volatile struct szedata2_cgmii_ibuf *);
+   cgmii_ibuf_mac_mode_write(ibuf, SZEDATA2_MAC_CHMODE_ONLY_VALID);
+}
+
 static struct eth_dev_ops ops = {
.dev_start  = eth_dev_start,
.dev_stop   = eth_dev_stop,
@@ -1289,6 +1325,10 @@ static struct eth_dev_ops ops = {
.dev_close  = eth_dev_close,
.dev_configure  = eth_dev_configure,
.dev_infos_get  = eth_dev_info,
+   .promiscuous_enable   = eth_promiscuous_enable,
+   .promiscuous_disable  = eth_promiscuous_disable,
+   .allmulticast_enable  = eth_allmulticast_enable,
+   .allmulticast_disable = eth_allmulticast_disable,
.rx_queue_start = eth_rx_queue_start,
.rx_queue_stop  = eth_rx_queue_stop,
.tx_queue_start = eth_tx_queue_start,
@@ -1471,8 +1511,10 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
(unsigned long long)pci_rsc->len,
(unsigned long long)pci_rsc->addr);

+   /* Get link state */
eth_link_update(dev, 0);

+   /* Allocate space for one mac address */
data->mac_addrs = rte_zmalloc(data->name, sizeof(struct ether_addr),
RTE_CACHE_LINE_SIZE);
if (data->mac_addrs == NULL) {
@@ -1484,6 +1526,9 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)

ether_addr_copy(ð_addr, data->mac_addrs);

+   /* At initial state COMBO card is in promiscuous mode so disable it */
+   eth_promiscuous_disable(dev);
+
RTE_LOG(INFO, PMD, "szedata2 device ("
PCI_PRI_FMT ") successfully initialized\n",
pci_addr->domain, pci_addr->bus, pci_addr->devid,
diff --git a/drivers/net/szedata2/rte_eth_szedata2.h 
b/drivers/net/szedata2/rte_eth_szedata2.h
index 39d1c48..522cf47 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.h
+++ b/drivers/net/szedata2/rte_eth_szedata2.h
@@ -213,6 +213,13 @@ enum szedata2_link_speed {
SZEDATA2_LINK_SPEED_100G,
 };

+enum szedata2_mac_check_mode {
+   SZEDATA2_MAC_CHMODE_PROMISC   = 0x0,
+   SZEDATA2_MAC_CHMODE_ONLY_VALID= 0x1,
+   SZEDATA2_MAC_CHMODE_ALL_BROADCAST = 0x2,
+   SZEDATA2_MAC_CHMODE_ALL_MULTICAST = 0x3,
+};
+
 /*
  * Structure describes CGMII IBUF address space
  */
@@ -299,6 +306,38 @@ cgmii_ibuf_is_link_up(volatile struct szedata2_cgmii_ibuf 
*ibuf)
 }

 /*
+ * @return
+ * MAC address check mode
+ */
+static inline enum szedata2_mac_check_mode
+cgmii_ibuf_mac_mode_read(volatile struct szedata2_cgmii_ibuf *ibuf)
+{
+   switch (rte_le_to_cpu_32(ibuf->mac_chmode) & 0x3) {
+   case 0x0:
+   return SZEDATA2_MAC_CHMODE_PROMISC;
+   case 0x1:
+   return SZEDATA2_MAC_CHMODE_ONLY_VALID;
+   case 0x2:
+   return SZEDATA2_MAC_CHMODE_ALL_BROADCAST;
+   case 0x3:
+   return SZEDATA2_MAC_CHMODE_ALL_MULTICAST;
+   default:
+   return SZEDATA2_MAC_CHMODE_PROMISC;
+   }
+}
+
+/*
+ * Writes "mode&qu

[dpdk-dev] [PATCH 4/4] szedata2: update documentation and release notes

2016-01-28 Thread Matej Vido
Add info about change from virtual PMD_VDEV to PMD_PDEV and new
functions to release notes.

Signed-off-by: Matej Vido 
---
 doc/guides/nics/szedata2.rst |   93 +
 doc/guides/rel_notes/release_2_3.rst |9 +++
 2 files changed, 68 insertions(+), 34 deletions(-)

diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
index ee3c3fe..ac512a0 100644
--- a/doc/guides/nics/szedata2.rst
+++ b/doc/guides/nics/szedata2.rst
@@ -1,5 +1,5 @@
 ..  BSD LICENSE
-Copyright 2015 CESNET
+Copyright 2015 - 2016 CESNET
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
@@ -33,8 +33,8 @@ SZEDATA2 poll mode driver library

 The SZEDATA2 poll mode driver library implements support for cards from COMBO
 family (**COMBO-80G**, **COMBO-100G**).
-The SZEDATA2 PMD is virtual PMD which uses interface provided by libsze2
-library to communicate with COMBO cards over sze2 layer.
+The SZEDATA2 PMD uses interface provided by libsze2 library to communicate
+with COMBO cards over sze2 layer.

 More information about family of
 `COMBO cards <https://www.liberouter.org/technologies/cards/>`_
@@ -74,50 +74,41 @@ separately:
* szedata2_cv3

Kernel modules manage initialization of hardware, allocation and
-   sharing of resources for user space applications:
+   sharing of resources for user space applications.

 Information about getting the dependencies can be found `here
 <https://www.liberouter.org/technologies/netcope/access-to-libsze2-library/>`_.

+Configuration
+-

-Using the SZEDATA2 PMD
---
-
-SZEDATA2 PMD can be created by passing ``--vdev=`` option to EAL in the
-following format:
-
-.. code-block:: console
-
-   --vdev 'DEVICE,dev_path=PATH,rx_ifaces=RX_MASK,tx_ifaces=TX_MASK'
-
-``DEVICE`` and options ``dev_path``, ``rx_ifaces``, ``tx_ifaces`` are mandatory
-and must be separated by commas.
+These configuration options can be modified before compilation in the
+``.config`` file:

-*  ``DEVICE``: contains prefix ``eth_szedata2`` followed by numbers or letters,
-   must be unique for each virtual device
+*  ``CONFIG_RTE_LIBRTE_PMD_SZEDATA2`` default value: **n**

-*  ``dev_path``: Defines path to szedata2 device.
-   Value is valid path to szedata2 device. Example:
+   Value **y** enables compilation of szedata2 PMD.

-   .. code-block:: console
+*  ``CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS`` default value: **0**

-  dev_path=/dev/szedataII0
+   This option defines type of firmware address space.
+   Currently supported value is:

-*  ``rx_ifaces``: Defines which receive channels will be used.
-   For each channel is created one queue. Value is mask for selecting which
-   receive channels are required. Example:
+   * **0** for firmwares:

-   .. code-block:: console
+  * NIC_100G1_LR4
+  * HANIC_100G1_LR4
+  * HANIC_100G1_SR10

-  rx_ifaces=0x3

-*  ``tx_ifaces``: Defines which transmit channels will be used.
-   For each channel is created one queue. Value is mask for selecting which
-   transmit channels are required. Example:
+Using the SZEDATA2 PMD
+--

-   .. code-block:: console
+From DPDK version 2.3.0 the type of SZEDATA2 PMD is changed to PMD_PDEV.
+SZEDATA2 device is automatically recognized during EAL initialization.
+No special command line options are needed.

-  tx_ifaces=0x3
+Kernel modules have to be loaded before running the DPDK application.

 Example of usage
 
@@ -128,5 +119,39 @@ transmit channel:
 .. code-block:: console

$RTE_TARGET/app/testpmd -c 0xf -n 2 \
-   --vdev 'eth_szedata20,dev_path=/dev/szedataII0,rx_ifaces=0x3,tx_ifaces=0x3' 
\
-   -- --port-topology=chained --rxq=2 --txq=2 --nb-cores=2
+   -- --port-topology=chained --rxq=2 --txq=2 --nb-cores=2 -i -a
+
+Example output:
+
+.. code-block:: console
+
+   [...]
+   EAL: PCI device :06:00.0 on NUMA socket -1
+   EAL:   probe driver: 1b26:c1c1 rte_szedata2_pmd
+   PMD: Initializing szedata2 device (:06:00.0)
+   PMD: SZEDATA2 path: /dev/szedataII0
+   PMD: Available DMA channels RX: 8 TX: 8
+   PMD: resource0 phys_addr = 0xe800 len = 134217728 virt addr = 
7f48f800
+   PMD: szedata2 device (:06:00.0) successfully initialized
+   Interactive-mode selected
+   Auto-start selected
+   Configuring Port 0 (socket 0)
+   Port 0: 00:11:17:00:00:00
+   Checking link statuses...
+   Port 0 Link Up - speed 1 Mbps - full-duplex
+   Done
+   Start automatic packet forwarding
+ io packet forwarding - CRC stripping disabled - packets/burst=32
+ nb forwarding cores=2 - nb forwarding ports=1
+ RX queues=2 - RX desc=128 - RX free threshold=0
+ RX threshold registers: pthresh=0 hthresh=0 wthresh=0
+ TX queues=2 - TX desc=512 - TX free threshold=0
+ TX threshold registers: pthresh=0 hthresh=0 wthresh=0
+ TX RS bit threshold=0 - TXQ flags=0x0
+   testpmd>
+
+.. note::
+
+ 

[dpdk-dev] [PATCH v2] doc: introduce networking driver matrix

2016-03-01 Thread Matej Vido
Hi Thomas,

D?a 27.01.2016 o 21:07 Thomas Monjalon nap?sal(a):
> In order to better compare the drivers and check what is missing
> for a common baseline, we need to fill a matrix.
>
> A CSS trick is used to fit the HTML page.
> The PDF output needs some LaTeX wizardry.
>
> Signed-off-by: Thomas Monjalon 
> ---
> v2: add vector PMDs
> ---
>   doc/guides/nics/index.rst|   1 +
>   doc/guides/nics/overview.rst | 147 
> +++
>   2 files changed, 148 insertions(+)
>   create mode 100644 doc/guides/nics/overview.rst
>
[...]
> +
> +    = = = = = = = = = = = = = = = = = = = = = = = = = = 
> = = = = =
> +   Feature  a b b b c e e i i i i i i i i i i f f m m m n n p r 
> s v v v x
> +f n n o x 1 n 4 4 4 4 g g x x x x m m l l p f u c i 
> z i i m e
> +p x x n g 0 i 0 0 0 0 b b g g g g 1 1 x x i p l a n 
> e r r x n
> +a 2 2 d b 0 c e e e e   v b b b b 0 0 4 5 p   l p g 
> d t t n v
> +c x x i e 0 . v v   f e e e e k k e 
> a i i e i
> +k   v n . f f   . v v   .   
> t o o t r
> +e   f g .   .   . f f   .   
> a   . 3 t
> +t   v   v   v   v   v   
> 2   v
> +e   e   e   e   e
>e
> +c   c   c   c   c
>c
> +    = = = = = = = = = = = = = = = = = = = = = = = = = = 
> = = = = =
[...]
> +   multiprocess aware
Could you please clarify what was meant by this "multiprocess aware" field?

Thanks,
Matej


[dpdk-dev] [PATCH] doc: add szedata2 features into networking driver matrix

2016-03-08 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 doc/guides/nics/overview.rst | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst
index d4c6ff4..177393a 100644
--- a/doc/guides/nics/overview.rst
+++ b/doc/guides/nics/overview.rst
@@ -86,17 +86,17 @@ Most of these differences are summarized below.
 e   e   e   e   e  
 e
 c   c   c   c   c  
 c
 = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = =
-   link status
+   link status  X
link status event
Rx interrupt
-   queue start/stop
+   queue start/stop X
MTU update
jumbo frame
-   scattered Rx
+   scattered Rx X
LRO
TSO
-   promiscuous mode
-   allmulticast mode
+   promiscuous mode X
+   allmulticast modeX
unicast MAC filter
multicast MAC filter
RSS hash
@@ -125,23 +125,23 @@ Most of these differences are summarized below.
inner L4 checksum
packet type parsing
timesync
-   basic stats
+   basic stats  X
extended stats
-   stats per queue
+   stats per queue  X
EEPROM dump
registers dump
multiprocess aware
BSD nic_uio
Linux UIO
Linux VFIO
-   other kdrv
+   other kdrv   X
ARMv7
ARMv8
Power8
TILE-Gx
x86-32
-   x86-64
-   usage doc
+   x86-64   X
+   usage docX
design doc
perf doc
 = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = =
-- 
1.9.1



[dpdk-dev] [PATCH v2 4/5] doc: add documentation for szedata2 PMD

2015-10-27 Thread Matej Vido
Hi Thomas,

thank you for feedback.

2015-10-26 16:09 GMT+01:00 Thomas Monjalon :

> Hi Matej,
>
> Thanks for providing a documentation.
> I'm sorry to give a late feedback and I would like that other contributors
> have reviewed it. There are a lot of PMD developers around. Please help.
>
>
> 2015-09-18 10:32, Matej Vido:
> > +- **libsze2**
> > +
> > +  This library provides API for initialization of sze2 transfers,
> receiving and
> > +  transmitting data segments.
>
> Please provide more information to help installing the dependencies.
>

Dependencies can be installed from RPM packages. I will add those
information in new patch version.


>
> > +SZEDATA2 PMD can be created by passing --vdev= option to EAL in the
> following
> > +format:
> > +
> > +.. code-block:: console
> > +
> > +--vdev
> 'DEVICE_NAME,dev_path=PATH_TO_SZEDATA2_DEVICE,rx_ifaces=RX_MASK,tx_ifaces=TX_MASK'
>
> SZEDATA2 is not a vdev. Is it possible to probe it as a standard PCI
> device?
>
>
 It would be possible to probe it as a standard PCI device, but as this
szedata2 driver uses libsze2 library it needs to pass some parameters to
the library and we thought that using vdev would be the easiest solution.
Is there a way how to provide parameters to pdev driver?
We also work on a new PMD which will eliminate dependencies on kernel
modules and libsze2, and using this PMD COMBO card will be probed as a
standard PCI device.

Best regards,
Matej Vido


[dpdk-dev] [PATCH v2 3/5] szedata2: add handling of scattered packets in TX

2015-10-27 Thread Matej Vido
Hi Thomas,

2015-10-26 15:55 GMT+01:00 Thomas Monjalon :

> Hi Matej,
>
> 2015-09-18 10:32, Matej Vido:
> > - rte_memcpy(tmp_dst,
> > - rte_pktmbuf_mtod(mbuf, const void *),
> > - pkt_len);
> > + if (likely(mbuf_segs == 1)) {
> > + /*
> > +  * non-scattered packet,
> > +  * transmit from one mbuf
> > +  */
> > + rte_memcpy(tmp_dst,
> > + rte_pktmbuf_mtod(mbuf, const void
> *),
> > + pkt_len);
>
> You could avoid this change by keeping "if (likely(mbuf_segs == 1))"
> in the first patch.
> By the way, it seems to be an abusive use of "likely".
>
>
I will edit it in v3. Thanks.

Best regards,
Matej Vido


[dpdk-dev] DPDK 2.2 roadmap

2015-09-14 Thread Matej Vido
Hello Thomas,

CESNET would like to submit new virtual poll mode driver for COMBO-80G and
COMBO-100G cards. This PMD requires libsze2 library and kernel modules
(combov3, szedata2_cv3) to be installed.

We have already sent a patch serie in June
(http://dpdk.org/ml/archives/dev/2015-June/019736.html ), but missed
previous merge window. Now, we are working on a new patchset version with
scattered packets support.

Meanwhile, we have improved the firmware and would like to share the
results of our 
benchmark:https://www.liberouter.org/wp-content/uploads/2015/09/pmd_szedata2_dpdk_measurement-2015-09-11.pdf

Regards,
Matej

Mon, 14 Sep 2015, Thomas Monjalon :

> Thanks for the details.
> The roadmap is updated:
> http://dpdk.org/dev/roadmap
>
> Maybe the keep-alive feature needs some design discussion.
>
> Anyone else to share his plan?
>

--
Matej Vido
CESNET, a. l. e.


[dpdk-dev] DPDK 2.2 roadmap

2015-09-14 Thread Matej Vido
Hi,

2015-09-14 16:02 GMT+02:00 Thomas Monjalon :

> Hi,
>
> 2015-09-14 15:44, Matej Vido:
> > CESNET would like to submit new virtual poll mode driver for COMBO-80G
> and
> > COMBO-100G cards. This PMD requires libsze2 library and kernel modules
> > (combov3, szedata2_cv3) to be installed.
>
> The name of the driver was szedata2, right?
> What is the meaning? Why not having liberouter in its name?
>

SZE is our Straight ZEro copy technology for fast data transfers between
hardware and RAM, 2 is its second version, _cv3 denotes compatibility with
our third generation of FPGA cards. Liberouter is the name of our team,
which does also other, non-hardware stuff.

In the future we want to rewrite this PMD to be independent on sze library
and kernel modules - that could also further improve performance a little.


>
> > We have already sent a patch serie in June
> > (http://dpdk.org/ml/archives/dev/2015-June/019736.html ), but missed
> > previous merge window. Now, we are working on a new patchset version with
> > scattered packets support.
>
> Please try to split the patches in order to ease the review.
> One feature per patch is a good rule.
>
> > Meanwhile, we have improved the firmware and would like to share the
> > results of our benchmark:
> https://www.liberouter.org/wp-content/uploads/2015/09/pmd_szedata2_dpdk_measurement-2015-09-11.pdf
>
> Nice results!
>
> Thanks
>

Regards,
Matej

--
Matej Vido,
CESNET, a. l. e.


[dpdk-dev] [PATCH v2 0/5] Virtual PMD using sze2 layer for COMBO cards

2015-09-18 Thread Matej Vido
This is virtual PMD which communicates with COMBO-80G and COMBO-100G
cards through sze2 layer. Communication with COMBO card is managed
through interface provided by libsze2 library and kernel modules
(combov3, szedata2_cv3).

To compile and use PMD, it is necessary to have libsze2 library installed and
kernel modules (combov3, szedata2_cv3) loaded.
Therefore in default configuration PMD compilation is disabled. To compile
szedata2 PMD, it is necessary to enable CONFIG_RTE_LIBRTE_PMD_SZEDATA2=y.

v2:
code cleanup
add handling scattered packets
update release notes

Matej Vido (5):
  szedata2: add new poll mode driver
  szedata2: add handling of scattered packets in RX
  szedata2: add handling of scattered packets in TX
  doc: add documentation for szedata2 PMD
  doc: update 2.2 release notes

 config/common_bsdapp  |5 +
 config/common_linuxapp|5 +
 doc/guides/nics/index.rst |1 +
 doc/guides/nics/szedata2.rst  |  105 ++
 doc/guides/prog_guide/source_org.rst  |1 +
 doc/guides/rel_notes/release_2_2.rst  |4 +
 drivers/net/Makefile  |1 +
 drivers/net/szedata2/Makefile |   62 +
 drivers/net/szedata2/rte_eth_szedata2.c   | 1638 +
 drivers/net/szedata2/rte_eth_szedata2.h   |   96 ++
 drivers/net/szedata2/rte_pmd_szedata2_version.map |4 +
 mk/rte.app.mk |3 +
 12 files changed, 1925 insertions(+)
 create mode 100644 doc/guides/nics/szedata2.rst
 create mode 100644 drivers/net/szedata2/Makefile
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.c
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.h
 create mode 100644 drivers/net/szedata2/rte_pmd_szedata2_version.map

-- 
1.9.1



[dpdk-dev] [PATCH v2 1/5] szedata2: add new poll mode driver

2015-09-18 Thread Matej Vido
Add virtual PMD which communicates with COMBO cards through sze2
layer using libsze2 library.

Since link_speed is uint16_t, there can not be used number for 100G
speed, therefore link_speed is set to ETH_LINK_SPEED_10G until the
type of link_speed is solved.

v2:
Code cleanup.
Fix error handling by initialization of rx, tx dma channels.
Add uninit function.

Signed-off-by: Matej Vido 
Reviewed-by: Jan Viktorin 
---
 config/common_bsdapp  |5 +
 config/common_linuxapp|5 +
 drivers/net/Makefile  |1 +
 drivers/net/szedata2/Makefile |   62 ++
 drivers/net/szedata2/rte_eth_szedata2.c   | 1212 +
 drivers/net/szedata2/rte_eth_szedata2.h   |   96 ++
 drivers/net/szedata2/rte_pmd_szedata2_version.map |4 +
 mk/rte.app.mk |3 +
 8 files changed, 1388 insertions(+)
 create mode 100644 drivers/net/szedata2/Makefile
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.c
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.h
 create mode 100644 drivers/net/szedata2/rte_pmd_szedata2_version.map

diff --git a/config/common_bsdapp b/config/common_bsdapp
index b37dcf4..d2b6f4f 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -272,6 +272,11 @@ CONFIG_RTE_PMD_RING_MAX_TX_RINGS=16
 CONFIG_RTE_LIBRTE_PMD_PCAP=y

 #
+# Compile software PMD backed by SZEDATA2 device
+#
+CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
+
+#
 # Compile link bonding PMD library
 #
 CONFIG_RTE_LIBRTE_PMD_BOND=y
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 0de43d5..f5963e7 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -270,6 +270,11 @@ CONFIG_RTE_PMD_RING_MAX_TX_RINGS=16
 CONFIG_RTE_LIBRTE_PMD_PCAP=n

 #
+# Compile software PMD backed by SZEDATA2 device
+#
+CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
+
+#
 # Compile link bonding PMD library
 #
 CONFIG_RTE_LIBRTE_PMD_BOND=y
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 5ebf963..7499d1e 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -48,6 +48,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring
 DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += szedata2

 include $(RTE_SDK)/mk/rte.sharelib.mk
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
new file mode 100644
index 000..c3c42e5
--- /dev/null
+++ b/drivers/net/szedata2/Makefile
@@ -0,0 +1,62 @@
+#   BSD LICENSE
+#
+#   Copyright (c) 2015 CESNET
+#   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 CESNET 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.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_szedata2.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+EXPORT_MAP := rte_pmd_szedata2_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += rte_eth_szedata2.c
+
+#
+# Export include files
+#
+SYMLINK-y-include +=
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_malloc
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_kvargs
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/d

[dpdk-dev] [PATCH v2 2/5] szedata2: add handling of scattered packets in RX

2015-09-18 Thread Matej Vido
Add new RX function for handling scattered packets.

Signed-off-by: Matej Vido 
Reviewed-by: Jan Viktorin 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 356 +++-
 1 file changed, 354 insertions(+), 2 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 4db1287..ddb45e4 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -362,6 +362,343 @@ eth_szedata2_rx(void *queue,
 }

 static uint16_t
+eth_szedata2_rx_scattered(void *queue,
+   struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
+{
+   unsigned int i;
+   struct rte_mbuf *mbuf;
+   struct szedata2_rx_queue *sze_q = queue;
+   struct rte_pktmbuf_pool_private *mbp_priv;
+   uint16_t num_rx = 0;
+   uint16_t buf_size;
+   uint16_t sg_size;
+   uint16_t hw_size;
+   uint16_t packet_size;
+   uint64_t num_bytes = 0;
+   struct szedata * sze = sze_q->sze;
+   uint8_t * header_ptr = NULL; /* header of packet */
+   uint8_t * packet_ptr1 = NULL;
+   uint8_t * packet_ptr2 = NULL;
+   uint16_t packet_len1 = 0;
+   uint16_t packet_len2 = 0;
+   uint16_t hw_data_align;
+
+   if (unlikely(sze_q->sze == NULL || nb_pkts == 0)) {
+   return 0;
+   }
+
+   /*
+* Reads the given number of packets from szedata2 channel given
+* by queue and copies the packet data into a newly allocated mbuf
+* to return.
+*/
+   for (i = 0; i < nb_pkts; i++) {
+   const struct szedata_lock * ct_rx_lck_backup;
+   unsigned int ct_rx_rem_bytes_backup;
+   unsigned char * ct_rx_cur_ptr_backup;
+
+   /* get the next sze packet */
+   if (sze->ct_rx_lck != NULL && !sze->ct_rx_rem_bytes &&
+   sze->ct_rx_lck->next == NULL) {
+   /* unlock old data */
+   szedata_rx_unlock_data(sze_q->sze, sze->ct_rx_lck_orig);
+   sze->ct_rx_lck_orig = NULL;
+   sze->ct_rx_lck = NULL;
+   }
+
+   /*
+* Store items from sze structure which can be changed
+* before mbuf allocating. Use these items in case of mbuf
+* allocating failure.
+*/
+   ct_rx_lck_backup = sze->ct_rx_lck;
+   ct_rx_rem_bytes_backup = sze->ct_rx_rem_bytes;
+   ct_rx_cur_ptr_backup = sze->ct_rx_cur_ptr;
+
+   if (!sze->ct_rx_rem_bytes && sze->ct_rx_lck_orig == NULL) {
+   /* nothing to read, lock new data */
+   sze->ct_rx_lck_orig = sze->ct_rx_lck =
+   szedata_rx_lock_data(sze_q->sze, ~0U);
+
+   /*
+* Backup items from sze structure must be updated
+* after locking to contain pointers to new locks.
+*/
+   ct_rx_lck_backup = sze->ct_rx_lck;
+   ct_rx_rem_bytes_backup = sze->ct_rx_rem_bytes;
+   ct_rx_cur_ptr_backup = sze->ct_rx_cur_ptr;
+
+   if (sze->ct_rx_lck == NULL) {
+   /* nothing to lock */
+   break;
+   }
+
+   sze->ct_rx_cur_ptr = sze->ct_rx_lck->start;
+   sze->ct_rx_rem_bytes = sze->ct_rx_lck->len;
+
+   if (!sze->ct_rx_rem_bytes) {
+   break;
+   }
+   }
+
+   if (sze->ct_rx_rem_bytes < RTE_SZE2_PACKET_HEADER_SIZE) {
+   /*
+* cut in header - copy parts of header to merge buffer
+*/
+   if (sze->ct_rx_lck->next == NULL) {
+   break;
+   }
+
+   /* copy first part of header */
+   rte_memcpy(sze->ct_rx_buffer, sze->ct_rx_cur_ptr,
+   sze->ct_rx_rem_bytes);
+
+   /* copy second part of header */
+   sze->ct_rx_lck = sze->ct_rx_lck->next;
+   sze->ct_rx_cur_ptr = sze->ct_rx_lck->start;
+   rte_memcpy(sze->ct_rx_buffer + sze->ct_rx_rem_bytes,
+   sze->ct_rx_cur_ptr,
+   RTE_SZE2_PACKET_HEADER_SIZE -
+   sze->ct_rx_rem_bytes);
+
+   sze->ct_rx_cur_ptr += RTE_SZE2_PACKET_HEADER_SIZE -
+   sze->ct_rx_rem_bytes;
+   

[dpdk-dev] [PATCH v2 3/5] szedata2: add handling of scattered packets in TX

2015-09-18 Thread Matej Vido
TX function modified to handle chained mbufs.

Signed-off-by: Matej Vido 
Reviewed-by: Jan Viktorin 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 108 +++-
 1 file changed, 91 insertions(+), 17 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index ddb45e4..e2d6501 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -737,7 +737,7 @@ eth_szedata2_tx(void *queue,
 next_packet:
mbuf = bufs[nb_pkts - pkt_left];

-   pkt_len = mbuf->data_len;
+   pkt_len = mbuf->pkt_len;
mbuf_segs = mbuf->nb_segs;

hwpkt_len = RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED +
@@ -764,9 +764,28 @@ next_packet:
/* copy packet from mbuf */
tmp_dst = ((uint8_t *)(dst)) +
RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED;
-   rte_memcpy(tmp_dst,
-   rte_pktmbuf_mtod(mbuf, const void *),
-   pkt_len);
+   if (likely(mbuf_segs == 1)) {
+   /*
+* non-scattered packet,
+* transmit from one mbuf
+*/
+   rte_memcpy(tmp_dst,
+   rte_pktmbuf_mtod(mbuf, const void *),
+   pkt_len);
+   } else {
+   /* scattered packet, transmit from more mbufs */
+   struct rte_mbuf * m = mbuf;
+   while (m) {
+   rte_memcpy(tmp_dst,
+   rte_pktmbuf_mtod(m,
+   const void *),
+   m->data_len);
+   tmp_dst = ((uint8_t *)(tmp_dst)) +
+   m->data_len;
+   m = m->next;
+   }
+   }
+

dst = ((uint8_t *)dst) + hwpkt_len;
unlock_size += hwpkt_len;
@@ -805,19 +824,74 @@ next_packet:

tmp_dst = ((uint8_t *)(dst)) +
RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED;
-   /* copy part of packet to first area */
-   rte_memcpy(tmp_dst,
-   rte_pktmbuf_mtod(mbuf, const void *),
-   write_len);
-
-   if (lck->next)
-   dst = lck->next->start;
-
-   /* copy part of packet to second area */
-   rte_memcpy(dst,
-   (const void *) (rte_pktmbuf_mtod(mbuf,
-   const uint8_t *) +
-   write_len), pkt_len - write_len);
+   if (likely(mbuf_segs == 1)) {
+   /*
+* non-scattered packet,
+* transmit from one mbuf
+*/
+   /* copy part of packet to first area */
+   rte_memcpy(tmp_dst,
+   rte_pktmbuf_mtod(mbuf, const void *),
+   write_len);
+
+   if (lck->next)
+   dst = lck->next->start;
+
+   /* copy part of packet to second area */
+   rte_memcpy(dst,
+   (const void *) (rte_pktmbuf_mtod(mbuf,
+   const uint8_t *) +
+   write_len), pkt_len - write_len);
+   } else {
+   /* scattered packet, transmit from more mbufs */
+   struct rte_mbuf * m = mbuf;
+   uint16_t written = 0;
+   uint16_t to_write = 0;
+   bool new_mbuf = true;
+   uint16_t write_off = 0;
+
+   /* copy part of packet to first area */
+   while (m && written < write_len) {
+   to_write = RTE_MIN(m->data_len,
+   write_len - written);
+   rte_memcpy(tmp_dst,
+   

[dpdk-dev] [PATCH v2 4/5] doc: add documentation for szedata2 PMD

2015-09-18 Thread Matej Vido
Signed-off-by: Matej Vido 
Reviewed-by: Jan Viktorin 
---
 doc/guides/nics/index.rst|   1 +
 doc/guides/nics/szedata2.rst | 105 +++
 doc/guides/prog_guide/source_org.rst |   1 +
 3 files changed, 107 insertions(+)
 create mode 100644 doc/guides/nics/szedata2.rst

diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index d1a92f8..fcbf8dd 100644
--- a/doc/guides/nics/index.rst
+++ b/doc/guides/nics/index.rst
@@ -45,6 +45,7 @@ Network Interface Controller Drivers
 ixgbe
 intel_vf
 mlx4
+szedata2
 virtio
 vmxnet3
 pcap_ring
diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
new file mode 100644
index 000..05864c5
--- /dev/null
+++ b/doc/guides/nics/szedata2.rst
@@ -0,0 +1,105 @@
+..  BSD LICENSE
+Copyright 2015 CESNET
+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 CESNET 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.
+
+SZEDATA2 PMD
+
+
+SZEDATA2 PMD is virtual PMD which uses sze2 layer to communicate with COMBO
+cards (COMBO-80G, COMBO-100G) using interface provided by libsze2 library.
+
+.. note::
+
+   This driver has external dependencies. Therefore it is disabled in default
+   configuration files. It can be enabled by setting 
CONFIG_RTE_LIBRTE_PMD_SZEDATA2=y
+   and recompiling.
+
+Prerequisities
+--
+
+This PMD requires kernel modules which are responsible for initialization and
+allocation of resources needed for sze2 layer function. Communication between
+PMD and kernel modules is mediated by libsze2 library. These kernel modules and
+library are not part of DPDK and must be installed separately:
+
+- **libsze2**
+
+  This library provides API for initialization of sze2 transfers, receiving and
+  transmitting data segments.
+
+- **Kernel modules**
+
+  These kernel modules manage initialization of hardware, allocation and 
sharing
+  of resources for user space applications:
+
+  - combov3
+  - szedata2_cv3
+
+Using PMD
+-
+
+SZEDATA2 PMD can be created by passing --vdev= option to EAL in the following
+format:
+
+.. code-block:: console
+
+--vdev 
'DEVICE_NAME,dev_path=PATH_TO_SZEDATA2_DEVICE,rx_ifaces=RX_MASK,tx_ifaces=TX_MASK'
+
+DEVICE_NAME and options dev_path, rx_ifaces, tx_ifaces are mandatory and must
+be separated by commas.
+
+*   DEVICE_NAME: contains prefix eth_szedata2 followed by numbers or letters,
+must be unique for each virtual device
+
+*   dev_path: Defines path to szedata2 device.
+Value is valid path to szedata2 device.
+
+dev_path=/dev/szedataII0
+
+*   rx_ifaces: Defines which receive channels will be used.
+For each channel is created one queue. Value is mask for selecting which
+receive channels are required.
+
+rx_ifaces=0x3
+
+*   tx_ifaces: Defines which transmit channels will be used.
+For each channel is created one queue. Value is mask for selecting which
+transmit channels are required.
+
+tx_ifaces=0x3
+
+Example of usage
+
+
+Read packets from 0. and 1. receive channel and write them to 0. and 1. 
transmit
+channel
+
+.. code-block:: console
+
+$RTE_TARGET/app/testpmd -c 0xf -n 2 --vdev 
'eth_szedata20,dev_path=/dev/szedataII0,rx_ifaces=0x3,tx_ifaces=0x3' -- 
--port-topology=chained --rxq=2 --txq=2 --nb-cores=2
diff --git a/doc/guides/prog_guide/source_org.rst 
b/doc/guides/prog_guide/source_org.rst
index ae11b3b..2393002 100644
--- a/doc/guides/prog_guide/source_org.rst
+++ b/doc/gu

[dpdk-dev] [PATCH v2 5/5] doc: update 2.2 release notes

2015-09-18 Thread Matej Vido
Add szedata2 PMD to 2.2 release notes.

Signed-off-by: Matej Vido 
Reviewed-by: Jan Viktorin 
---
 doc/guides/rel_notes/release_2_2.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 682f468..c78f94d 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -4,6 +4,10 @@ DPDK Release 2.2
 New Features
 

+* **Added virtual szedata2 driver for COMBO cards.**
+
+  Added virtual PMD for COMBO-100G and COMBO-80G cards.
+  PMD is disabled in default configuration.

 Resolved Issues
 ---
-- 
1.9.1



[dpdk-dev] [PATCH v2 4/5] doc: add documentation for szedata2 PMD

2015-11-02 Thread Matej Vido
Hi Thomas,

2015-10-27 19:00 GMT+01:00 Thomas Monjalon :

> 2015-10-27 18:33, Matej Vido:
> > 2015-10-26 16:09 GMT+01:00 Thomas Monjalon :
> > > SZEDATA2 is not a vdev. Is it possible to probe it as a standard PCI
> > > device?
> > >
> > It would be possible to probe it as a standard PCI device, but as this
> > szedata2 driver uses libsze2 library it needs to pass some parameters to
> > the library and we thought that using vdev would be the easiest solution.
> > Is there a way how to provide parameters to pdev driver?
>
> No, but it could be added by working on unifying pdev and vdev.
>
> > We also work on a new PMD which will eliminate dependencies on kernel
> > modules and libsze2, and using this PMD COMBO card will be probed as a
> > standard PCI device.
>
> I think it's better to wait for your new implementation.
> It would be nice to have it in the release 2.2.
> Do you think it could be submitted in the coming weeks?
>


We will not manage to submit the new driver implementation in the release
2.2. Any chance to get this virtual driver into 2.2?

Matej Vido


[dpdk-dev] [PATCH v2 4/5] doc: add documentation for szedata2 PMD

2015-11-06 Thread Matej Vido
Hi John,

Thank you for your comments and advice. I will follow them in the new
version.

Regards,
Matej Vido


2015-10-30 13:16 GMT+01:00 Mcnamara, John :

> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Matej Vido
> > Sent: Friday, September 18, 2015 9:33 AM
> > To: dev at dpdk.org
> > Subject: [dpdk-dev] [PATCH v2 4/5] doc: add documentation for szedata2
> PMD
> >
> > Signed-off-by: Matej Vido 
> > Reviewed-by: Jan Viktorin 
>
> Hi,
>
> Thanks for the new PMD and the documentation.
>
> The DPDJ documentation guidelines provide some guidance on how to format
> and build the DPDK documentation:
>
> http://dpdk.org/doc/guides/contributing/documentation.html
>
> In terms of documentation for a PMD the Mellanox MLX4 docs are a good
> example:
>
> http://dpdk.org/doc/guides/nics/mlx4.html
>
> Some other comments below:
>
>
>
>
> > +SZEDATA2 PMD
> > +
>
> No need for an acronym in the title. Follow the MLX4 example and use
> something like " SZEDATA2 poll mode driver library".
>
>
>
> > +SZEDATA2 PMD is virtual PMD which uses sze2 layer to communicate with
> > +COMBO cards (COMBO-80G, COMBO-100G) using interface provided by libsze2
> > library.
>
> The introduction can be brief but should include enough information to
> explain the PMD for someone encountering it for the first time.
>
> Some links would help with this. See the MLX4 doc as an example:
>
>
> > +
> > +.. note::
> > +
> > +   This driver has external dependencies. Therefore it is disabled in
> > default
> > +   configuration files. It can be enabled by setting
> > CONFIG_RTE_LIBRTE_PMD_SZEDATA2=y
>
> Format configuration items as verbatim text with  double backquotes:``
> CONFIG_RTE_LIBRTE_PMD_SZEDATA2=y ``
>
>
> > +
> > +Using PMD
> > +-
>
> Better: Using the Szedata PMD
>
>
>
> > +
> > +SZEDATA2 PMD can be created by passing --vdev= option to EAL in the
>
> Again format --vdev as ``--vdev``. Also apply to other similar cases.
>
>
>
> > +following format:
> > +
> > +.. code-block:: console
> > +
> > +--vdev
> >
> 'DEVICE_NAME,dev_path=PATH_TO_SZEDATA2_DEVICE,rx_ifaces=RX_MASK,tx_ifaces=
> > TX_MASK'
>
> This code line exceeds 80 chars and will exceed the page width in the PDF
> docs. If possible see if it can be shortened. Maybe use DEVICE instead of
> DEVICE_NAME and PATH instead of PATH_TO. The next section has an
> explanation anyway.
>
>
> > +
> > +DEVICE_NAME and options dev_path, rx_ifaces, tx_ifaces are mandatory
> > +and must be separated by commas.
>
> Use the  quotes again.
>
>
> > +
> > +*   DEVICE_NAME: contains prefix eth_szedata2 followed by numbers or
> > letters,
> > +must be unique for each virtual device
> > +
> > +*   dev_path: Defines path to szedata2 device.
> > +Value is valid path to szedata2 device.
> > +
> > +dev_path=/dev/szedataII0
>
> Code blocks should be prefixed by :: to render them correctly. See the
> guidelines and also view the output from "make doc-guides-html".
>
> Same for the other items below.
>
>
> > +
> > +Example of usage
> > +
>
> The convention is to use ~ for third level headings (see the
> guidelines). However, this could probably be a second level heading.
>
>
> > +
> > +Read packets from 0. and 1. receive channel and write them to 0. and 1.
> > +transmit channel
> > +
> > +.. code-block:: console
> > +
> > +$RTE_TARGET/app/testpmd -c 0xf -n 2 --vdev
> > + 'eth_szedata20,dev_path=/dev/szedataII0,rx_ifaces=0x3,tx_ifaces=0x3'
> > + -- --port-topology=chained --rxq=2 --txq=2 --nb-cores=2
>
>
> Again this code line is >80 chars and won't look good in the PDF. I'd
> suggest the following:
>
> testpmd -c 0xf -n 2 \
>  --vdev 'eth_szedata20,dev_path=/dev/szedataII0,rx_ifaces=3,tx_ifaces=3' \
>  -- --port-topology=chained --rxq=2 --txq=2 --nb-cores=2
>
>
>
> > diff --git a/doc/guides/prog_guide/source_org.rst
> > b/doc/guides/prog_guide/source_org.rst
> > index ae11b3b..2393002 100644
> > --- a/doc/guides/prog_guide/source_org.rst
> > +++ b/doc/guides/prog_guide/source_org.rst
> > @@ -106,6 +106,7 @@ The drivers directory has a *net* subdirectory which
> > contains::
> >  +-- null   # NULL poll mode driver for testing
> >  +-- pcap   # PCAP poll mode driver
> >  +-- ring   # Ring poll mode driver
> > ++-- szedata2   # szedata2 poll mode driver
> >  +-- virtio # Virtio poll mode driver
> >  +-- vmxnet3# VMXNET3 poll mode driver
> >  +-- xenvirt# Xen virtio poll mode driver
>
> It isn't necessary to update this section. It is meant to be
> representative rather than comprehensive (at least to me). However if you
> leave it in then captilize the name like the others.
>
>
> Thanks,
>
> John
>


[dpdk-dev] [PATCH v3 0/6] Virtual PMD using sze2 layer for COMBO cards

2015-11-10 Thread Matej Vido
This is virtual PMD which communicates with COMBO-80G and COMBO-100G
cards through sze2 layer. Communication with COMBO card is managed
through interface provided by libsze2 library and kernel modules
(combov3, szedata2_cv3).

To compile and use PMD, it is necessary to have libsze2 library installed and
kernel modules (combov3, szedata2_cv3) loaded.
Therefore in default configuration PMD compilation is disabled. To compile
szedata2 PMD, it is necessary to enable CONFIG_RTE_LIBRTE_PMD_SZEDATA2=y.

v3:
Fix checkpatch.pl issues.
Edit documentation.
Introduce RX and TX in separate patches.

v2:
code cleanup
add handling scattered packets
update release notes

Matej Vido (6):
  szedata2: add new poll mode driver
  szedata2: add non-scattered RX function
  szedata2: add TX function
  szedata2: add support for scattered packets in RX
  doc: add documentation for szedata2 PMD
  doc: update 2.2 release notes

 config/common_bsdapp  |5 +
 config/common_linuxapp|5 +
 doc/guides/nics/index.rst |1 +
 doc/guides/nics/szedata2.rst  |  127 ++
 doc/guides/prog_guide/source_org.rst  |1 +
 doc/guides/rel_notes/release_2_2.rst  |4 +
 drivers/net/Makefile  |1 +
 drivers/net/szedata2/Makefile |   62 +
 drivers/net/szedata2/rte_eth_szedata2.c   | 1624 +
 drivers/net/szedata2/rte_eth_szedata2.h   |  102 ++
 drivers/net/szedata2/rte_pmd_szedata2_version.map |3 +
 mk/rte.app.mk |3 +
 12 files changed, 1938 insertions(+)
 create mode 100644 doc/guides/nics/szedata2.rst
 create mode 100644 drivers/net/szedata2/Makefile
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.c
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.h
 create mode 100644 drivers/net/szedata2/rte_pmd_szedata2_version.map

-- 
1.9.1



[dpdk-dev] [PATCH v3 1/6] szedata2: add new poll mode driver

2015-11-10 Thread Matej Vido
Add virtual PMD which communicates with COMBO cards through sze2
layer using libsze2 library.

Since link_speed is uint16_t, there can not be used number for 100G
speed, therefore link_speed is set to ETH_LINK_SPEED_10G until the
type of link_speed is solved.

v3:
Fix checkpatch.pl issues.
Move RX, TX functions to separate patches.

v2:
Code cleanup.
Fix error handling by initialization of rx, tx dma channels.
Add uninit function.

Signed-off-by: Matej Vido 
---
 config/common_bsdapp  |   5 +
 config/common_linuxapp|   5 +
 drivers/net/Makefile  |   1 +
 drivers/net/szedata2/Makefile |  62 ++
 drivers/net/szedata2/rte_eth_szedata2.c   | 830 ++
 drivers/net/szedata2/rte_eth_szedata2.h   | 102 +++
 drivers/net/szedata2/rte_pmd_szedata2_version.map |   3 +
 mk/rte.app.mk |   3 +
 8 files changed, 1011 insertions(+)
 create mode 100644 drivers/net/szedata2/Makefile
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.c
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.h
 create mode 100644 drivers/net/szedata2/rte_pmd_szedata2_version.map

diff --git a/config/common_bsdapp b/config/common_bsdapp
index fba29e5..cd856ad 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -284,6 +284,11 @@ CONFIG_RTE_PMD_RING_MAX_TX_RINGS=16
 CONFIG_RTE_LIBRTE_PMD_PCAP=y

 #
+# Compile software PMD backed by SZEDATA2 device
+#
+CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
+
+#
 # Compile link bonding PMD library
 #
 CONFIG_RTE_LIBRTE_PMD_BOND=y
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 7248262..fef5bde 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -282,6 +282,11 @@ CONFIG_RTE_PMD_RING_MAX_TX_RINGS=16
 CONFIG_RTE_LIBRTE_PMD_PCAP=n

 #
+# Compile software PMD backed by SZEDATA2 device
+#
+CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
+
+#
 # Compile link bonding PMD library
 #
 CONFIG_RTE_LIBRTE_PMD_BOND=y
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 6da1ce2..e05d2e5 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -49,6 +49,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring
 DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += szedata2

 include $(RTE_SDK)/mk/rte.sharelib.mk
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
new file mode 100644
index 000..c3c42e5
--- /dev/null
+++ b/drivers/net/szedata2/Makefile
@@ -0,0 +1,62 @@
+#   BSD LICENSE
+#
+#   Copyright (c) 2015 CESNET
+#   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 CESNET 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.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_szedata2.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+EXPORT_MAP := rte_pmd_szedata2_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += rte_eth_szedata2.c
+
+#
+# Export include files
+#
+SYMLINK-y-include +=
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_malloc
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_kvargs
+
+include

[dpdk-dev] [PATCH v3 2/6] szedata2: add non-scattered RX function

2015-11-10 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 235 +++-
 1 file changed, 234 insertions(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 7edaefc..785ac88 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -125,6 +125,239 @@ count_ones(uint32_t num)
return (((num + (num >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; /* count */
 }

+static uint16_t
+eth_szedata2_rx(void *queue,
+   struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
+{
+   unsigned int i;
+   struct rte_mbuf *mbuf;
+   struct szedata2_rx_queue *sze_q = queue;
+   struct rte_pktmbuf_pool_private *mbp_priv;
+   uint16_t num_rx = 0;
+   uint16_t buf_size;
+   uint16_t sg_size;
+   uint16_t hw_size;
+   uint16_t packet_size;
+   uint64_t num_bytes = 0;
+   struct szedata *sze = sze_q->sze;
+   uint8_t *header_ptr = NULL; /* header of packet */
+   uint8_t *packet_ptr1 = NULL;
+   uint8_t *packet_ptr2 = NULL;
+   uint16_t packet_len1 = 0;
+   uint16_t packet_len2 = 0;
+   uint16_t hw_data_align;
+
+   if (unlikely(sze_q->sze == NULL || nb_pkts == 0))
+   return 0;
+
+   /*
+* Reads the given number of packets from szedata2 channel given
+* by queue and copies the packet data into a newly allocated mbuf
+* to return.
+*/
+   for (i = 0; i < nb_pkts; i++) {
+   mbuf = rte_pktmbuf_alloc(sze_q->mb_pool);
+
+   if (unlikely(mbuf == NULL))
+   break;
+
+   /* get the next sze packet */
+   if (sze->ct_rx_lck != NULL && !sze->ct_rx_rem_bytes &&
+   sze->ct_rx_lck->next == NULL) {
+   /* unlock old data */
+   szedata_rx_unlock_data(sze_q->sze, sze->ct_rx_lck_orig);
+   sze->ct_rx_lck_orig = NULL;
+   sze->ct_rx_lck = NULL;
+   }
+
+   if (!sze->ct_rx_rem_bytes && sze->ct_rx_lck_orig == NULL) {
+   /* nothing to read, lock new data */
+   sze->ct_rx_lck = szedata_rx_lock_data(sze_q->sze, ~0U);
+   sze->ct_rx_lck_orig = sze->ct_rx_lck;
+
+   if (sze->ct_rx_lck == NULL) {
+   /* nothing to lock */
+   rte_pktmbuf_free(mbuf);
+   break;
+   }
+
+   sze->ct_rx_cur_ptr = sze->ct_rx_lck->start;
+   sze->ct_rx_rem_bytes = sze->ct_rx_lck->len;
+
+   if (!sze->ct_rx_rem_bytes) {
+   rte_pktmbuf_free(mbuf);
+   break;
+   }
+   }
+
+   if (sze->ct_rx_rem_bytes < RTE_SZE2_PACKET_HEADER_SIZE) {
+   /*
+* cut in header
+* copy parts of header to merge buffer
+*/
+   if (sze->ct_rx_lck->next == NULL) {
+   rte_pktmbuf_free(mbuf);
+   break;
+   }
+
+   /* copy first part of header */
+   rte_memcpy(sze->ct_rx_buffer, sze->ct_rx_cur_ptr,
+   sze->ct_rx_rem_bytes);
+
+   /* copy second part of header */
+   sze->ct_rx_lck = sze->ct_rx_lck->next;
+   sze->ct_rx_cur_ptr = sze->ct_rx_lck->start;
+   rte_memcpy(sze->ct_rx_buffer + sze->ct_rx_rem_bytes,
+   sze->ct_rx_cur_ptr,
+   RTE_SZE2_PACKET_HEADER_SIZE -
+   sze->ct_rx_rem_bytes);
+
+   sze->ct_rx_cur_ptr += RTE_SZE2_PACKET_HEADER_SIZE -
+   sze->ct_rx_rem_bytes;
+   sze->ct_rx_rem_bytes = sze->ct_rx_lck->len -
+   RTE_SZE2_PACKET_HEADER_SIZE +
+   sze->ct_rx_rem_bytes;
+
+   header_ptr = (uint8_t *)sze->ct_rx_buffer;
+   } else {
+   /* not cut */
+   header_ptr = (uint8_t *)sze->ct_rx_cur_ptr;
+   sze->ct_rx_cur_ptr += RTE_SZE2_PACKET_HEADER_SIZE;
+   sze->ct_rx_rem_bytes -= RTE_SZE2_PACKET_HEADER_SIZE;
+   }
+
+   sg_size = le16toh(*((uint16_t *)header_ptr));
+   hw_size = le16to

[dpdk-dev] [PATCH v3 3/6] szedata2: add TX function

2015-11-10 Thread Matej Vido
TX function handles scattered and non-scattered packets.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 216 +++-
 1 file changed, 215 insertions(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 785ac88..3213a20 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -358,6 +358,220 @@ eth_szedata2_rx(void *queue,
return num_rx;
 }

+static uint16_t
+eth_szedata2_tx(void *queue,
+   struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
+{
+   struct rte_mbuf *mbuf;
+   struct szedata2_tx_queue *sze_q = queue;
+   uint16_t num_tx = 0;
+   uint64_t num_bytes = 0;
+
+   const struct szedata_lock *lck;
+   uint32_t lock_size;
+   uint32_t lock_size2;
+   void *dst;
+   uint32_t pkt_len;
+   uint32_t hwpkt_len;
+   uint32_t unlock_size;
+   uint32_t rem_len;
+   uint8_t mbuf_segs;
+   uint16_t pkt_left = nb_pkts;
+
+   if (sze_q->sze == NULL || nb_pkts == 0)
+   return 0;
+
+   while (pkt_left > 0) {
+   unlock_size = 0;
+   lck = szedata_tx_lock_data(sze_q->sze,
+   RTE_ETH_SZEDATA2_TX_LOCK_SIZE,
+   sze_q->tx_channel);
+   if (lck == NULL)
+   continue;
+
+   dst = lck->start;
+   lock_size = lck->len;
+   lock_size2 = lck->next ? lck->next->len : 0;
+
+next_packet:
+   mbuf = bufs[nb_pkts - pkt_left];
+
+   pkt_len = mbuf->pkt_len;
+   mbuf_segs = mbuf->nb_segs;
+
+   hwpkt_len = RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED +
+   RTE_SZE2_ALIGN8(pkt_len);
+
+   if (lock_size + lock_size2 < hwpkt_len) {
+   szedata_tx_unlock_data(sze_q->sze, lck, unlock_size);
+   continue;
+   }
+
+   num_bytes += pkt_len;
+
+   if (lock_size > hwpkt_len) {
+   void *tmp_dst;
+
+   rem_len = 0;
+
+   /* write packet length at first 2 bytes in 8B header */
+   *((uint16_t *)dst) = htole16(
+   RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED +
+   pkt_len);
+   *(((uint16_t *)dst) + 1) = htole16(0);
+
+   /* copy packet from mbuf */
+   tmp_dst = ((uint8_t *)(dst)) +
+   RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED;
+   if (mbuf_segs == 1) {
+   /*
+* non-scattered packet,
+* transmit from one mbuf
+*/
+   rte_memcpy(tmp_dst,
+   rte_pktmbuf_mtod(mbuf, const void *),
+   pkt_len);
+   } else {
+   /* scattered packet, transmit from more mbufs */
+   struct rte_mbuf *m = mbuf;
+   while (m) {
+   rte_memcpy(tmp_dst,
+   rte_pktmbuf_mtod(m,
+   const void *),
+   m->data_len);
+   tmp_dst = ((uint8_t *)(tmp_dst)) +
+   m->data_len;
+   m = m->next;
+   }
+   }
+
+
+   dst = ((uint8_t *)dst) + hwpkt_len;
+   unlock_size += hwpkt_len;
+   lock_size -= hwpkt_len;
+
+   rte_pktmbuf_free(mbuf);
+   num_tx++;
+   pkt_left--;
+   if (pkt_left == 0) {
+   szedata_tx_unlock_data(sze_q->sze, lck,
+   unlock_size);
+   break;
+   }
+   goto next_packet;
+   } else if (lock_size + lock_size2 >= hwpkt_len) {
+   void *tmp_dst;
+   uint16_t write_len;
+
+   /* write packet length at first 2 bytes in 8B header */
+   *((uint16_t *)dst) =
+   htole16(RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED +
+   pkt_len);
+   *(((uint16_t *)dst) + 1) = htole16(0);
+
+   /*
+* If the raw packet (pkt_len)

[dpdk-dev] [PATCH v3 4/6] szedata2: add support for scattered packets in RX

2015-11-10 Thread Matej Vido
Add new RX function for handling scattered packets.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 351 +++-
 1 file changed, 349 insertions(+), 2 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 3213a20..22c99e4 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -359,6 +359,338 @@ eth_szedata2_rx(void *queue,
 }

 static uint16_t
+eth_szedata2_rx_scattered(void *queue,
+   struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
+{
+   unsigned int i;
+   struct rte_mbuf *mbuf;
+   struct szedata2_rx_queue *sze_q = queue;
+   struct rte_pktmbuf_pool_private *mbp_priv;
+   uint16_t num_rx = 0;
+   uint16_t buf_size;
+   uint16_t sg_size;
+   uint16_t hw_size;
+   uint16_t packet_size;
+   uint64_t num_bytes = 0;
+   struct szedata *sze = sze_q->sze;
+   uint8_t *header_ptr = NULL; /* header of packet */
+   uint8_t *packet_ptr1 = NULL;
+   uint8_t *packet_ptr2 = NULL;
+   uint16_t packet_len1 = 0;
+   uint16_t packet_len2 = 0;
+   uint16_t hw_data_align;
+
+   if (unlikely(sze_q->sze == NULL || nb_pkts == 0))
+   return 0;
+
+   /*
+* Reads the given number of packets from szedata2 channel given
+* by queue and copies the packet data into a newly allocated mbuf
+* to return.
+*/
+   for (i = 0; i < nb_pkts; i++) {
+   const struct szedata_lock *ct_rx_lck_backup;
+   unsigned int ct_rx_rem_bytes_backup;
+   unsigned char *ct_rx_cur_ptr_backup;
+
+   /* get the next sze packet */
+   if (sze->ct_rx_lck != NULL && !sze->ct_rx_rem_bytes &&
+   sze->ct_rx_lck->next == NULL) {
+   /* unlock old data */
+   szedata_rx_unlock_data(sze_q->sze, sze->ct_rx_lck_orig);
+   sze->ct_rx_lck_orig = NULL;
+   sze->ct_rx_lck = NULL;
+   }
+
+   /*
+* Store items from sze structure which can be changed
+* before mbuf allocating. Use these items in case of mbuf
+* allocating failure.
+*/
+   ct_rx_lck_backup = sze->ct_rx_lck;
+   ct_rx_rem_bytes_backup = sze->ct_rx_rem_bytes;
+   ct_rx_cur_ptr_backup = sze->ct_rx_cur_ptr;
+
+   if (!sze->ct_rx_rem_bytes && sze->ct_rx_lck_orig == NULL) {
+   /* nothing to read, lock new data */
+   sze->ct_rx_lck = szedata_rx_lock_data(sze_q->sze, ~0U);
+   sze->ct_rx_lck_orig = sze->ct_rx_lck;
+
+   /*
+* Backup items from sze structure must be updated
+* after locking to contain pointers to new locks.
+*/
+   ct_rx_lck_backup = sze->ct_rx_lck;
+   ct_rx_rem_bytes_backup = sze->ct_rx_rem_bytes;
+   ct_rx_cur_ptr_backup = sze->ct_rx_cur_ptr;
+
+   if (sze->ct_rx_lck == NULL)
+   /* nothing to lock */
+   break;
+
+   sze->ct_rx_cur_ptr = sze->ct_rx_lck->start;
+   sze->ct_rx_rem_bytes = sze->ct_rx_lck->len;
+
+   if (!sze->ct_rx_rem_bytes)
+   break;
+   }
+
+   if (sze->ct_rx_rem_bytes < RTE_SZE2_PACKET_HEADER_SIZE) {
+   /*
+* cut in header - copy parts of header to merge buffer
+*/
+   if (sze->ct_rx_lck->next == NULL)
+   break;
+
+   /* copy first part of header */
+   rte_memcpy(sze->ct_rx_buffer, sze->ct_rx_cur_ptr,
+   sze->ct_rx_rem_bytes);
+
+   /* copy second part of header */
+   sze->ct_rx_lck = sze->ct_rx_lck->next;
+   sze->ct_rx_cur_ptr = sze->ct_rx_lck->start;
+   rte_memcpy(sze->ct_rx_buffer + sze->ct_rx_rem_bytes,
+   sze->ct_rx_cur_ptr,
+   RTE_SZE2_PACKET_HEADER_SIZE -
+   sze->ct_rx_rem_bytes);
+
+   sze->ct_rx_cur_ptr += RTE_SZE2_PACKET_HEADER_SIZE -
+   sze->ct_rx_rem_bytes;
+   sze->ct_rx_rem_bytes = sze->ct_rx_lck->len -
+   RTE_SZE2_PACKET_HEADER_SI

[dpdk-dev] [PATCH v3 5/6] doc: add documentation for szedata2 PMD

2015-11-10 Thread Matej Vido
v3:
Edit formatting.
Add links.

Signed-off-by: Matej Vido 
---
 doc/guides/nics/index.rst|   1 +
 doc/guides/nics/szedata2.rst | 127 +++
 doc/guides/prog_guide/source_org.rst |   1 +
 3 files changed, 129 insertions(+)
 create mode 100644 doc/guides/nics/szedata2.rst

diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index 2d4936d..0a0b724 100644
--- a/doc/guides/nics/index.rst
+++ b/doc/guides/nics/index.rst
@@ -46,6 +46,7 @@ Network Interface Controller Drivers
 intel_vf
 mlx4
 mlx5
+szedata2
 virtio
 vmxnet3
 pcap_ring
diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
new file mode 100644
index 000..b952b46
--- /dev/null
+++ b/doc/guides/nics/szedata2.rst
@@ -0,0 +1,127 @@
+..  BSD LICENSE
+Copyright 2015 CESNET
+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 CESNET 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.
+
+SZEDATA2 poll mode driver library
+=
+
+The SZEDATA2 poll mode driver library implements support for cards from COMBO
+family (**COMBO-80G**, **COMBO-100G**).
+The SZEDATA2 PMD is virtual PMD which uses interface provided by libsze2
+library to communicate with COMBO cards over sze2 layer.
+
+More information about family of
+`COMBO cards <https://www.liberouter.org/technologies/cards/>`_
+and used technology
+(`NetCOPE platform <https://www.liberouter.org/technologies/netcope/>`_) can be
+found on the `Liberouter website <https://www.liberouter.org/>`_.
+
+.. note::
+
+   This driver has external dependencies.
+   Therefore it is disabled in default configuration files.
+   It can be enabled by setting ``CONFIG_RTE_LIBRTE_PMD_SZEDATA2=y``
+   and recompiling.
+
+Prerequisities
+--
+
+This PMD requires kernel modules which are responsible for initialization and
+allocation of resources needed for sze2 layer function.
+Communication between PMD and kernel modules is mediated by libsze2 library.
+These kernel modules and library are not part of DPDK and must be installed
+separately:
+
+*  **libsze2 library**
+
+   The library provides API for initialization of sze2 transfers, receiving and
+   transmitting data segments.
+
+*  **Kernel modules**
+
+   * combov3
+   * szedata2_cv3
+
+   Kernel modules manage initialization of hardware, allocation and
+   sharing of resources for user space applications:
+
+Information about getting the dependencies can be found `here
+<https://www.liberouter.org/technologies/netcope/access-to-libsze2-library/>`_.
+
+
+Using the SZEDATA2 PMD
+--
+
+SZEDATA2 PMD can be created by passing ``--vdev=`` option to EAL in the
+following format:
+
+.. code-block:: console
+
+   --vdev 'DEVICE,dev_path=PATH,rx_ifaces=RX_MASK,tx_ifaces=TX_MASK'
+
+``DEVICE`` and options ``dev_path``, ``rx_ifaces``, ``tx_ifaces`` are mandatory
+and must be separated by commas.
+
+*  ``DEVICE``: contains prefix ``eth_szedata2`` followed by numbers or letters,
+   must be unique for each virtual device
+
+*  ``dev_path``: Defines path to szedata2 device.
+   Value is valid path to szedata2 device. Example:
+
+   .. code-block:: console
+
+  dev_path=/dev/szedataII0
+
+*  ``rx_ifaces``: Defines which receive channels will be used.
+   For each channel is created one queue. Value is mask for selecting which
+   receive channels are required. Example:
+
+   .. code-block:: console
+
+  rx_ifaces=0x3
+
+*  ``tx_ifaces``: Defines w

[dpdk-dev] [PATCH v3 6/6] doc: update 2.2 release notes

2015-11-10 Thread Matej Vido
Add szedata2 PMD to 2.2 release notes.

Signed-off-by: Matej Vido 
---
 doc/guides/rel_notes/release_2_2.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index ca8471b..2ae9ba3 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -90,6 +90,10 @@ New Features

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

+* **Added virtual szedata2 driver for COMBO cards.**
+
+  Added virtual PMD for COMBO-100G and COMBO-80G cards.
+  PMD is disabled in default configuration.

 Resolved Issues
 ---
-- 
1.9.1



[dpdk-dev] [PATCH v3 1/6] szedata2: add new poll mode driver

2015-11-20 Thread Matej Vido
Hi,

2015-11-20 16:04 GMT+01:00 Thomas Monjalon :

> Hi,
>
> I'm doing some last checks before merging.
>
> The libsze2 depends on libcommlbr so it would be better to list it on
> https://www.liberouter.org/technologies/netcope/access-to-libsze2-library


Thank you for reminding, I will edit it.


>
>
> A patch is needed in mk/ to allow linking these dependencies from a
> non-standard directory: http://dpdk.org/dev/patchwork/patch/9023
>
> As only 64-bit versions of the libraries are provided, I guess we
> could mention it is currently supported only on x86-64.
>

I agree. Should I update the documentation and send a patch?


>
>
> 2015-11-10 15:18, Matej Vido:
> > +static void
> > +eth_stats_get(struct rte_eth_dev *dev,
> > + struct rte_eth_stats *igb_stats)
> > +{
>
> igb_stats is a name inherited from old times. It is related to the first
> DPDK driver (igb).
> I will rename it to "stats".
>
> [...]
> > +   long int value;
> > +
> > +   value = strtol(mask_str, &endptr, 0);
> > +   if (*endptr != '\0' || value > UINT32_MAX || value < 0)
>
> This check would not compile in 32-bit environment (which is not
> supported).
>
> [...]
> > +static int
> > +rte_eth_from_szedata2(const char *name,
> > +   struct rxtx_szedata2 *szedata2,
> > +   const unsigned numa_node)
> > +{
> > +   struct pmd_internals *internals = NULL;
> > +   struct rte_eth_dev *eth_dev = NULL;
> > +   struct rte_eth_dev_data *data = NULL;
>
> This data variable is not used before the patch 4/6.
> I will move it.
>

Thanks for handling these changes.


Regards,
Matej


[dpdk-dev] [PATCH] szedata2: update documentation

2015-11-24 Thread Matej Vido
Add note to the documentation that only x86_64 versions of the external
libraries are currently provided.

Signed-off-by: Matej Vido 
---
 doc/guides/nics/szedata2.rst | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
index b952b46..e093704 100644
--- a/doc/guides/nics/szedata2.rst
+++ b/doc/guides/nics/szedata2.rst
@@ -49,6 +49,11 @@ found on the `Liberouter website 
<https://www.liberouter.org/>`_.
It can be enabled by setting ``CONFIG_RTE_LIBRTE_PMD_SZEDATA2=y``
and recompiling.

+.. note::
+
+   Currently the driver is supported only on x86_64 architectures.
+   Only x86_64 versions of the external libraries are provided.
+
 Prerequisities
 --

-- 
1.9.1



[dpdk-dev] [PATCH v10 0/8] ethdev: 100G and link speed API refactoring

2016-03-15 Thread Matej Vido
Hi,

patch http://dpdk.org/dev/patchwork/patch/10202/
which was applied to dpdk-next-net/rel_16_04 tree changes filling
of items in rte_eth_link structure for szedata2 driver. These changes
for szedata2 driver are not compliant with changes in this patch series.
I'm not sure how it should be addressed.

Regards,
Matej


D?a 14.03.2016 o 22:55 Thomas Monjalon nap?sal(a):
> Re-spin of the Marc's patchset.
> The first version was sent 10 months ago!
> There are still too few tests and reviews but it is now time to move
> forward with this rework.
> Some issues were remaining in v9 and were difficult to see because it
> was mainly one big patch. That's why I've split it in several steps
> and fixed/reworked some pieces.
> There will be an exception to integrate this feature in 16.04-rc2.
> Please test and review shortly, thanks!
>
> 
>
> This series of patches adds the following capabilities:
>
> * speed_capa bitmap in rte_eth_dev_info, which is filled by the PMDs
>according to the physical device capabilities.
> * refactors link API in ethdev to allow the definition of the advertised
>link speeds, fix speed (no auto-negociation) or advertise all supported
>speeds (default).
>
> WARNING: this patch series, specifically the patch 6/8, is NOT tested for
> most of the drivers.
> Reviewing and testing are required by PMD maintainers.
>
> 
>
> Marc Sune (6):
>ethdev: use constants for link duplex
>app/testpmd: move speed and duplex parsing in a function
>ethdev: rename link speed constants
>ethdev: add speed capabilities
>ethdev: redesign link speed config
>ethdev: convert speed number to bitmap flag
>
> Thomas Monjalon (2):
>ethdev: use constants for link state
>ethdev: add 100G link speed
>
> v10:
>  - rebase
>  - rework release notes
>  - rearrange patch splitting
>  - fix doxygen comments
>  - fix typos
>  - removed log format of link.link_speed as %d (keep %u)
>  - complete ETH_LINK_[DOWN/UP] replacement from 0/1
>  - change ETH_LINK_SPEED_AUTONEG to 1
>  - replace ETH_LINK_SPEED_NEG by ETH_LINK_SPEED_AUTONEG (1)
>  - replace ETH_LINK_SPEED_NO_AUTONEG by ETH_LINK_SPEED_FIXED (0)
>  - rework rte_eth_speed_to_bm_flag to rte_eth_speed_bitflag
>  - complete 100G support in testpmd
>
> v9: rebased to current HEAD. Reverted numeric speed to 32 bit in struct
>  rte_eth_link (no atomic link get > 64bit). Fixed mlx5 driver compilation
>  and link speeds. Moved documentation to release_16_04.rst and fixed 
> several
>  issues. Upgrade NIC notes with speed capabilities.
>
> v8: Rebased to current HEAD. Modified em driver impl. to not touch base files.
>  Merged patch 5 into 3 (map file). Changed numeric speed to a 64 bit 
> value.
>  Filled-in speed capabilities for drivers bnx2x, cxgbe, mlx5 and nfp in
>  addition to the ones of previous patch sets.
>
> v7: Rebased to current HEAD. Moved documentation to v2.3. Still needs testing
>  from PMD maintainers.
>
> v6: Move link_duplex to be part of bitfield. Fixed i40 autoneg flag link
>  update code. Added rte_eth_speed_to_bm_flag() to .map file. Fixed other
>  spelling issues. Rebased to current HEAD.
>
> v5: revert to v2 speed capabilities patch. Fixed MLX4 speed capabilities
>  (thanks N. Laranjeiro). Refactored link speed API to allow setting
>  advertised speeds (3/4). Added NO_AUTONEG option to explicitely disable
>  auto-negociation. Updated 2.2 rel. notes (4/4). Rebased to current HEAD.
>
> v4: fixed errata in the documentation of field speeds of rte_eth_conf, and
>  commit 1/2 message. rebased to v2.1.0. v3 was incorrectly based on
>  ~2.1.0-rc1.
>
> v3: rebase to v2.1. unified ETH_LINK_SPEED and ETH_SPEED_CAP into ETH_SPEED.
>  Converted field speed in struct rte_eth_conf to speed, to allow a bitmap
>  for defining the announced speeds, as suggested M. Brorup. Fixed spelling
>  issues.
>
> v2: rebase, converted speed_capa into 32 bits bitmap, fixed alignment
>  (checkpatch).
>
>
>   app/test-pipeline/init.c   |   2 +-
>   app/test-pmd/cmdline.c | 125 
> ++---
>   app/test-pmd/testpmd.c |   2 +-
>   app/test/test_pmd_perf.c   |   2 +-
>   app/test/virtual_pmd.c |   8 +-
>   doc/guides/nics/overview.rst   |   1 +
>   doc/guides/rel_notes/release_16_04.rst |  22 
>   doc/guides/testpmd_app_ug/testpmd_funcs.rst|   2 +-
>   drivers/net/af_packet/rte_eth_af_packet.c  |   9 +-
>   drivers/net/bnx2x/bnx2x_ethdev.c   |   7 +-
>   drivers/net/bnx2x/elink.c  |   2 +-
>   drivers/net/bonding/rte_eth_bond_8023ad.c  |  14 +--
>   drivers/net/bonding/rte_eth_bond_api.c |   4 +-
>   drivers/net/bonding/rte_eth_bond_pmd.c |  12 +-
>   dri

[dpdk-dev] [PATCH v10 0/8] ethdev: 100G and link speed API refactoring

2016-03-15 Thread Matej Vido
D?a 15.03.2016 o 08:12 Thomas Monjalon nap?sal(a):
> 2016-03-15 01:04, Matej Vido:
>> Hi,
>>
>> patch http://dpdk.org/dev/patchwork/patch/10202/
>> which was applied to dpdk-next-net/rel_16_04 tree changes filling
>> of items in rte_eth_link structure for szedata2 driver. These changes
>> for szedata2 driver are not compliant with changes in this patch series.
>> I'm not sure how it should be addressed.
> The branch dpdk-next-net/rel_16_04 is going to be rebased for RC1 integration.
> This series targets RC2.
> Please prepare a patch to replace the szedata2 changes of this patch, and
> it will be merged in the series for a v11.
> Thanks
Ok, I'll do.

Regards,
Matej


[dpdk-dev] [PATCH 0/4] szedata2: 100G and link speed API refactoring

2016-03-15 Thread Matej Vido
This patch series adds link speed API changes to szedata2 driver
based on current dpdk-next-net/rel_16_04 tree.
Changes are split into commits as in v10 of patch series:
http://dpdk.org/ml/archives/dev/2016-March/035731.html


Matej Vido (4):
  szedata2: use constants for link state
  szedata2: rename link speed constants
  szedata2: redesign link speed config
  szedata2: add 100G link speed

 drivers/net/szedata2/rte_eth_szedata2.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

-- 
1.9.1



[dpdk-dev] [PATCH 1/4] szedata2: use constants for link state

2016-03-15 Thread Matej Vido
Use ETH_LINK_UP and ETH_LINK_DOWN constants.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 81c806e..c65067e 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1172,7 +1172,7 @@ eth_link_update(struct rte_eth_dev *dev,
link.link_duplex = ETH_LINK_FULL_DUPLEX;

link.link_status = (cgmii_ibuf_is_enabled(ibuf) &&
-   cgmii_ibuf_is_link_up(ibuf)) ? 1 : 0;
+   cgmii_ibuf_is_link_up(ibuf)) ? ETH_LINK_UP : 
ETH_LINK_DOWN;

rte_atomic64_cmpset((uint64_t *)dev_link, *(uint64_t *)dev_link,
*(uint64_t *)link_ptr);
-- 
1.9.1



[dpdk-dev] [PATCH 2/4] szedata2: rename link speed constants

2016-03-15 Thread Matej Vido
The speed numbers ETH_LINK_SPEED_ are renamed ETH_SPEED_NUM_.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index c65067e..854cb5c 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1149,10 +1149,10 @@ eth_link_update(struct rte_eth_dev *dev,

switch (cgmii_link_speed(ibuf)) {
case SZEDATA2_LINK_SPEED_10G:
-   link.link_speed = ETH_LINK_SPEED_10G;
+   link.link_speed = ETH_SPEED_NUM_10G;
break;
case SZEDATA2_LINK_SPEED_40G:
-   link.link_speed = ETH_LINK_SPEED_40G;
+   link.link_speed = ETH_SPEED_NUM_40G;
break;
case SZEDATA2_LINK_SPEED_100G:
/*
@@ -1161,10 +1161,10 @@ eth_link_update(struct rte_eth_dev *dev,
 * will be changed to support 100Gbps speed change
 * this value to 100G.
 */
-   link.link_speed = ETH_LINK_SPEED_10G;
+   link.link_speed = ETH_SPEED_NUM_10G;
break;
default:
-   link.link_speed = ETH_LINK_SPEED_10G;
+   link.link_speed = ETH_SPEED_NUM_10G;
break;
}

-- 
1.9.1



[dpdk-dev] [PATCH 3/4] szedata2: redesign link speed config

2016-03-15 Thread Matej Vido
This patch sets value of flag link_autoneg in struct rte_eth_link
to ETH_LINK_SPEED_FIXED.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 854cb5c..0708e4a 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1174,6 +1174,8 @@ eth_link_update(struct rte_eth_dev *dev,
link.link_status = (cgmii_ibuf_is_enabled(ibuf) &&
cgmii_ibuf_is_link_up(ibuf)) ? ETH_LINK_UP : 
ETH_LINK_DOWN;

+   link.link_autoneg = ETH_LINK_SPEED_FIXED;
+
rte_atomic64_cmpset((uint64_t *)dev_link, *(uint64_t *)dev_link,
*(uint64_t *)link_ptr);

-- 
1.9.1



[dpdk-dev] [PATCH 4/4] szedata2: add 100G link speed

2016-03-15 Thread Matej Vido
Temporary 10G constant is replaced with 100G constant.
Item speed_capa from struct rte_eth_dev_info is set with 100G flag.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 0708e4a..f1855a5 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1036,6 +1036,7 @@ eth_dev_info(struct rte_eth_dev *dev,
dev_info->max_rx_queues = internals->max_rx_queues;
dev_info->max_tx_queues = internals->max_tx_queues;
dev_info->min_rx_bufsize = 0;
+   dev_info->speed_capa = ETH_LINK_SPEED_100G;
 }

 static void
@@ -1161,7 +1162,7 @@ eth_link_update(struct rte_eth_dev *dev,
 * will be changed to support 100Gbps speed change
 * this value to 100G.
 */
-   link.link_speed = ETH_SPEED_NUM_10G;
+   link.link_speed = ETH_SPEED_NUM_100G;
break;
default:
link.link_speed = ETH_SPEED_NUM_10G;
-- 
1.9.1



[dpdk-dev] [PATCH 4/4] szedata2: add 100G link speed

2016-03-15 Thread Matej Vido


D?a 15.03.2016 o 14:41 Thomas Monjalon nap?sal(a):
> Thanks for the series completing the ethdev rework with the same splitting.
>
> 2016-03-15 14:12, Matej Vido:
>> Temporary 10G constant is replaced with 100G constant.
>> Item speed_capa from struct rte_eth_dev_info is set with 100G flag.
> [...]
>> @@ -1161,7 +1162,7 @@ eth_link_update(struct rte_eth_dev *dev,
>>   * will be changed to support 100Gbps speed change
>>   * this value to 100G.
>>   */
>> -link.link_speed = ETH_SPEED_NUM_10G;
>> +link.link_speed = ETH_SPEED_NUM_100G;
> Shouldn't we remove the above comment?
Yes, I forgot


[dpdk-dev] [PATCH 4/4] szedata2: add 100G link speed

2016-03-15 Thread Matej Vido


D?a 15.03.2016 o 14:41 Thomas Monjalon nap?sal(a):
> Thanks for the series completing the ethdev rework with the same splitting.
>
> 2016-03-15 14:12, Matej Vido:
>> Temporary 10G constant is replaced with 100G constant.
>> Item speed_capa from struct rte_eth_dev_info is set with 100G flag.
> [...]
>> @@ -1161,7 +1162,7 @@ eth_link_update(struct rte_eth_dev *dev,
>>   * will be changed to support 100Gbps speed change
>>   * this value to 100G.
>>   */
>> -link.link_speed = ETH_SPEED_NUM_10G;
>> +link.link_speed = ETH_SPEED_NUM_100G;
> Shouldn't we remove the above comment?
Yes, I forgot. Should I remove the comment and send again or could you 
do it when merging with original series?

Matej


[dpdk-dev] [PATCH v11 0/8] ethdev: 100G and link speed API refactoring

2016-03-24 Thread Matej Vido
D?a 17.03.2016 o 19:08 Thomas Monjalon nap?sal(a):
> There are still too few tests and reviews, especially for
> autonegotiation with Intel devices (patch #6).
> I would not be surprised to see some bugs in this rework.
>
> The capabilities must be adapted per device. It can be
> improved in a separate patch.
>
> It will be integrated in 16.04-rc2.
> Please test and review shortly, thanks!
>
> [...]
Tested-by: Matej Vido 

Correct speed is displayed for COMBO-100G card.

Regards,
Matej


[dpdk-dev] [PATCH 1/2] szedata2: new poll mode driver

2016-03-24 Thread Matej Vido
D?a 21.03.2016 o 18:45 Stephen Hemminger nap?sal(a):
> On Fri, 19 Jun 2015 10:25:00 +0200
> Matej Vido  wrote:
>
>> +static struct ether_addr eth_addr = {
>> +.addr_bytes = { 0, 0, 0, 0x1, 0x2, 0x3 }
>> +};
> ...
>
>> static int
>> rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
>> {
> ..
>>  /* Allocate space for one mac address */
>>  data->mac_addrs = rte_zmalloc(data->name, sizeof(struct ether_addr),
>>  RTE_CACHE_LINE_SIZE);
>>  if (data->mac_addrs == NULL) {
>>  RTE_LOG(ERR, PMD, "Could not alloc space for MAC address!\n");
>>  munmap(dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER].addr,
>>  dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER].len);
>>  return -EINVAL;
>>  }
>>
>>  ether_addr_copy(ð_addr, data->mac_addrs);
> If your hardware has no permanent MAC address, then please use 
> eth_random_addr()
> to make one on boot, rather than having a bogus static value.
Hi,

I will use it.

Thanks,
Matej


[dpdk-dev] [RFC] drivers: advertise kmod dependencies in pmdinfo

2016-08-30 Thread Matej Vido
On 26.08.2016 15:20, Olivier Matz wrote:

> Add a new macro DRIVER_REGISTER_KMOD_DEP() that allows a driver to
> declare the list of kernel modules required to run properly.
>
> Today, most PCI drivers require uio/vfio.
>
> Signed-off-by: Olivier Matz 
> ---
>
> In this RFC, I supposed that all PCI drivers require a the loading of a
> uio/vfio module (except mlx*), this may be wrong.
> Comments are welcome!
>
>
>   buildtools/pmdinfogen/pmdinfogen.c  |  1 +
>   buildtools/pmdinfogen/pmdinfogen.h  |  1 +
>   drivers/crypto/qat/rte_qat_cryptodev.c  |  2 ++
>   drivers/net/bnx2x/bnx2x_ethdev.c|  4 
>   drivers/net/bnxt/bnxt_ethdev.c  |  2 ++
>   drivers/net/cxgbe/cxgbe_ethdev.c|  2 ++
>   drivers/net/e1000/em_ethdev.c   |  2 ++
>   drivers/net/e1000/igb_ethdev.c  |  4 
>   drivers/net/ena/ena_ethdev.c|  2 ++
>   drivers/net/enic/enic_ethdev.c  |  2 ++
>   drivers/net/fm10k/fm10k_ethdev.c|  2 ++
>   drivers/net/i40e/i40e_ethdev.c  |  2 ++
>   drivers/net/i40e/i40e_ethdev_vf.c   |  2 ++
>   drivers/net/ixgbe/ixgbe_ethdev.c|  4 
>   drivers/net/mlx4/mlx4.c |  2 ++
>   drivers/net/mlx5/mlx5.c |  3 +++
>   drivers/net/nfp/nfp_net.c   |  2 ++
>   drivers/net/qede/qede_ethdev.c  |  4 
>   drivers/net/szedata2/rte_eth_szedata2.c |  2 ++
>   drivers/net/thunderx/nicvf_ethdev.c |  2 ++
>   drivers/net/virtio/virtio_ethdev.c  |  2 ++
>   drivers/net/vmxnet3/vmxnet3_ethdev.c|  2 ++
>   lib/librte_eal/common/include/rte_dev.h | 14 ++
>   tools/dpdk-pmdinfo.py   |  5 -
>   24 files changed, 69 insertions(+), 1 deletion(-)
>
> diff --git a/buildtools/pmdinfogen/pmdinfogen.c 
> b/buildtools/pmdinfogen/pmdinfogen.c
> index e1bf2e4..1e5b6f3 100644
> --- a/buildtools/pmdinfogen/pmdinfogen.c
> +++ b/buildtools/pmdinfogen/pmdinfogen.c
> @@ -269,6 +269,7 @@ struct opt_tag {
>   
>   static const struct opt_tag opt_tags[] = {
>   {"_param_string_export", "params"},
> + {"_kmod_dep_export", "kmod"},
>   };
>   
>   static int complete_pmd_entry(struct elf_info *info, struct pmd_driver *drv)
> diff --git a/buildtools/pmdinfogen/pmdinfogen.h 
> b/buildtools/pmdinfogen/pmdinfogen.h
> index 1da2966..2fab2aa 100644
> --- a/buildtools/pmdinfogen/pmdinfogen.h
> +++ b/buildtools/pmdinfogen/pmdinfogen.h
> @@ -85,6 +85,7 @@ else \
>   
>   enum opt_params {
>   PMD_PARAM_STRING = 0,
> + PMD_KMOD_DEP,
>   PMD_OPT_MAX
>   };
[..]
>   
>
> diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
> b/drivers/net/szedata2/rte_eth_szedata2.c
> index 483d789..409e71f 100644
> --- a/drivers/net/szedata2/rte_eth_szedata2.c
> +++ b/drivers/net/szedata2/rte_eth_szedata2.c
> @@ -1602,3 +1602,5 @@ static struct rte_driver rte_szedata2_driver = {
>   
>   PMD_REGISTER_DRIVER(rte_szedata2_driver, RTE_SZEDATA2_DRIVER_NAME);
>   DRIVER_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, 
> rte_szedata2_pci_id_table);
> +DRIVER_REGISTER_KMOD_DEP(RTE_SZEDATA2_DRIVER_NAME,
> + "uio,igb_uio:uio,uio_pci_generic:vfio,vfio-pci");
Hi Olivier,

szedata2 doesn't require uio/vfio modules. Instead the following lines 
could be used:

+DRIVER_REGISTER_KMOD_DEP(RTE_SZEDATA2_DRIVER_NAME,
+   "combo6core,combov3,szedata2,szedata2_cv3");


Thanks,
Matej

[..]
> diff --git a/lib/librte_eal/common/include/rte_dev.h 
> b/lib/librte_eal/common/include/rte_dev.h
> index 95789f9..b721dc3 100644
> --- a/lib/librte_eal/common/include/rte_dev.h
> +++ b/lib/librte_eal/common/include/rte_dev.h
> @@ -203,6 +203,20 @@ RTE_STR(table)
>   static const char DRV_EXP_TAG(name, param_string_export)[] \
>   __attribute__((used)) = str
>   
> +/**
> + * Advertise the list of kernel modules required to run this driver
> + *
> + * This string list the name of kernel modules, separated by commas. The
> + * order is important. If several modules lists are possible, they are
> + * separated by colons.
> + *
> + * Example: "uio,igb_uio:uio,uio_pci_generic" means either "uio,igb_uio"
> + * or "uio,uio_pci_generic".
> + */
> +#define DRIVER_REGISTER_KMOD_DEP(name, str) \
> +static const char DRV_EXP_TAG(name, kmod_dep_export)[] \
> +__attribute__((used)) = str
> +
>   #ifdef __cplusplus
>   }
>   #endif
> diff --git a/tools/dpdk-pmdinfo.py b/tools/dpdk-pmdinfo.py
> index 3db9819..17bfed4 100755
> --- a/tools/dpdk-pmdinfo.py
> +++ b/tools/dpdk-pmdinfo.py
> @@ -312,7 +312,10 @@ class ReadElf(object):
>   global raw_output
>   global pcidb
>   
> -optional_pmd_info = [{'id': 'params', 'tag': 'PMD PARAMETERS'}]
> +optional_pmd_info = [
> +{'id': 'params', 'tag': 'PMD PARAMETERS'},
> +{'id': 'kmod', 'tag': 'PMD KMOD DEPENDENCIES'}
> +]
>   
>   i = mystring.index("=")
>   mystring = mystring[i + 2:]



[dpdk-dev] [PATCH v8 3/4] ethdev: redesign link speed config API

2016-02-16 Thread Matej Vido
D?a 14.02.2016 o 23:17 Marc Sune nap?sal(a):
> This patch redesigns the API to set the link speed/s configure
> for an ethernet port. Specifically:
>
> - it allows to define a set of advertised speeds for
>auto-negociation.
> - it allows to disable link auto-negociation (single fixed speed).
> - default: auto-negociate all supported speeds.
>
> Other changes:
>
> * Added utility MACROs ETH_SPEED_NUM_XXX with the numeric
>values of all supported link speeds, in Mbps.
> * Converted link_speed to uint64_t to accomodate 100G speeds
>and beyond (bug).
> * Added autoneg flag in struct rte_eth_link to indicate if
>link speed was a result of auto-negociation or was fixed
>by configuration.
> * Added utility function to convert numeric speeds to bitmap
>fields.
> * Added rte_eth_speed_to_bm_flag() to version map.
>
> Signed-off-by: Marc Sune 
> ---
>   app/test-pipeline/init.c  |   2 +-
>   app/test-pmd/cmdline.c| 124 
> +++---
>   app/test-pmd/config.c |   4 +-
>   app/test/virtual_pmd.c|   4 +-
>   drivers/net/af_packet/rte_eth_af_packet.c |   5 +-
>   drivers/net/bnx2x/bnx2x_ethdev.c  |   8 +-
>   drivers/net/bonding/rte_eth_bond_8023ad.c |  14 ++--
>   drivers/net/cxgbe/base/t4_hw.c|   8 +-
>   drivers/net/cxgbe/cxgbe_ethdev.c  |   2 +-
>   drivers/net/e1000/em_ethdev.c | 116 ++--
>   drivers/net/e1000/igb_ethdev.c| 111 +-
>   drivers/net/fm10k/fm10k_ethdev.c  |   8 +-
>   drivers/net/i40e/i40e_ethdev.c|  73 +-
>   drivers/net/i40e/i40e_ethdev_vf.c |  11 +--
>   drivers/net/ixgbe/ixgbe_ethdev.c  |  78 ---
>   drivers/net/mlx4/mlx4.c   |   6 +-
>   drivers/net/mpipe/mpipe_tilegx.c  |   6 +-
>   drivers/net/nfp/nfp_net.c |   4 +-
>   drivers/net/null/rte_eth_null.c   |   5 +-
>   drivers/net/pcap/rte_eth_pcap.c   |   9 ++-
>   drivers/net/ring/rte_eth_ring.c   |   5 +-
>   drivers/net/virtio/virtio_ethdev.c|   2 +-
>   drivers/net/virtio/virtio_ethdev.h|   2 -
>   drivers/net/vmxnet3/vmxnet3_ethdev.c  |   5 +-
>   drivers/net/xenvirt/rte_eth_xenvirt.c |   5 +-
>   examples/ip_pipeline/config_parse.c   |   3 +-
>   lib/librte_ether/rte_ethdev.c |  49 
>   lib/librte_ether/rte_ethdev.h | 113 +--
>   lib/librte_ether/rte_ether_version.map|   6 ++
>   29 files changed, 443 insertions(+), 345 deletions(-)
>
> [...]

Hi,

some drivers (at least: e1000, i40e, ixgbe, mpipe, nfp, virtio, vmxnet3) 
use rte_atomic64_cmpset() to read and write link state like:

static inline int
rte_em_dev_atomic_read_link_status(struct rte_eth_dev *dev,
 struct rte_eth_link *link)
{
 struct rte_eth_link *dst = link;
 struct rte_eth_link *src = &(dev->data->dev_link);

 if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
 *(uint64_t *)src) == 0)
 return -1;

 return 0;
}

static inline int
rte_em_dev_atomic_write_link_status(struct rte_eth_dev *dev,
 struct rte_eth_link *link)
{
 struct rte_eth_link *dst = &(dev->data->dev_link);
 struct rte_eth_link *src = link;

 if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
 *(uint64_t *)src) == 0)
 return -1;

 return 0;
}


When link_speed is changed to uint64_t, struct rte_eth_link exceeds 64 
bits. Shouldn't these functions be adapted in this patch series?

Szedata2 PMD will also use rte_atomic64_cmpset() after patch [1].
I can take care of this change in szedata2 PMD when patch [1] is 
accepted together with adjusting speeds in szedata2 PMD.

[1] http://dpdk.org/ml/archives/dev/2016-January/032281.html

Regards,
Matej


[dpdk-dev] [PATCH 0/2] Virtual PMD using sze2 layer for COMBO cards

2015-06-19 Thread Matej Vido
This is virtual PMD which communicates with COMBO-80G and COMBO-100G
cards through sze2 layer. Communication with COMBO card is managed
through interface provided by libsze2 library and kernel modules
(combov3, szedata2_cv3).

To compile and use PMD, it is necessary to have libsze2 library installed and 
kernel modules (combov3, szedata2_cv3) loaded.
Therefore in default configuration PMD compilation is disabled. To compile
szedata2 PMD, it is necessary to enable CONFIG_RTE_LIBRTE_PMD_SZEDATA2=y.

We have done performance measurement. Results are available in pdf file:
https://www.liberouter.org/wp-content/uploads/2015/06/pmd_szedata2_dpdk_measurement.pdf

Measurement was not done with final version of firmware. Performance will
be increased soon with new firmware version.

Matej Vido (2):
  szedata2: new poll mode driver
  doc: added documentation for szedata2 PMD

 config/common_bsdapp  |5 +
 config/common_linuxapp|5 +
 doc/guides/nics/index.rst |1 +
 doc/guides/nics/szedata2.rst  |  105 ++
 doc/guides/prog_guide/source_org.rst  |1 +
 drivers/net/Makefile  |1 +
 drivers/net/szedata2/Makefile |   62 ++
 drivers/net/szedata2/rte_eth_szedata2.c   | 1120 +
 drivers/net/szedata2/rte_eth_szedata2.h   |   96 ++
 drivers/net/szedata2/rte_pmd_szedata2_version.map |4 +
 mk/rte.app.mk |3 +
 11 files changed, 1403 insertions(+)
 create mode 100644 doc/guides/nics/szedata2.rst
 create mode 100644 drivers/net/szedata2/Makefile
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.c
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.h
 create mode 100644 drivers/net/szedata2/rte_pmd_szedata2_version.map

-- 
Matej Vido
Software Developer
CESNET, a. l. e.



[dpdk-dev] [PATCH 1/2] szedata2: new poll mode driver

2015-06-19 Thread Matej Vido
Added virtual PMD which communicates with COMBO cards through sze2
layer using libsze2 library.

Signed-off-by: Matej Vido 
---
 config/common_bsdapp  |5 +
 config/common_linuxapp|5 +
 drivers/net/Makefile  |1 +
 drivers/net/szedata2/Makefile |   62 ++
 drivers/net/szedata2/rte_eth_szedata2.c   | 1120 +
 drivers/net/szedata2/rte_eth_szedata2.h   |   96 ++
 drivers/net/szedata2/rte_pmd_szedata2_version.map |4 +
 mk/rte.app.mk |3 +
 8 files changed, 1296 insertions(+)
 create mode 100644 drivers/net/szedata2/Makefile
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.c
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.h
 create mode 100644 drivers/net/szedata2/rte_pmd_szedata2_version.map

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 0b169c8..d5f5970 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -249,6 +249,11 @@ CONFIG_RTE_PMD_RING_MAX_TX_RINGS=16
 CONFIG_RTE_LIBRTE_PMD_PCAP=y

 #
+# Compile software PMD backed by SZEDATA2 device
+#
+CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
+
+#
 # Compile link bonding PMD library
 #
 CONFIG_RTE_LIBRTE_PMD_BOND=y
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 5deb55a..3bec728 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -246,6 +246,11 @@ CONFIG_RTE_PMD_RING_MAX_TX_RINGS=16
 CONFIG_RTE_LIBRTE_PMD_PCAP=n

 #
+# Compile software PMD backed by SZEDATA2 device
+#
+CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
+
+#
 # Compile link bonding PMD library
 #
 CONFIG_RTE_LIBRTE_PMD_BOND=y
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 1e6648a..3312b13 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -45,6 +45,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring
 DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += szedata2

 include $(RTE_SDK)/mk/rte.sharelib.mk
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
new file mode 100644
index 000..c3c42e5
--- /dev/null
+++ b/drivers/net/szedata2/Makefile
@@ -0,0 +1,62 @@
+#   BSD LICENSE
+#
+#   Copyright (c) 2015 CESNET
+#   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 CESNET 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.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_szedata2.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+EXPORT_MAP := rte_pmd_szedata2_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += rte_eth_szedata2.c
+
+#
+# Export include files
+#
+SYMLINK-y-include +=
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_malloc
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_kvargs
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
new file mode 100644
index 000..cb3b2a2
--- /dev/null
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -0,0 +1,1120 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright (c) 2015 CESNET
+ *   All right

[dpdk-dev] [PATCH 2/2] doc: added documentation for szedata2 PMD

2015-06-19 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 doc/guides/nics/index.rst|   1 +
 doc/guides/nics/szedata2.rst | 105 +++
 doc/guides/prog_guide/source_org.rst |   1 +
 3 files changed, 107 insertions(+)
 create mode 100644 doc/guides/nics/szedata2.rst

diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index 1ee67fa..4218f90 100644
--- a/doc/guides/nics/index.rst
+++ b/doc/guides/nics/index.rst
@@ -44,6 +44,7 @@ Network Interface Controller Drivers
 ixgbe
 intel_vf
 mlx4
+szedata2
 virtio
 vmxnet3
 pcap_ring
diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
new file mode 100644
index 000..05864c5
--- /dev/null
+++ b/doc/guides/nics/szedata2.rst
@@ -0,0 +1,105 @@
+..  BSD LICENSE
+Copyright 2015 CESNET
+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 CESNET 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.
+
+SZEDATA2 PMD
+
+
+SZEDATA2 PMD is virtual PMD which uses sze2 layer to communicate with COMBO
+cards (COMBO-80G, COMBO-100G) using interface provided by libsze2 library.
+
+.. note::
+
+   This driver has external dependencies. Therefore it is disabled in default
+   configuration files. It can be enabled by setting 
CONFIG_RTE_LIBRTE_PMD_SZEDATA2=y
+   and recompiling.
+
+Prerequisities
+--
+
+This PMD requires kernel modules which are responsible for initialization and
+allocation of resources needed for sze2 layer function. Communication between
+PMD and kernel modules is mediated by libsze2 library. These kernel modules and
+library are not part of DPDK and must be installed separately:
+
+- **libsze2**
+
+  This library provides API for initialization of sze2 transfers, receiving and
+  transmitting data segments.
+
+- **Kernel modules**
+
+  These kernel modules manage initialization of hardware, allocation and 
sharing
+  of resources for user space applications:
+
+  - combov3
+  - szedata2_cv3
+
+Using PMD
+-
+
+SZEDATA2 PMD can be created by passing --vdev= option to EAL in the following
+format:
+
+.. code-block:: console
+
+--vdev 
'DEVICE_NAME,dev_path=PATH_TO_SZEDATA2_DEVICE,rx_ifaces=RX_MASK,tx_ifaces=TX_MASK'
+
+DEVICE_NAME and options dev_path, rx_ifaces, tx_ifaces are mandatory and must
+be separated by commas.
+
+*   DEVICE_NAME: contains prefix eth_szedata2 followed by numbers or letters,
+must be unique for each virtual device
+
+*   dev_path: Defines path to szedata2 device.
+Value is valid path to szedata2 device.
+
+dev_path=/dev/szedataII0
+
+*   rx_ifaces: Defines which receive channels will be used.
+For each channel is created one queue. Value is mask for selecting which
+receive channels are required.
+
+rx_ifaces=0x3
+
+*   tx_ifaces: Defines which transmit channels will be used.
+For each channel is created one queue. Value is mask for selecting which
+transmit channels are required.
+
+tx_ifaces=0x3
+
+Example of usage
+
+
+Read packets from 0. and 1. receive channel and write them to 0. and 1. 
transmit
+channel
+
+.. code-block:: console
+
+$RTE_TARGET/app/testpmd -c 0xf -n 2 --vdev 
'eth_szedata20,dev_path=/dev/szedataII0,rx_ifaces=0x3,tx_ifaces=0x3' -- 
--port-topology=chained --rxq=2 --txq=2 --nb-cores=2
diff --git a/doc/guides/prog_guide/source_org.rst 
b/doc/guides/prog_guide/source_org.rst
index 4f6f489..e43d8c1 100644
--- a/doc/guides/prog_guide/source_org.rst
+++ b/doc/guides/prog_guide/source_o