Re: [dpdk-dev] [PATCH v2 4/4] rawdev: pass device id as parameter to selftest

2019-07-04 Thread Shreyansh Jain
> -Original Message-
> From: Bruce Richardson 
> Sent: Friday, June 21, 2019 9:27 PM
> To: dev@dpdk.org
> Cc: Bruce Richardson ; Shreyansh Jain
> 
> Subject: [PATCH v2 4/4] rawdev: pass device id as parameter to selftest
> 
> When running self-tests, the driver needs to know the device on which to
> run the tests, so we need to take the device ID as parameter. Only the
> skeleton driver is providing this selftest capability right now, so we
> can
> easily update it for this change.
> 
> Cc: shreyansh.j...@nxp.com
> Signed-off-by: Bruce Richardson 
> ---
> 
> Since this change only affects the internals of the drivers, it's not an
> ABI or API change
> 
> ---

Sorry for delay in responding to this. If not already merged:

Acked-by: Shreyansh Jain 



Re: [dpdk-dev] [PATCH v4 1/9] rawdev: allow devices to skip extra memory allocation

2019-07-02 Thread Shreyansh Jain
> -Original Message-
> From: Bruce Richardson 
> Sent: Monday, July 1, 2019 9:26 PM
> To: dev@dpdk.org
> Cc: tho...@monjalon.net; jer...@marvell.com; jiayu...@intel.com; Bruce
> Richardson ; Shreyansh Jain
> ; Hemant Agrawal 
> Subject: [PATCH v4 1/9] rawdev: allow devices to skip extra memory
> allocation
> 
> Some device drivers want to allocate their own private memory, and
> should
> be allowed to do so. Therefore skip memory allocation and associated
> error
> checks if zero-length private memory is requested.

Agree with this - rawdev was intended for flexibility and this (allowing them 
their own memory) is definitely better way ahead. Thanks for proposing.
But, I think the kind of caveat should also be added to the header declaring 
this function:

Probably something like this:

--->8--- lib/librte_rawdev/rte_rawdev_pmd.h ---
/**
 * Allocates a new rawdev slot for an raw device and returns the pointer 
 * to that slot for the driver to use.
 *
 * @param name 
 *   Unique identifier name for each device 
 * @param dev_private_size 
 *   Private data allocated within rte_rawdev object.
 *   Set to 0 to disable internal allocation and allow for 
self-allocation
 * @param socket_id 
 *   Socket to allocate resources on. 
 * @return 
 *   - Slot in the rte_dev_devices array for a new device; 
 */
struct rte_rawdev *
rte_rawdev_pmd_allocate(const char *name, size_t dev_private_size, 
int socket_id);
--->8---

> 
> While adjusting the code for new indent level, fix incorrect error
> message.
> 
> Cc: Shreyansh Jain 
> Cc: Hemant Agrawal 
> Signed-off-by: Bruce Richardson 
> ---

If you can update the header, please use my ACK in next version.

Acked-by: Shreyansh Jain 

[...]



Re: [dpdk-dev] [PATCH] raw/skeleton: fix test raw_attr set get failure

2019-06-11 Thread Shreyansh Jain
> -Original Message-
> From: dev  On Behalf Of Thinh Tran
> Sent: Wednesday, June 12, 2019 3:14 AM
> To: dev@dpdk.org
> Cc: Thinh Tran 
> Subject: [dpdk-dev] [PATCH] raw/skeleton: fix test raw_attr set get failure
> 
> Using memory on the stack instead of on the heap by calling malloc
> also avoid memory leak in case of test case failures
> 
> Fixes: 88d0e47880ec ("raw/skeleton: fix memory leak on test failure")
> 
> Signed-off-by: Thinh Tran 
> ---

Thanks - I had ignored this issue for quite long now.

Acked-by: Shreyansh Jain 


Re: [dpdk-dev] [PATCH] doc: fix a grammar mistake in rawdev guide

2019-06-06 Thread Shreyansh Jain
Though John has already acked it, and I was original culprit, more than one Ack 
doesn't look bad :D

> -Original Message-
> From: Xiaolong Ye 
> Sent: Tuesday, June 4, 2019 2:11 PM
> To: Shreyansh Jain ; Hemant Agrawal
> ; John McNamara ; Marko
> Kovacevic 
> Cc: dev@dpdk.org; Xiaolong Ye ; sta...@dpdk.org
> Subject: [PATCH] doc: fix a grammar mistake in rawdev guide
> 
> Fixes: a9bb0c44c775 ("doc: add rawdev library guide and doxygen page")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Xiaolong Ye 
> ---

Acked-by: Shreyansh Jain 


Re: [dpdk-dev] [PATCH 02/25] bus/fslmc: use new memory locking API

2019-06-02 Thread Shreyansh Jain
> -Original Message-
> From: Anatoly Burakov 
> Sent: Wednesday, May 29, 2019 10:01 PM
> To: dev@dpdk.org
> Cc: Hemant Agrawal ; Shreyansh Jain
> ; step...@networkplumber.org;
> tho...@monjalon.net; david.march...@redhat.com
> Subject: [PATCH 02/25] bus/fslmc: use new memory locking API
> 
> Replace usages of direct access to shared memory config with
> calls to the new API.
> 
> Signed-off-by: Anatoly Burakov 
> ---

>From fslmc perspective, looks fine to me.

Acked-by: Shreyansh Jain 


Re: [dpdk-dev] [PATCH] common/dpaax: fix i686 compilation issue

2019-05-29 Thread Shreyansh Jain
Hi Bruce,

> -Original Message-
> From: Bruce Richardson 
> Sent: Wednesday, May 29, 2019 2:48 PM
> To: Shreyansh Jain 
> Cc: ferruh.yi...@intel.com; step...@networkplumber.org; bl...@debian.org;
> dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] common/dpaax: fix i686 compilation issue
> 
> On Wed, May 29, 2019 at 12:17:16PM +0530, Shreyansh Jain wrote:
> > Meson build on i686, part of DPDK CI, reports: (example report [1])
> > *Meson Failed Build #1:
> > OS: UB1604-32
> > Target: i686-native-linuxapp-gcc
> > ../drivers/common/dpaax/dpaax_iova_table.c:121:3: note: in expansion of
> > macro ‘DPAAX_DEBUG’
> >DPAAX_DEBUG("Invalid memory node values or count. (size=%lu)",
> >^
> >
> > 'statbuf.st_size', part of fstat() is a 'off_t' - which should be printable
> > as '%lu'. But, only a particularly old compiler reports this (5.4.0).
> > For now, removing the variable being dumped as part of debug.
> >
> > [1]
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmails.dpdk.o
> rg%2Farchives%2Ftest-report%2F2019-
> May%2F082622.html&data=02%7C01%7Cshreyansh.jain%40nxp.com%7C3b8f427731c44
> d3f946908d6e4168d1f%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636947182857
> 407108&sdata=Dir66wDBr8YqsKrqcqCstuLBMPVVrYfEYqN3ETZm0LA%3D&reserved=
> 0
> >
> > Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation
> table")
> > Cc: shreyansh.j...@nxp.com
> >
> > Signed-off-by: Shreyansh Jain 
> > ---
> > Note:
> >  - Another option was to use the PRIu32 macros but, in absence of a proper
> >verification environment, I wish to take the safer route. In future, if
> >need arises, the field would be added to debug logs.
> >
> Actually, I think it's a bit more complicated than that, since for meson
> and make builds, the type and size of the offset field varies. I've already
> posted a fix for this and other 32-bit build issues. Please review that, and
> let me know what you think.
> 
[...]

Thanks for highlighting - I didn't notice this series.
I have acked the DPAAX patch - 32 bit and large file is not really a 'worry' 
case.
Also, I can't test my patch as I am unable to reproduce this issue. So, anyways 
yours is better - it continues to keep the variable dumped in debug, and 
assuming you would have verified it somehow.

I will reject/suspend this patch in Patchwork.

Regards,
Shreyansh 



Re: [dpdk-dev] [PATCH v2 2/5] build: enable large file support on 32-bit

2019-05-29 Thread Shreyansh Jain


> -Original Message-
> From: Bruce Richardson 
> Sent: Tuesday, May 28, 2019 4:38 PM
> To: dev@dpdk.org
> Cc: Shreyansh Jain ; Alejandro Lucero
> ; Anatoly Burakov
> ; sta...@dpdk.org; Maxime Coquelin
> ; Zhihong Wang ; Luca
> Boccassi ; Zhang XuemingX ; Bruce
> Richardson 
> Subject: [PATCH v2 2/5] build: enable large file support on 32-bit
> 
> By default on 32-bit systems, file offsets are given as 32-bit values
> which prevents support for large files. While this is unlikely to be
> a problem, enabling large file support globally makes "make" and
> "meson" builds consistent, since meson always enables large file
> support, and without this change, the size of "struct stat" fields
> will be different between the two builds.
> 
> The only location where this appears to be significant is in the
> dpaax common code, where a printf needs to be updated for 32-bit
> builds.

>From DPAAX perspective, I am not worried about 32bit and dependency of large 
>file support.
So, this 'don't care' from my side.

> 
> Signed-off-by: Bruce Richardson 
> Acked-by: Luca Boccassi 
> ---
>  drivers/common/dpaax/dpaax_iova_table.c | 4 ++--
>  mk/arch/arm/rte.vars.mk | 2 +-
>  mk/arch/i686/rte.vars.mk| 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 

If this patch is merged, please ignore [1]

[1] http://patches.dpdk.org/patch/53798/

Acked-by: Shreyansh Jain 


[dpdk-dev] [PATCH] common/dpaax: fix i686 compilation issue

2019-05-28 Thread Shreyansh Jain
Meson build on i686, part of DPDK CI, reports: (example report [1])
*Meson Failed Build #1:
OS: UB1604-32
Target: i686-native-linuxapp-gcc
../drivers/common/dpaax/dpaax_iova_table.c:121:3: note: in expansion of
macro ‘DPAAX_DEBUG’
   DPAAX_DEBUG("Invalid memory node values or count. (size=%lu)",
   ^

'statbuf.st_size', part of fstat() is a 'off_t' - which should be printable
as '%lu'. But, only a particularly old compiler reports this (5.4.0).
For now, removing the variable being dumped as part of debug.

[1] http://mails.dpdk.org/archives/test-report/2019-May/082622.html

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: shreyansh.j...@nxp.com

Signed-off-by: Shreyansh Jain 
---
Note:
 - Another option was to use the PRIu32 macros but, in absence of a proper
   verification environment, I wish to take the safer route. In future, if
   need arises, the field would be added to debug logs.

 drivers/common/dpaax/dpaax_iova_table.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.c 
b/drivers/common/dpaax/dpaax_iova_table.c
index 2dd38a920..4ba38ac00 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -118,8 +118,7 @@ read_memory_node(unsigned int *count)
 */
*count = (statbuf.st_size / 16);
if ((*count) <= 0 || (statbuf.st_size % 16 != 0)) {
-   DPAAX_DEBUG("Invalid memory node values or count. (size=%lu)",
-   statbuf.st_size);
+   DPAAX_DEBUG("Invalid memory node values or count. ");
goto cleanup;
}
 
-- 
2.17.1



[dpdk-dev] [PATCH] net/dpaa2: fix incorrect loop increment

2019-04-25 Thread Shreyansh Jain
Identified by LGTM, the loop was incorrectly incrementing a different
variable and conditional on another.

Fixes: fe2b986ac662 ("net/dpaa2: support generic flow")
Cc: sunil.k...@nxp.com

Suggested-by: Ferruh Yigit 
Signed-off-by: Shreyansh Jain 
---
 drivers/net/dpaa2/dpaa2_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c
index 98f68139b..9ef46d47e 100644
--- a/drivers/net/dpaa2/dpaa2_flow.c
+++ b/drivers/net/dpaa2/dpaa2_flow.c
@@ -1734,7 +1734,7 @@ dpaa2_dev_verify_patterns(struct dpaa2_dev_priv *dev_priv,
/* more than DPKG_MAX_NUM_OF_EXTRACTS. Verify this limitation too. */
for (i = 0; pattern[i].type != RTE_FLOW_ITEM_TYPE_END; i++) {
for (j = 0; j < MAX_TCS + 1; j++) {
-   for (k = 0; k < DPKG_MAX_NUM_OF_EXTRACTS; j++) {
+   for (k = 0; k < DPKG_MAX_NUM_OF_EXTRACTS; k++) {
if 
(dev_priv->pattern[j].pattern_type[k] == pattern[i].type)
break;
}
-- 
2.17.1



[dpdk-dev] [PATCH v2] examples/l3fwd: support separate buffer pool per port

2019-04-25 Thread Shreyansh Jain
Traditionally, only a single buffer pool per port
(or, per-port-per-socket) is created in l3fwd application.

If separate pools are created per-port, it might lead to gain in
performance as packet alloc/dealloc requests would be isolated
across ports (and their corresponding lcores).

This patch adds an argument '--per-port-pool' to the l3fwd application.
By default, old mode of single pool per port (split on sockets) is
active.

L3fwd user guide is also updated by this patch.

Signed-off-by: Shreyansh Jain 
Acked-by: Ruifeng Wang 
---
v2:
 - Updated documentation


 doc/guides/sample_app_ug/l3_forward.rst |  3 +
 examples/l3fwd/main.c   | 74 ++---
 2 files changed, 56 insertions(+), 21 deletions(-)

diff --git a/doc/guides/sample_app_ug/l3_forward.rst 
b/doc/guides/sample_app_ug/l3_forward.rst
index ddd0f9a86..670918c57 100644
--- a/doc/guides/sample_app_ug/l3_forward.rst
+++ b/doc/guides/sample_app_ug/l3_forward.rst
@@ -55,6 +55,7 @@ The application has a number of command line options::
  [--hash-entry-num]
  [--ipv6]
  [--parse-ptype]
+ [--per-port-pool]
 
 Where,
 
@@ -83,6 +84,8 @@ Where,
 
 * ``--parse-ptype:`` Optional, set to use software to analyze packet type. 
Without this option, hardware will check the packet type.
 
+* ``--per-port-pool:`` Optional, set to use independent buffer pools per port. 
Without this option, single buffer pool is used for all ports.
+
 For example, consider a dual processor socket platform with 8 physical cores, 
where cores 0-7 and 16-23 appear on socket 0,
 while cores 8-15 and 24-31 appear on socket 1.
 
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index e4b99efe0..7b9683187 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -69,11 +69,13 @@ static int promiscuous_on;
 static int l3fwd_lpm_on;
 static int l3fwd_em_on;
 
+/* Global variables. */
+
 static int numa_on = 1; /**< NUMA is enabled by default. */
 static int parse_ptype; /**< Parse packet type using rx callback, and */
/**< disabled by default */
-
-/* Global variables. */
+static int per_port_pool; /**< Use separate buffer pools per port; disabled */
+ /**< by default */
 
 volatile bool force_quit;
 
@@ -133,7 +135,8 @@ static struct rte_eth_conf port_conf = {
},
 };
 
-static struct rte_mempool * pktmbuf_pool[NB_SOCKETS];
+static struct rte_mempool *pktmbuf_pool[RTE_MAX_ETHPORTS][NB_SOCKETS];
+static uint8_t lkp_per_socket[NB_SOCKETS];
 
 struct l3fwd_lkp_mode {
void  (*setup)(int);
@@ -285,7 +288,8 @@ print_usage(const char *prgname)
" [--no-numa]"
" [--hash-entry-num]"
" [--ipv6]"
-   " [--parse-ptype]\n\n"
+   " [--parse-ptype]"
+   " [--per-port-pool]\n\n"
 
"  -p PORTMASK: Hexadecimal bitmask of ports to configure\n"
"  -P : Enable promiscuous mode\n"
@@ -299,7 +303,8 @@ print_usage(const char *prgname)
"  --no-numa: Disable numa awareness\n"
"  --hash-entry-num: Specify the hash entry number in 
hexadecimal to be setup\n"
"  --ipv6: Set if running ipv6 packets\n"
-   "  --parse-ptype: Set to use software to analyze packet 
type\n\n",
+   "  --parse-ptype: Set to use software to analyze packet type\n"
+   "  --per-port-pool: Use separate buffer pool per port\n\n",
prgname);
 }
 
@@ -452,6 +457,7 @@ static const char short_options[] =
 #define CMD_LINE_OPT_ENABLE_JUMBO "enable-jumbo"
 #define CMD_LINE_OPT_HASH_ENTRY_NUM "hash-entry-num"
 #define CMD_LINE_OPT_PARSE_PTYPE "parse-ptype"
+#define CMD_LINE_OPT_PER_PORT_POOL "per-port-pool"
 enum {
/* long options mapped to a short option */
 
@@ -465,6 +471,7 @@ enum {
CMD_LINE_OPT_ENABLE_JUMBO_NUM,
CMD_LINE_OPT_HASH_ENTRY_NUM_NUM,
CMD_LINE_OPT_PARSE_PTYPE_NUM,
+   CMD_LINE_OPT_PARSE_PER_PORT_POOL,
 };
 
 static const struct option lgopts[] = {
@@ -475,6 +482,7 @@ static const struct option lgopts[] = {
{CMD_LINE_OPT_ENABLE_JUMBO, 0, 0, CMD_LINE_OPT_ENABLE_JUMBO_NUM},
{CMD_LINE_OPT_HASH_ENTRY_NUM, 1, 0, CMD_LINE_OPT_HASH_ENTRY_NUM_NUM},
{CMD_LINE_OPT_PARSE_PTYPE, 0, 0, CMD_LINE_OPT_PARSE_PTYPE_NUM},
+   {CMD_LINE_OPT_PER_PORT_POOL, 0, 0, CMD_LINE_OPT_PARSE_PER_PORT_POOL},
{NULL, 0, 0, 0}
 };
 
@@ -485,10 +493,10 @@ static const struct option lgopts[] = {
  * RTE_MAX is used to ensure that NB_MBUF never goes below a minimum
  * value of 8192
  */
-#define NB_MBUF RTE_MAX(   \
-   (nb_ports*nb_rx_queue*nb_rxd +  \
-

Re: [dpdk-dev] [PATCH] examples/l3fwd: support separate buffer pool per port

2019-04-16 Thread Shreyansh Jain
Hi Ananyev,

[...]

> > As you have stated below, it's just the same thing with two different
> views.
> >
> > > I think it would be plausible for both cases:
> > > - one port per core (your case).
> > > - multiple ports per core.
> >
> > Indeed. For this particular patch, I just chose the first one.
> Probably because that is the most general use-case I come across.
> > I am sure the second too has equal number of possible use-cases - but
> probably someone with access to that kind of scenario would be
> > better suited for validating what is the performance increase.
> > Do you think it would be OK to have that in and then sometime in
> future enable the second option?
> 
> What I am trying to say - if we'll have mempool per lcore (not per
> port),
> then it would cover both cases above.
> So wouldn't  need to make extra changes.
> Konstantin

What you are suggesting would end up as 1:N mapping of port:pool (when multiple 
queues are being used for a port, each affined to different core). In my 
observation, or rather the cases I generally see, that would end up reducing 
performance. Especially hardware pools work best when pool:port are co-located.

At least for me this option of setting multiple buffer pools against lcores in 
l3fwd is NOT a preferred use-case. Which leads me to conclude that we would 
anyways need both way mapping: pool-per-port and pool-per-core, to cover larger 
number of use-cases (at least, yours and mine).

Regards,
Shreyansh


Re: [dpdk-dev] [PATCH] examples/l3fwd: support separate buffer pool per port

2019-04-16 Thread Shreyansh Jain
Hello Ananyev,

> Hi Shreyansh,
> 
> > > > I tried this patch on MacchiatoBin + 82599 NIC.
> > > > Compared with global-pool mode, per-port-pool mode showed slightly
> > > lower performance in single core test.
> > >
> > > That was my thought too - for the case when queues from multiple
> ports
> > > are handled by the same core
> > > it probably would only slowdown things.
> >
> > Thanks for your comments.
> >
> > This is applicable for cases where separate cores can handle separate
> ports - each with their pools. (somehow I felt that message in commit
> > was adequate - I can rephrase if that is misleading)
> >
> > In case there is enough number of cores available for datapath, such
> segregation can result in better performance - possibly because of
> > drop in pool and cache conflicts.
> > At least on some of NXP SoC, this resulted in over 15% improvement.
> > And, in other cases it didn't lead to any drop/negative-impact.
> 
> If each core manages just one port, then yes definitely performance
> increase is expected.
> If that's the case you'd like enable, then can I suggest to have mempool
> per lcore not per port?

As you have stated below, it's just the same thing with two different views.

> I think it would be plausible for both cases:
> - one port per core (your case).
> - multiple ports per core.

Indeed. For this particular patch, I just chose the first one. Probably because 
that is the most general use-case I come across.
I am sure the second too has equal number of possible use-cases - but probably 
someone with access to that kind of scenario would be better suited for 
validating what is the performance increase.
Do you think it would be OK to have that in and then sometime in future enable 
the second option?

[...]

-
Shreyansh


Re: [dpdk-dev] [PATCH] examples/l3fwd: support separate buffer pool per port

2019-04-15 Thread Shreyansh Jain
Hello Ruifeng,

> 
> 
> Hi Shreyansh,
> 
> > -Original Message-
> > From: Shreyansh Jain 
> > Sent: Monday, April 15, 2019 14:48
> > To: Ruifeng Wang (Arm Technology China) ;
> > Ananyev, Konstantin ; dev@dpdk.org
> > Cc: nd ; nd 
> > Subject: RE: [dpdk-dev] [PATCH] examples/l3fwd: support separate
> buffer
> > pool per port
> >
> > Hi Ruifeng,
> >
> > [...]
> >
> > > >
> > > > For hardware backed pools, hardware access and exclusion are
> > > expensive. By
> > > > segregating pool/port/lcores it is possible to attain a conflict
> free
> > > path. This is
> > > > the use-case this patch targets.
> > > > And anyways, this is an optional feature.
> > > >
> > > > > Konstantin
> > > > >
> > > > > > In dual core test, both modes had nearly same performance.
> > > >
> > > > OK
> > > >
> > > > > >
> > > > > > My setup only has two ports which is limited.
> > > > > > Just want to know the per-port-pool mode has more performance
> > gain
> > > > > when many ports are bound to  different cores?
> > > >
> > > > Yes, though not necessarily *many* - in my case, I had 4 ports and
> > > even then
> > > > about ~10% improvement was directly visible. I increased the port
> > > count and
> > > > I was able to touch about ~15%. I did pin each port to a separate
> > > core, though.
> > > > But again, important point is that without this feature enabled, I
> > > didn't see
> > > > any drop in performance. Did you observe any drop?
> > > >
> > >
> > > No, no drop without the feature enabled in my test.
> >
> > So, in case this is an optional feature, it should be fine, right?
> > (Obviously, assuming that my logical implementation is correct)
> >
> > At my end also, I saw no drop in performance without this feature
> (Default)
> > and a decent increase with this (with separate port-core combination)
> on
> > NXP platform.
> >
> > [...]
> 
> Tested on LS2088A and observed 12% performance gain when 4 ports were
> used.

Thanks for verifying this.

> I think sample_app_ug document should be updated to add the new option.

Yes, indeed. I will send an updated version.

> Acked-by: Ruifeng Wang 
> 

Thanks.


Re: [dpdk-dev] [PATCH] examples/l3fwd: support separate buffer pool per port

2019-04-14 Thread Shreyansh Jain
Hi Ruifeng,

[...]

> >
> > For hardware backed pools, hardware access and exclusion are
> expensive. By
> > segregating pool/port/lcores it is possible to attain a conflict free
> path. This is
> > the use-case this patch targets.
> > And anyways, this is an optional feature.
> >
> > > Konstantin
> > >
> > > > In dual core test, both modes had nearly same performance.
> >
> > OK
> >
> > > >
> > > > My setup only has two ports which is limited.
> > > > Just want to know the per-port-pool mode has more performance gain
> > > when many ports are bound to  different cores?
> >
> > Yes, though not necessarily *many* - in my case, I had 4 ports and
> even then
> > about ~10% improvement was directly visible. I increased the port
> count and
> > I was able to touch about ~15%. I did pin each port to a separate
> core, though.
> > But again, important point is that without this feature enabled, I
> didn't see
> > any drop in performance. Did you observe any drop?
> >
> 
> No, no drop without the feature enabled in my test.

So, in case this is an optional feature, it should be fine, right?
(Obviously, assuming that my logical implementation is correct)

At my end also, I saw no drop in performance without this feature (Default) and 
a decent increase with this (with separate port-core combination) on NXP 
platform.

[...]


Re: [dpdk-dev] [PATCH] examples/l3fwd: support separate buffer pool per port

2019-04-12 Thread Shreyansh Jain
Hi Konstantin, Ruifeng,

> -Original Message-
> From: Ananyev, Konstantin 
> Sent: Monday, April 8, 2019 3:00 PM
> To: Ruifeng Wang (Arm Technology China) ;
> Shreyansh Jain ; dev@dpdk.org
> Cc: nd 
> Subject: RE: [dpdk-dev] [PATCH] examples/l3fwd: support separate buffer
> pool per port
> 
> 
> 
> >
> > Hi Shreyansh,
> >
> > I tried this patch on MacchiatoBin + 82599 NIC.
> > Compared with global-pool mode, per-port-pool mode showed slightly
> lower performance in single core test.
> 
> That was my thought too - for the case when queues from multiple ports
> are handled by the same core
> it probably would only slowdown things.

Thanks for your comments.

This is applicable for cases where separate cores can handle separate ports - 
each with their pools. (somehow I felt that message in commit was adequate - I 
can rephrase if that is misleading)

In case there is enough number of cores available for datapath, such 
segregation can result in better performance - possibly because of drop in pool 
and cache conflicts.
At least on some of NXP SoC, this resulted in over 15% improvement.
And, in other cases it didn't lead to any drop/negative-impact.

> Wonder what is the use case for the patch and what is the performance
> gain you observed?

For hardware backed pools, hardware access and exclusion are expensive. By 
segregating pool/port/lcores it is possible to attain a conflict free path. 
This is the use-case this patch targets. 
And anyways, this is an optional feature.

> Konstantin
> 
> > In dual core test, both modes had nearly same performance.

OK

> >
> > My setup only has two ports which is limited.
> > Just want to know the per-port-pool mode has more performance gain
> when many ports are bound to  different cores?

Yes, though not necessarily *many* - in my case, I had 4 ports and even then 
about ~10% improvement was directly visible. I increased the port count and I 
was able to touch about ~15%. I did pin each port to a separate core, though.
But again, important point is that without this feature enabled, I didn't see 
any drop in performance. Did you observe any drop?

> >
> > Used commands:
> > sudo ./examples/l3fwd/build/l3fwd -c 0x4 -w :01:00.0 -w
> :01:00.1 -- -P -p 3 --config='(0,0,2),(1,0,2)' --per-port-pool
> > sudo ./examples/l3fwd/build/l3fwd -c 0xc -w :01:00.0 -w
> :01:00.1 -- -P -p 3 --config='(0,0,2),(1,0,3)' --per-port-pool
> >
> > Regards,
> > /Ruifeng
> >

[...]


Re: [dpdk-dev] [PATCH v2 1/3] bus/fslmc: cleanup unused firmware code

2019-04-05 Thread Shreyansh Jain
On 05/04/19 6:05 PM, Thomas Monjalon wrote:
> 05/04/2019 13:38, Shreyansh Jain:
>> On 05/04/19 4:49 PM, Shreyansh Jain wrote:
>>> On 05/04/19 3:13 AM, Thomas Monjalon wrote:
>>>> 04/04/2019 23:29, Ferruh Yigit:
>>>>> On 4/4/2019 8:23 AM, Shreyansh Jain wrote:
>>>>>> Removes some unused firmware code which was added in last bump
>>>>>> of the firmware version. No current features uses these APIs.
>>>>>>
>>>>>> Signed-off-by: Shreyansh Jain 
>>>>>
>>>>> <...>
>>>>>
>>>>>> diff --git a/drivers/bus/fslmc/mc/fsl_dpci.h 
>>>>>> b/drivers/bus/fslmc/mc/fsl_dpci.h
>>>>>> index 9af9097e5..cf3d15267 100644
>>>>>> --- a/drivers/bus/fslmc/mc/fsl_dpci.h
>>>>>> +++ b/drivers/bus/fslmc/mc/fsl_dpci.h
>>>>>> @@ -108,27 +108,6 @@ int dpci_get_attributes(struct fsl_mc_io *mc_io,
>>>>>>  uint16_t token,
>>>>>>  struct dpci_attr *attr);
>>>>>> 
>>>>>> -/**
>>>>>> - * struct dpci_peer_attr - Structure representing the peer DPCI 
>>>>>> attributes
>>>>>> - * @peer_id:DPCI peer id; if no peer is connected returns 
>>>>>> (-1)
>>>>>> - * @num_of_priorities:  The pper's number of receive priorities; 
>>>>>> determines the
>>>>>> - *  number of transmit priorities for the local 
>>>>>> DPCI object
>>>>>> - */
>>>>>> -struct dpci_peer_attr {
>>>>>> -int peer_id;
>>>>>> -uint8_t num_of_priorities;
>>>>>> -};
>>>>>> -
>>>>>> -int dpci_get_peer_attributes(struct fsl_mc_io *mc_io,
>>>>>> - uint32_t cmd_flags,
>>>>>> - uint16_t token,
>>>>>> - struct dpci_peer_attr *attr);
>>>>>> -
>>>>>> -int dpci_get_link_state(struct fsl_mc_io *mc_io,
>>>>>> -uint32_t cmd_flags,
>>>>>> -uint16_t token,
>>>>>> -int *up);
>>>>>
>>>>> These needs to be removed from .map file too.
>>>
>>> Wow! indeed a great catch.
>>> And, yup, my bad. Sorry! I wish I had your eye-for-detail.
>>>
>>>>
>>>> Removed from master.
>>>> Thanks for the catch.
>>
>> Thomas,
>> I still see this applied on the master and net-next.
>> Can you tell me how do you want me to do - send a fresh series or just
>> the delta change for map file?
> 
> I don't see them.
> Please update master and check again.
> 
> 

Once again, my bad - I thought when you mentioned "removed from master" 
meant you removed the patch. But, now I realize you meant "removed the 
symbols from map file".
Thanks for doing my work.


Re: [dpdk-dev] [PATCH v2 1/3] bus/fslmc: cleanup unused firmware code

2019-04-05 Thread Shreyansh Jain
On 05/04/19 4:49 PM, Shreyansh Jain wrote:
> On 05/04/19 3:13 AM, Thomas Monjalon wrote:
>> 04/04/2019 23:29, Ferruh Yigit:
>>> On 4/4/2019 8:23 AM, Shreyansh Jain wrote:
>>>> Removes some unused firmware code which was added in last bump
>>>> of the firmware version. No current features uses these APIs.
>>>>
>>>> Signed-off-by: Shreyansh Jain 
>>>
>>> <...>
>>>
>>>> diff --git a/drivers/bus/fslmc/mc/fsl_dpci.h 
>>>> b/drivers/bus/fslmc/mc/fsl_dpci.h
>>>> index 9af9097e5..cf3d15267 100644
>>>> --- a/drivers/bus/fslmc/mc/fsl_dpci.h
>>>> +++ b/drivers/bus/fslmc/mc/fsl_dpci.h
>>>> @@ -108,27 +108,6 @@ int dpci_get_attributes(struct fsl_mc_io *mc_io,
>>>>uint16_t token,
>>>>struct dpci_attr *attr);
>>>>
>>>> -/**
>>>> - * struct dpci_peer_attr - Structure representing the peer DPCI attributes
>>>> - * @peer_id:  DPCI peer id; if no peer is connected returns 
>>>> (-1)
>>>> - * @num_of_priorities:The pper's number of receive priorities; 
>>>> determines the
>>>> - *number of transmit priorities for the local 
>>>> DPCI object
>>>> - */
>>>> -struct dpci_peer_attr {
>>>> -  int peer_id;
>>>> -  uint8_t num_of_priorities;
>>>> -};
>>>> -
>>>> -int dpci_get_peer_attributes(struct fsl_mc_io *mc_io,
>>>> -   uint32_t cmd_flags,
>>>> -   uint16_t token,
>>>> -   struct dpci_peer_attr *attr);
>>>> -
>>>> -int dpci_get_link_state(struct fsl_mc_io *mc_io,
>>>> -  uint32_t cmd_flags,
>>>> -  uint16_t token,
>>>> -  int *up);
>>>
>>> These needs to be removed from .map file too.
> 
> Wow! indeed a great catch.
> And, yup, my bad. Sorry! I wish I had your eye-for-detail.
> 
>>
>> Removed from master.
>> Thanks for the catch.

Thomas,
I still see this applied on the master and net-next.
Can you tell me how do you want me to do - send a fresh series or just 
the delta change for map file?


Re: [dpdk-dev] [PATCH v2 1/3] bus/fslmc: cleanup unused firmware code

2019-04-05 Thread Shreyansh Jain
On 05/04/19 3:13 AM, Thomas Monjalon wrote:
> 04/04/2019 23:29, Ferruh Yigit:
>> On 4/4/2019 8:23 AM, Shreyansh Jain wrote:
>>> Removes some unused firmware code which was added in last bump
>>> of the firmware version. No current features uses these APIs.
>>>
>>> Signed-off-by: Shreyansh Jain 
>>
>> <...>
>>
>>> diff --git a/drivers/bus/fslmc/mc/fsl_dpci.h 
>>> b/drivers/bus/fslmc/mc/fsl_dpci.h
>>> index 9af9097e5..cf3d15267 100644
>>> --- a/drivers/bus/fslmc/mc/fsl_dpci.h
>>> +++ b/drivers/bus/fslmc/mc/fsl_dpci.h
>>> @@ -108,27 +108,6 @@ int dpci_get_attributes(struct fsl_mc_io *mc_io,
>>> uint16_t token,
>>> struct dpci_attr *attr);
>>>   
>>> -/**
>>> - * struct dpci_peer_attr - Structure representing the peer DPCI attributes
>>> - * @peer_id:   DPCI peer id; if no peer is connected returns 
>>> (-1)
>>> - * @num_of_priorities: The pper's number of receive priorities; 
>>> determines the
>>> - * number of transmit priorities for the local DPCI object
>>> - */
>>> -struct dpci_peer_attr {
>>> -   int peer_id;
>>> -   uint8_t num_of_priorities;
>>> -};
>>> -
>>> -int dpci_get_peer_attributes(struct fsl_mc_io *mc_io,
>>> -uint32_t cmd_flags,
>>> -uint16_t token,
>>> -struct dpci_peer_attr *attr);
>>> -
>>> -int dpci_get_link_state(struct fsl_mc_io *mc_io,
>>> -   uint32_t cmd_flags,
>>> -   uint16_t token,
>>> -   int *up);
>>
>> These needs to be removed from .map file too.

Wow! indeed a great catch.
And, yup, my bad. Sorry! I wish I had your eye-for-detail.

> 
> Removed from master.
> Thanks for the catch.
> 
>


[dpdk-dev] [PATCH v2 3/3] doc: bump SDK support version for dpaa2

2019-04-04 Thread Shreyansh Jain
With the change in MC firmware, minimum supported version of
the Layerscape SDK too needs to be changed.

Signed-off-by: Shreyansh Jain 
---
 doc/guides/nics/dpaa2.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/dpaa2.rst b/doc/guides/nics/dpaa2.rst
index 392ab0580..d74d8f899 100644
--- a/doc/guides/nics/dpaa2.rst
+++ b/doc/guides/nics/dpaa2.rst
@@ -421,8 +421,8 @@ See :doc:`../platform/dpaa2` for setup information
 
 Currently supported by DPDK:
 
-- NXP SDK **18.09+**.
-- MC Firmware version **10.10.0** and higher.
+- NXP SDK **18.11+**.
+- MC Firmware version **10.14.0** and higher.
 - Supported architectures:  **arm64 LE**.
 
 - Follow the DPDK :ref:`Getting Started Guide for Linux ` to setup 
the basic DPDK environment.
-- 
2.19.1



[dpdk-dev] [PATCH v2 2/3] drivers: update MC firmware version for FSLMC bus

2019-04-04 Thread Shreyansh Jain
MC firmware is the core component of FSLMC bus and DPAA2 devices.
Prior to this patch, MC firmware supported 10.10.x version. This
patch bumps the min supported version to 10.14.x.

Signed-off-by: Shreyansh Jain 
Acked-by: Hemant Agrawal 
---
 drivers/bus/fslmc/mc/fsl_dpmng.h|  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c|  1 +
 drivers/net/dpaa2/mc/dpni.c | 13 -
 drivers/net/dpaa2/mc/fsl_dpni.h | 84 ++---
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h | 40 ++
 5 files changed, 109 insertions(+), 31 deletions(-)

diff --git a/drivers/bus/fslmc/mc/fsl_dpmng.h b/drivers/bus/fslmc/mc/fsl_dpmng.h
index 8559bef87..bef2ef095 100644
--- a/drivers/bus/fslmc/mc/fsl_dpmng.h
+++ b/drivers/bus/fslmc/mc/fsl_dpmng.h
@@ -18,7 +18,7 @@ struct fsl_mc_io;
  * Management Complex firmware version information
  */
 #define MC_VER_MAJOR 10
-#define MC_VER_MINOR 10
+#define MC_VER_MINOR 14
 
 /**
  * struct mc_version
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 3fbc82977..98ef8a5f5 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -665,6 +665,7 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev,
 DPNI_CONG_OPT_WRITE_MEM_ON_ENTER |
 DPNI_CONG_OPT_WRITE_MEM_ON_EXIT |
 DPNI_CONG_OPT_COHERENT_WRITE;
+   cong_notif_cfg.cg_point = DPNI_CP_QUEUE;
 
ret = dpni_set_congestion_notification(dpni, CMD_PRI_LOW,
   priv->token,
diff --git a/drivers/net/dpaa2/mc/dpni.c b/drivers/net/dpaa2/mc/dpni.c
index 6c12a0ae1..362cd476f 100644
--- a/drivers/net/dpaa2/mc/dpni.c
+++ b/drivers/net/dpaa2/mc/dpni.c
@@ -125,6 +125,7 @@ int dpni_create(struct fsl_mc_io *mc_io,
cmd_params->vlan_filter_entries =  cfg->vlan_filter_entries;
cmd_params->qos_entries = cfg->qos_entries;
cmd_params->fs_entries = cpu_to_le16(cfg->fs_entries);
+   cmd_params->num_cgs = cfg->num_cgs;
 
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -593,6 +594,7 @@ int dpni_get_attributes(struct fsl_mc_io *mc_io,
attr->qos_key_size = rsp_params->qos_key_size;
attr->fs_key_size = rsp_params->fs_key_size;
attr->wriop_version = le16_to_cpu(rsp_params->wriop_version);
+   attr->num_cgs = rsp_params->num_cgs;
 
return 0;
 }
@@ -1800,6 +1802,8 @@ int dpni_set_congestion_notification(struct fsl_mc_io 
*mc_io,
cmd_params = (struct dpni_cmd_set_congestion_notification *)cmd.params;
cmd_params->qtype = qtype;
cmd_params->tc = tc_id;
+   cmd_params->congestion_point = cfg->cg_point;
+   cmd_params->cgid = (uint8_t)cfg->cgid;
cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id);
cmd_params->notification_mode = cpu_to_le16(cfg->notification_mode);
cmd_params->dest_priority = cfg->dest_cfg.priority;
@@ -1850,6 +1854,8 @@ int dpni_get_congestion_notification(struct fsl_mc_io 
*mc_io,
cmd_params = (struct dpni_cmd_get_congestion_notification *)cmd.params;
cmd_params->qtype = qtype;
cmd_params->tc = tc_id;
+   cmd_params->congestion_point = cfg->cg_point;
+   cmd_params->cgid = cfg->cgid;
 
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -1949,6 +1955,7 @@ int dpni_set_queue(struct fsl_mc_io *mc_io,
   queue->destination.hold_active);
cmd_params->flc = cpu_to_le64(queue->flc.value);
cmd_params->user_context = cpu_to_le64(queue->user_context);
+   cmd_params->cgid = queue->cgid;
 
/* send command to mc */
return mc_send_command(mc_io, &cmd);
@@ -2010,6 +2017,10 @@ int dpni_get_queue(struct fsl_mc_io *mc_io,
queue->user_context = le64_to_cpu(rsp_params->user_context);
qid->fqid = le32_to_cpu(rsp_params->fqid);
qid->qdbin = le16_to_cpu(rsp_params->qdbin);
+   if (dpni_get_field(rsp_params->flags, CGID_VALID))
+   queue->cgid = rsp_params->cgid;
+   else
+   queue->cgid = -1;
 
return 0;
 }
@@ -2031,7 +2042,7 @@ int dpni_get_statistics(struct fsl_mc_io *mc_io,
uint32_t cmd_flags,
uint16_t token,
uint8_t page,
-   uint8_t param,
+   uint16_t param,
union dpni_statistics *stat)
 {
struct mc_command cmd = { 0 };
diff --git a/drivers/net/dpaa2/mc/fsl_dpni.h b/drivers/net/dpaa2/mc/fsl_dpni.h
index aecdc8d1f..8b1cfbac7 100644
--- a/drivers/net/dpaa2/mc/fsl_dpni.h
+++ b/drivers/net/dpaa2/mc/fsl_dpni.h
@@ -91,6 +91,10 @@ struct fsl_mc_io;
  * All Tx traffic 

[dpdk-dev] [PATCH v2 0/3] Update FSLMC bus firmware

2019-04-04 Thread Shreyansh Jain
Based on net-next: 69f805ac18abe

All the patches are strictly within DPAA2/FSLMC driver area.

MC firmware is the core component of FSLMC bus which enables
all the dpaa2 devices (eth, crypto etc).
With recent release of NXP's layerscape SDK, the MC firmware
has been bumped up. These patches updates only necessary
changes so as to maintain version compatibility.

v1->v2:
 - In last patch (patch 2), one of a recent fix (e94be227b7)
   was overwritten. Restoring that change.

Shreyansh Jain (3):
  bus/fslmc: cleanup unused firmware code
  drivers: update MC firmware version for FSLMC bus
  doc: bump SDK support version for dpaa2

 doc/guides/nics/dpaa2.rst   |  4 +-
 drivers/bus/fslmc/mc/dpci.c | 75 --
 drivers/bus/fslmc/mc/dpcon.c| 30 ---
 drivers/bus/fslmc/mc/fsl_dpci.h | 21 
 drivers/bus/fslmc/mc/fsl_dpcon.h| 19 ---
 drivers/bus/fslmc/mc/fsl_dpmng.h|  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c|  1 +
 drivers/net/dpaa2/mc/dpni.c | 13 -
 drivers/net/dpaa2/mc/fsl_dpni.h | 84 ++---
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h | 40 ++
 10 files changed, 111 insertions(+), 178 deletions(-)

-- 
2.19.1



[dpdk-dev] [PATCH v2 1/3] bus/fslmc: cleanup unused firmware code

2019-04-04 Thread Shreyansh Jain
Removes some unused firmware code which was added in last bump
of the firmware version. No current features uses these APIs.

Signed-off-by: Shreyansh Jain 
---
 drivers/bus/fslmc/mc/dpci.c  | 75 
 drivers/bus/fslmc/mc/dpcon.c | 30 -
 drivers/bus/fslmc/mc/fsl_dpci.h  | 21 -
 drivers/bus/fslmc/mc/fsl_dpcon.h | 19 
 4 files changed, 145 deletions(-)

diff --git a/drivers/bus/fslmc/mc/dpci.c b/drivers/bus/fslmc/mc/dpci.c
index 95edae9d9..2874a6196 100644
--- a/drivers/bus/fslmc/mc/dpci.c
+++ b/drivers/bus/fslmc/mc/dpci.c
@@ -301,81 +301,6 @@ int dpci_get_attributes(struct fsl_mc_io *mc_io,
return 0;
 }
 
-/**
- * dpci_get_peer_attributes() - Retrieve peer DPCI attributes.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPCI object
- * @attr:  Returned peer attributes
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpci_get_peer_attributes(struct fsl_mc_io *mc_io,
-uint32_t cmd_flags,
-uint16_t token,
-struct dpci_peer_attr *attr)
-{
-   struct dpci_rsp_get_peer_attr *rsp_params;
-   struct mc_command cmd = { 0 };
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPCI_CMDID_GET_PEER_ATTR,
- cmd_flags,
- token);
-
-   /* send command to mc*/
-   err = mc_send_command(mc_io, &cmd);
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   rsp_params = (struct dpci_rsp_get_peer_attr *)cmd.params;
-   attr->peer_id = le32_to_cpu(rsp_params->id);
-   attr->num_of_priorities = rsp_params->num_of_priorities;
-
-   return 0;
-}
-
-/**
- * dpci_get_link_state() - Retrieve the DPCI link state.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPCI object
- * @up:Returned link state; returns '1' if link is up, '0' 
otherwise
- *
- * DPCI can be connected to another DPCI, together they
- * create a 'link'. In order to use the DPCI Tx and Rx queues,
- * both objects must be enabled.
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpci_get_link_state(struct fsl_mc_io *mc_io,
-   uint32_t cmd_flags,
-   uint16_t token,
-   int *up)
-{
-   struct dpci_rsp_get_link_state *rsp_params;
-   struct mc_command cmd = { 0 };
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPCI_CMDID_GET_LINK_STATE,
- cmd_flags,
- token);
-
-   /* send command to mc*/
-   err = mc_send_command(mc_io, &cmd);
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   rsp_params = (struct dpci_rsp_get_link_state *)cmd.params;
-   *up = dpci_get_field(rsp_params->up, UP);
-
-   return 0;
-}
-
 /**
  * dpci_set_rx_queue() - Set Rx queue configuration
  * @mc_io: Pointer to MC portal's I/O object
diff --git a/drivers/bus/fslmc/mc/dpcon.c b/drivers/bus/fslmc/mc/dpcon.c
index 92bd26512..3f6e04b97 100644
--- a/drivers/bus/fslmc/mc/dpcon.c
+++ b/drivers/bus/fslmc/mc/dpcon.c
@@ -295,36 +295,6 @@ int dpcon_get_attributes(struct fsl_mc_io *mc_io,
return 0;
 }
 
-/**
- * dpcon_set_notification() - Set DPCON notification destination
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPCON object
- * @cfg:   Notification parameters
- *
- * Return: '0' on Success; Error code otherwise
- */
-int dpcon_set_notification(struct fsl_mc_io *mc_io,
-  uint32_t cmd_flags,
-  uint16_t token,
-  struct dpcon_notification_cfg *cfg)
-{
-   struct dpcon_cmd_set_notification *dpcon_cmd;
-   struct mc_command cmd = { 0 };
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPCON_CMDID_SET_NOTIFICATION,
- cmd_flags,
- token);
-   dpcon_cmd = (struct dpcon_cmd_set_notification *)cmd.params;
-   dpcon_cmd->dpio_id = cpu_to_le32(cfg->dpio_id);
-   dpcon_cmd->priority = cfg->priority;
-   dpcon_cmd->user_ctx = cpu_to_le64(cfg->user_ctx);
-
-   /* send command to mc*/
-   return mc_send_command(mc_io, &cmd);
-}
-
 /**
  * dpcon_get_api_version - Get Data Path Concentrator API version
  * @mc_io: Pointer to MC por

[dpdk-dev] [PATCH 1/3] bus/fslmc: cleanup unused firmware code

2019-04-03 Thread Shreyansh Jain
Removes some unused firmware code which was added in last bump
of the firmware version. No current features uses these APIs.

Signed-off-by: Shreyansh Jain 
---
 drivers/bus/fslmc/mc/dpci.c  | 75 
 drivers/bus/fslmc/mc/dpcon.c | 30 -
 drivers/bus/fslmc/mc/fsl_dpci.h  | 21 -
 drivers/bus/fslmc/mc/fsl_dpcon.h | 19 
 4 files changed, 145 deletions(-)

diff --git a/drivers/bus/fslmc/mc/dpci.c b/drivers/bus/fslmc/mc/dpci.c
index 95edae9d9..2874a6196 100644
--- a/drivers/bus/fslmc/mc/dpci.c
+++ b/drivers/bus/fslmc/mc/dpci.c
@@ -301,81 +301,6 @@ int dpci_get_attributes(struct fsl_mc_io *mc_io,
return 0;
 }
 
-/**
- * dpci_get_peer_attributes() - Retrieve peer DPCI attributes.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPCI object
- * @attr:  Returned peer attributes
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpci_get_peer_attributes(struct fsl_mc_io *mc_io,
-uint32_t cmd_flags,
-uint16_t token,
-struct dpci_peer_attr *attr)
-{
-   struct dpci_rsp_get_peer_attr *rsp_params;
-   struct mc_command cmd = { 0 };
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPCI_CMDID_GET_PEER_ATTR,
- cmd_flags,
- token);
-
-   /* send command to mc*/
-   err = mc_send_command(mc_io, &cmd);
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   rsp_params = (struct dpci_rsp_get_peer_attr *)cmd.params;
-   attr->peer_id = le32_to_cpu(rsp_params->id);
-   attr->num_of_priorities = rsp_params->num_of_priorities;
-
-   return 0;
-}
-
-/**
- * dpci_get_link_state() - Retrieve the DPCI link state.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPCI object
- * @up:Returned link state; returns '1' if link is up, '0' 
otherwise
- *
- * DPCI can be connected to another DPCI, together they
- * create a 'link'. In order to use the DPCI Tx and Rx queues,
- * both objects must be enabled.
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpci_get_link_state(struct fsl_mc_io *mc_io,
-   uint32_t cmd_flags,
-   uint16_t token,
-   int *up)
-{
-   struct dpci_rsp_get_link_state *rsp_params;
-   struct mc_command cmd = { 0 };
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPCI_CMDID_GET_LINK_STATE,
- cmd_flags,
- token);
-
-   /* send command to mc*/
-   err = mc_send_command(mc_io, &cmd);
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   rsp_params = (struct dpci_rsp_get_link_state *)cmd.params;
-   *up = dpci_get_field(rsp_params->up, UP);
-
-   return 0;
-}
-
 /**
  * dpci_set_rx_queue() - Set Rx queue configuration
  * @mc_io: Pointer to MC portal's I/O object
diff --git a/drivers/bus/fslmc/mc/dpcon.c b/drivers/bus/fslmc/mc/dpcon.c
index 92bd26512..3f6e04b97 100644
--- a/drivers/bus/fslmc/mc/dpcon.c
+++ b/drivers/bus/fslmc/mc/dpcon.c
@@ -295,36 +295,6 @@ int dpcon_get_attributes(struct fsl_mc_io *mc_io,
return 0;
 }
 
-/**
- * dpcon_set_notification() - Set DPCON notification destination
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPCON object
- * @cfg:   Notification parameters
- *
- * Return: '0' on Success; Error code otherwise
- */
-int dpcon_set_notification(struct fsl_mc_io *mc_io,
-  uint32_t cmd_flags,
-  uint16_t token,
-  struct dpcon_notification_cfg *cfg)
-{
-   struct dpcon_cmd_set_notification *dpcon_cmd;
-   struct mc_command cmd = { 0 };
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPCON_CMDID_SET_NOTIFICATION,
- cmd_flags,
- token);
-   dpcon_cmd = (struct dpcon_cmd_set_notification *)cmd.params;
-   dpcon_cmd->dpio_id = cpu_to_le32(cfg->dpio_id);
-   dpcon_cmd->priority = cfg->priority;
-   dpcon_cmd->user_ctx = cpu_to_le64(cfg->user_ctx);
-
-   /* send command to mc*/
-   return mc_send_command(mc_io, &cmd);
-}
-
 /**
  * dpcon_get_api_version - Get Data Path Concentrator API version
  * @mc_io: Pointer to MC por

[dpdk-dev] [PATCH 2/3] drivers: update MC firmware version for FSLMC bus

2019-04-03 Thread Shreyansh Jain
MC firmware is the core component of FSLMC bus and DPAA2 devices.
Prior to this patch, MC firmware supported 10.10.x version. This
patch bumps the min supported version to 10.14.x.

Signed-off-by: Shreyansh Jain 
Acked-by: Hemant Agrawal 
---
 drivers/bus/fslmc/mc/fsl_dpmng.h|  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c|  1 +
 drivers/net/dpaa2/mc/dpni.c | 15 +-
 drivers/net/dpaa2/mc/fsl_dpni.h | 84 ++---
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h | 40 ++
 5 files changed, 110 insertions(+), 32 deletions(-)

diff --git a/drivers/bus/fslmc/mc/fsl_dpmng.h b/drivers/bus/fslmc/mc/fsl_dpmng.h
index 8559bef87..bef2ef095 100644
--- a/drivers/bus/fslmc/mc/fsl_dpmng.h
+++ b/drivers/bus/fslmc/mc/fsl_dpmng.h
@@ -18,7 +18,7 @@ struct fsl_mc_io;
  * Management Complex firmware version information
  */
 #define MC_VER_MAJOR 10
-#define MC_VER_MINOR 10
+#define MC_VER_MINOR 14
 
 /**
  * struct mc_version
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 3fbc82977..98ef8a5f5 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -665,6 +665,7 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev,
 DPNI_CONG_OPT_WRITE_MEM_ON_ENTER |
 DPNI_CONG_OPT_WRITE_MEM_ON_EXIT |
 DPNI_CONG_OPT_COHERENT_WRITE;
+   cong_notif_cfg.cg_point = DPNI_CP_QUEUE;
 
ret = dpni_set_congestion_notification(dpni, CMD_PRI_LOW,
   priv->token,
diff --git a/drivers/net/dpaa2/mc/dpni.c b/drivers/net/dpaa2/mc/dpni.c
index 6c12a0ae1..d9feb1427 100644
--- a/drivers/net/dpaa2/mc/dpni.c
+++ b/drivers/net/dpaa2/mc/dpni.c
@@ -125,6 +125,7 @@ int dpni_create(struct fsl_mc_io *mc_io,
cmd_params->vlan_filter_entries =  cfg->vlan_filter_entries;
cmd_params->qos_entries = cfg->qos_entries;
cmd_params->fs_entries = cpu_to_le16(cfg->fs_entries);
+   cmd_params->num_cgs = cfg->num_cgs;
 
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -199,7 +200,7 @@ int dpni_set_pools(struct fsl_mc_io *mc_io,
  token);
cmd_params = (struct dpni_cmd_set_pools *)cmd.params;
cmd_params->num_dpbp = cfg->num_dpbp;
-   for (i = 0; i < cmd_params->num_dpbp; i++) {
+   for (i = 0; i < DPNI_MAX_DPBP; i++) {
cmd_params->pool[i].dpbp_id =
cpu_to_le16(cfg->pools[i].dpbp_id);
cmd_params->pool[i].priority_mask =
@@ -593,6 +594,7 @@ int dpni_get_attributes(struct fsl_mc_io *mc_io,
attr->qos_key_size = rsp_params->qos_key_size;
attr->fs_key_size = rsp_params->fs_key_size;
attr->wriop_version = le16_to_cpu(rsp_params->wriop_version);
+   attr->num_cgs = rsp_params->num_cgs;
 
return 0;
 }
@@ -1800,6 +1802,8 @@ int dpni_set_congestion_notification(struct fsl_mc_io 
*mc_io,
cmd_params = (struct dpni_cmd_set_congestion_notification *)cmd.params;
cmd_params->qtype = qtype;
cmd_params->tc = tc_id;
+   cmd_params->congestion_point = cfg->cg_point;
+   cmd_params->cgid = (uint8_t)cfg->cgid;
cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id);
cmd_params->notification_mode = cpu_to_le16(cfg->notification_mode);
cmd_params->dest_priority = cfg->dest_cfg.priority;
@@ -1850,6 +1854,8 @@ int dpni_get_congestion_notification(struct fsl_mc_io 
*mc_io,
cmd_params = (struct dpni_cmd_get_congestion_notification *)cmd.params;
cmd_params->qtype = qtype;
cmd_params->tc = tc_id;
+   cmd_params->congestion_point = cfg->cg_point;
+   cmd_params->cgid = cfg->cgid;
 
/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -1949,6 +1955,7 @@ int dpni_set_queue(struct fsl_mc_io *mc_io,
   queue->destination.hold_active);
cmd_params->flc = cpu_to_le64(queue->flc.value);
cmd_params->user_context = cpu_to_le64(queue->user_context);
+   cmd_params->cgid = queue->cgid;
 
/* send command to mc */
return mc_send_command(mc_io, &cmd);
@@ -2010,6 +2017,10 @@ int dpni_get_queue(struct fsl_mc_io *mc_io,
queue->user_context = le64_to_cpu(rsp_params->user_context);
qid->fqid = le32_to_cpu(rsp_params->fqid);
qid->qdbin = le16_to_cpu(rsp_params->qdbin);
+   if (dpni_get_field(rsp_params->flags, CGID_VALID))
+   queue->cgid = rsp_params->cgid;
+   else
+   queue->cgid = -1;
 
return 0;
 }
@@ -2031,7 +2042,7 @@ int dpni_get_statistics(struct fsl_mc_io *mc_io,
uint32_t cmd_f

[dpdk-dev] [PATCH 3/3] doc: bump SDK support version for dpaa2

2019-04-03 Thread Shreyansh Jain
With the change in MC firmware, minimum supported version of
the Layerscape SDK too needs to be changed.

Signed-off-by: Shreyansh Jain 
---
 doc/guides/nics/dpaa2.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/dpaa2.rst b/doc/guides/nics/dpaa2.rst
index 392ab0580..d74d8f899 100644
--- a/doc/guides/nics/dpaa2.rst
+++ b/doc/guides/nics/dpaa2.rst
@@ -421,8 +421,8 @@ See :doc:`../platform/dpaa2` for setup information
 
 Currently supported by DPDK:
 
-- NXP SDK **18.09+**.
-- MC Firmware version **10.10.0** and higher.
+- NXP SDK **18.11+**.
+- MC Firmware version **10.14.0** and higher.
 - Supported architectures:  **arm64 LE**.
 
 - Follow the DPDK :ref:`Getting Started Guide for Linux ` to setup 
the basic DPDK environment.
-- 
2.19.1



[dpdk-dev] [PATCH 0/3] Update FSLMC bus firmware

2019-04-03 Thread Shreyansh Jain
Based on net-next: 69f805ac18abe

All the patches are strictly within DPAA2/FSLMC driver area.

MC firmware is the core component of FSLMC bus which enables
all the dpaa2 devices (eth, crypto etc).
With recent release of NXP's layerscape SDK, the MC firmware
has been bumped up. These patches updates only necessary
changes so as to maintain version compatibility.

Shreyansh Jain (3):
  bus/fslmc: cleanup unused firmware code
  drivers: update MC firmware version for FSLMC bus
  doc: bump SDK support version for dpaa2

 doc/guides/nics/dpaa2.rst   |  4 +-
 drivers/bus/fslmc/mc/dpci.c | 75 --
 drivers/bus/fslmc/mc/dpcon.c| 30 ---
 drivers/bus/fslmc/mc/fsl_dpci.h | 21 
 drivers/bus/fslmc/mc/fsl_dpcon.h| 19 ---
 drivers/bus/fslmc/mc/fsl_dpmng.h|  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c|  1 +
 drivers/net/dpaa2/mc/dpni.c | 15 +-
 drivers/net/dpaa2/mc/fsl_dpni.h | 84 ++---
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h | 40 ++
 10 files changed, 112 insertions(+), 179 deletions(-)

-- 
2.19.1



[dpdk-dev] [PATCH] net/dpaa2: accept packets with checksum error

2019-03-19 Thread Shreyansh Jain
Until now, DPAA2 driver was configured to drop any packet which
was marked as malformed by hardware - which included those with
wrong checksum.
With this patch, that configuration has been removed - hereafter,
all packets arriving on a DPMAC link would be forwarded to a DPNI
and further processing would be done as configured for a standard
packet path.

Signed-off-by: Shreyansh Jain 
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index a8f0e3002..c92edecf3 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -879,6 +879,7 @@ dpaa2_dev_start(struct rte_eth_dev *dev)
 
/*checksum errors, send them to normal path and set it in annotation */
err_cfg.errors = DPNI_ERROR_L3CE | DPNI_ERROR_L4CE;
+   err_cfg.errors |= DPNI_ERROR_PHE;
 
err_cfg.error_action = DPNI_ERROR_ACTION_CONTINUE;
err_cfg.set_frame_annotation = true;
-- 
2.17.1



Re: [dpdk-dev] [PATCH v3 00/20] NXP DPAA2 fixes and enhancements

2019-01-13 Thread Shreyansh Jain
On 11/01/19 9:42 PM, Ferruh Yigit wrote:
> On 1/11/2019 3:51 PM, Ferruh Yigit wrote:
>> On 1/11/2019 12:24 PM, Shreyansh Jain wrote:
>>> (N: Original series was by Hemant - due to RC window timeline and
>>>  his unavailability, respining on his behalf)
>>>
>>> This patch set covers following:
>>>
>>> 1. Fixes in the existing NXP DPAA2 bus and net pmd
>>> 2. New object (DPDMUX) support in NIC driver for better classification
>>> 3. Improvements to support secondary process
>>> 4. Upgrade the low level QBMAN HW lib
>>>
>>> History:
>>> v1->v2:
>>>   - Fix warning on Patch 20/20 - moved printfs to logging macro
>>> and PRIx changes
>>>   - reset author of 07/20 as the signoff and author didn't match
>>>   - Validate over master (a958a5c07f4b5e)
>>>   - Reword patch headline/commit based on check-git-log script
>>>
>>> v2->v3:
>>>   - Remove last (20/20) patch which was introducing a new API
>>> within FSLMC layer
>>>
>>> Akhil Goyal (1):
>>>net/dpaa2: enable optional timestamp in mbuf
>>>
>>> Hemant Agrawal (7):
>>>bus/fslmc: fix to use correct physical core for logical core
>>>net/dpaa2: fix bad check for not-null
>>>bus/fslmc: fix to convert error msg to warning
>>>bus/fslmc: upgrade to latest qbman library
>>>bus/fslmc: add dynamic config for memback portal mode
>>>bus/fslmc: rename portal pi index to consumer index
>>>bus/fslmc: make portal func static
>>>
>>> Nipun Gupta (4):
>>>net/dpaa2: add dpdmux mc flib
>>>bus/fslmc: add support for scanning DPDMUX object
>>>net/dpaa2: add dpdmux initialization and configuration
>>>net/dpaa2: add API to support custom hash key
>>>
>>> Sachin Saxena (1):
>>>bus/fslmc: fix to reset portal memory before use
>>>
>>> Shreyansh Jain (5):
>>>bus/fslmc: fix parse method for bus devices
>>>net/dpaa2: fix device init for secondary process
>>>mempool/dpaa2: support saving context of buffer pool
>>>net/dpaa2: change reference to private device
>>>bus/fslmc: add support for secondary processes
>>>
>>> Youri Querry (1):
>>>bus/fslmc: fix the ring mode to use correct cache settings
>>
>> Hi Shreyansh,
>>
>> Can I add your explicit ack to the series?
> 
> Series applied to dpdk-next-net/master, thanks.
> 
> (For ones from non-maintainers, Shreyansh's ack added)
> 

Hi Ferruh,

Apologies - I didn't notice this email earlier. I am OK with ACK you 
have applied and I have also replied back with a formal ACK to V3.

-
Shreyansh


Re: [dpdk-dev] [PATCH v3 00/20] NXP DPAA2 fixes and enhancements

2019-01-13 Thread Shreyansh Jain
On 11/01/19 5:54 PM, Shreyansh Jain wrote:
> (N: Original series was by Hemant - due to RC window timeline and
>  his unavailability, respining on his behalf)
> 
> This patch set covers following:
> 
> 1. Fixes in the existing NXP DPAA2 bus and net pmd
> 2. New object (DPDMUX) support in NIC driver for better classification
> 3. Improvements to support secondary process
> 4. Upgrade the low level QBMAN HW lib
> 
> History:
> v1->v2:
>   - Fix warning on Patch 20/20 - moved printfs to logging macro
> and PRIx changes
>   - reset author of 07/20 as the signoff and author didn't match
>   - Validate over master (a958a5c07f4b5e)
>   - Reword patch headline/commit based on check-git-log script
> 
> v2->v3:
>   - Remove last (20/20) patch which was introducing a new API
> within FSLMC layer
> 
> Akhil Goyal (1):
>net/dpaa2: enable optional timestamp in mbuf
> 
> Hemant Agrawal (7):
>bus/fslmc: fix to use correct physical core for logical core
>net/dpaa2: fix bad check for not-null
>bus/fslmc: fix to convert error msg to warning
>bus/fslmc: upgrade to latest qbman library
>bus/fslmc: add dynamic config for memback portal mode
>bus/fslmc: rename portal pi index to consumer index
>bus/fslmc: make portal func static
> 
> Nipun Gupta (4):
>net/dpaa2: add dpdmux mc flib
>bus/fslmc: add support for scanning DPDMUX object
>net/dpaa2: add dpdmux initialization and configuration
>net/dpaa2: add API to support custom hash key
> 
> Sachin Saxena (1):
>bus/fslmc: fix to reset portal memory before use
> 
> Shreyansh Jain (5):
>bus/fslmc: fix parse method for bus devices
>net/dpaa2: fix device init for secondary process
>mempool/dpaa2: support saving context of buffer pool
>net/dpaa2: change reference to private device
>bus/fslmc: add support for secondary processes
> 
> Youri Querry (1):
>bus/fslmc: fix the ring mode to use correct cache settings

Though the patches have already been applied, just for record, I am 
formally Ack'ing the series.

Series-Acked-by: Shreyansh Jain 


[dpdk-dev] [PATCH v3 15/19] net/dpaa2: add dpdmux initialization and configuration

2019-01-11 Thread Shreyansh Jain
From: Nipun Gupta 

This patch introduces an rte pmd API to configure dpdmux from
the application.
dpdmux can work in association with dpni as an additional
distribution capability on the NIC.

Signed-off-by: Nipun Gupta 
---
 drivers/net/dpaa2/Makefile  |   1 +
 drivers/net/dpaa2/dpaa2_ethdev.h|   2 +
 drivers/net/dpaa2/dpaa2_mux.c   | 222 
 drivers/net/dpaa2/meson.build   |   1 +
 drivers/net/dpaa2/rte_pmd_dpaa2.h   |  23 ++
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map |   1 +
 6 files changed, 250 insertions(+)
 create mode 100644 drivers/net/dpaa2/dpaa2_mux.c

diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile
index c58a39725..562551175 100644
--- a/drivers/net/dpaa2/Makefile
+++ b/drivers/net/dpaa2/Makefile
@@ -33,6 +33,7 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += base/dpaa2_hw_dpni.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_mux.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpkg.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpdmux.c
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 7cf6e4191..420ad6446 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -11,6 +11,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c
new file mode 100644
index 0..1d043dcdc
--- /dev/null
+++ b/drivers/net/dpaa2/dpaa2_mux.c
@@ -0,0 +1,222 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+struct dpaa2_dpdmux_dev {
+   TAILQ_ENTRY(dpaa2_dpdmux_dev) next;
+   /**< Pointer to Next device instance */
+   struct fsl_mc_io dpdmux;  /** handle to DPDMUX portal object */
+   uint16_t token;
+   uint32_t dpdmux_id; /*HW ID for DPDMUX object */
+   uint8_t num_ifs;   /* Number of interfaces in DPDMUX */
+};
+
+struct rte_flow {
+   struct dpdmux_rule_cfg rule;
+};
+
+TAILQ_HEAD(dpdmux_dev_list, dpaa2_dpdmux_dev);
+static struct dpdmux_dev_list dpdmux_dev_list =
+   TAILQ_HEAD_INITIALIZER(dpdmux_dev_list); /*!< DPDMUX device list */
+
+static struct dpaa2_dpdmux_dev *get_dpdmux_from_id(uint32_t dpdmux_id)
+{
+   struct dpaa2_dpdmux_dev *dpdmux_dev = NULL;
+
+   /* Get DPBP dev handle from list using index */
+   TAILQ_FOREACH(dpdmux_dev, &dpdmux_dev_list, next) {
+   if (dpdmux_dev->dpdmux_id == dpdmux_id)
+   break;
+   }
+
+   return dpdmux_dev;
+}
+
+struct rte_flow *
+rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id,
+ struct rte_flow_item *pattern[],
+ struct rte_flow_action *actions[])
+{
+   struct dpaa2_dpdmux_dev *dpdmux_dev;
+   struct dpkg_profile_cfg kg_cfg;
+   const struct rte_flow_item_ipv4 *spec;
+   const struct rte_flow_action_vf *vf_conf;
+   struct dpdmux_cls_action dpdmux_action;
+   struct rte_flow *flow = NULL;
+   void *key_iova, *mask_iova, *key_cfg_iova = NULL;
+   int ret;
+
+   if (pattern[0]->type != RTE_FLOW_ITEM_TYPE_IPV4) {
+   DPAA2_PMD_ERR("Not supported pattern type: %d",
+ pattern[0]->type);
+   return NULL;
+   }
+
+   /* Find the DPDMUX from dpdmux_id in our list */
+   dpdmux_dev = get_dpdmux_from_id(dpdmux_id);
+   if (!dpdmux_dev) {
+   DPAA2_PMD_ERR("Invalid dpdmux_id: %d", dpdmux_id);
+   return NULL;
+   }
+
+   key_cfg_iova = rte_zmalloc(NULL, DIST_PARAM_IOVA_SIZE,
+  RTE_CACHE_LINE_SIZE);
+   if (!key_cfg_iova) {
+   DPAA2_PMD_ERR("Unable to allocate flow-dist parameters");
+   return NULL;
+   }
+
+   /* Currently taking only IP protocol as an extract type.
+* This can be exended to other fields using pattern->type.
+*/
+   memset(&kg_cfg, 0, sizeof(struct dpkg_profile_cfg));
+   kg_cfg.extracts[0].extract.from_hdr.prot = NET_PROT_IP;
+   kg_cfg.extracts[0].extract.from_hdr.field = NH_FLD_IP_PROTO;
+   kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_HDR;
+   kg_cfg.extracts[0].extract.from_hdr.type = DPKG_FULL_FIELD;
+   kg_cfg.num_extracts = 1;
+
+   ret = dpkg_prepare_key_cfg(&kg_cfg, key_cfg_iova);
+   if (ret) {
+   DPAA2_PMD_ERR("dpkg_prepare_key_cfg failed: err(%d)", ret);
+   goto creation_error;
+   }
+
+   ret = dpdmux_set_custom_key(&dpdmux_dev->dpdmux, CMD_PRI_LOW,
+ 

[dpdk-dev] [PATCH v3 17/19] mempool/dpaa2: support saving context of buffer pool

2019-01-11 Thread Shreyansh Jain
Initial design was to have the buffer pool per process where a
global static array stores the bpids. But, in case of secondary
processes, this would not allow the I/O threads to translate the
bpid in Rx'd packets.

This patch moves the array to a global area (rte_malloc) and in
case of Rx thread not containing a valid reference to the array,
reference is build using the handle avaialble in the dpaa2_queue.

Signed-off-by: Shreyansh Jain 
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h  |  1 +
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 12 +++-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.h |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c |  1 +
 drivers/net/dpaa2/dpaa2_rxtx.c   |  5 +
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h 
b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index efbeebef9..20c606dbe 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -141,6 +141,7 @@ struct dpaa2_queue {
};
struct rte_event ev;
dpaa2_queue_cb_dqrr_t *cb;
+   struct dpaa2_bp_info *bp_array;
 };
 
 struct swp_active_dqs {
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c 
b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 790cded80..335eae40e 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -32,7 +32,7 @@
 
 #include 
 
-struct dpaa2_bp_info rte_dpaa2_bpid_info[MAX_BPID];
+struct dpaa2_bp_info *rte_dpaa2_bpid_info;
 static struct dpaa2_bp_list *h_bp_list;
 
 /* Dynamic logging identified for mempool */
@@ -50,6 +50,16 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp)
 
avail_dpbp = dpaa2_alloc_dpbp_dev();
 
+   if (rte_dpaa2_bpid_info == NULL) {
+   rte_dpaa2_bpid_info = (struct dpaa2_bp_info *)rte_malloc(NULL,
+ sizeof(struct dpaa2_bp_info) * MAX_BPID,
+ RTE_CACHE_LINE_SIZE);
+   if (rte_dpaa2_bpid_info == NULL)
+   return -ENOMEM;
+   memset(rte_dpaa2_bpid_info, 0,
+  sizeof(struct dpaa2_bp_info) * MAX_BPID);
+   }
+
if (!avail_dpbp) {
DPAA2_MEMPOOL_ERR("DPAA2 pool not available!");
return -ENOENT;
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.h 
b/drivers/mempool/dpaa2/dpaa2_hw_mempool.h
index 4d3468746..93694616e 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.h
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.h
@@ -59,7 +59,7 @@ struct dpaa2_bp_info {
 #define mempool_to_bpinfo(mp) ((struct dpaa2_bp_info *)(mp)->pool_data)
 #define mempool_to_bpid(mp) ((mempool_to_bpinfo(mp))->bpid)
 
-extern struct dpaa2_bp_info rte_dpaa2_bpid_info[MAX_BPID];
+extern struct dpaa2_bp_info *rte_dpaa2_bpid_info;
 
 int rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool,
   void **obj_table, unsigned int count);
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 861fbcd90..3a20158da 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -485,6 +485,7 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
}
dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[rx_queue_id];
dpaa2_q->mb_pool = mb_pool; /**< mbuf pool to populate RX ring. */
+   dpaa2_q->bp_array = rte_dpaa2_bpid_info;
 
/*Get the flow id from given VQ id*/
flow_id = rx_queue_id % priv->nb_rx_queues;
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 816ea00fd..6e2e8abd7 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -518,6 +518,11 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)
return 0;
}
}
+
+   if (unlikely(!rte_dpaa2_bpid_info &&
+rte_eal_process_type() == RTE_PROC_SECONDARY))
+   rte_dpaa2_bpid_info = dpaa2_q->bp_array;
+
swp = DPAA2_PER_LCORE_ETHRX_PORTAL;
pull_size = (nb_pkts > dpaa2_dqrr_size) ? dpaa2_dqrr_size : nb_pkts;
if (unlikely(!q_storage->active_dqs)) {
-- 
2.17.1



[dpdk-dev] [PATCH v3 19/19] bus/fslmc: add support for secondary processes

2019-01-11 Thread Shreyansh Jain
Previously FSLMC bus only supported blacklisting of DPNI (eth),
DPSECI (crypto) devices. With this patch, devices like DPIO,
DPMCP, and other DP* can also be blacklisted/whitelisted.

This is a required condition for secondary processes where the
secondary needs to be passed a mutually exclusive list of
resources as compared the primary and all other secondaries.

This patch also moves the DPIO memory from malloc to hugepage so
that in future in case the DPIO list can be shared, it can be
accessed in secondaries.

Once this patch is done, multi-process cases can be executed by
whitelisting/blacklisting devices in each instance.

Signed-off-by: Shreyansh Jain 
---
 drivers/bus/fslmc/fslmc_vfio.c   | 51 
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 24 +--
 2 files changed, 63 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 98768a46c..1aae56fa9 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016 NXP
+ *   Copyright 2016-2018 NXP
  *
  */
 
@@ -610,6 +610,15 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
 
/* check the MC version compatibility */
dpmng.regs = (void *)v_addr;
+
+   /* In case of secondary processes, MC version check is no longer
+* required.
+*/
+   if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+   rte_mcp_ptr_list[0] = (void *)v_addr;
+   return 0;
+   }
+
if (mc_get_version(&dpmng, CMD_PRI_LOW, &mc_ver_info)) {
DPAA2_BUS_ERR("Unable to obtain MC version");
ret = -1;
@@ -653,6 +662,15 @@ fslmc_vfio_process_group(void)
/* Search the MCP as that should be initialized first. */
TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
if (dev->dev_type == DPAA2_MPORTAL) {
+   if (dev->device.devargs &&
+   dev->device.devargs->policy == RTE_DEV_BLACKLISTED) 
{
+   DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping",
+ dev->device.name);
+   TAILQ_REMOVE(&rte_fslmc_bus.device_list,
+   dev, next);
+   continue;
+   }
+
ret = fslmc_process_mcp(dev);
if (ret) {
DPAA2_BUS_ERR("Unable to map MC Portal");
@@ -677,6 +695,13 @@ fslmc_vfio_process_group(void)
}
 
TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
+   if (dev->device.devargs &&
+   dev->device.devargs->policy == RTE_DEV_BLACKLISTED) {
+   DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping",
+ dev->device.name);
+   TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
+   continue;
+   }
switch (dev->dev_type) {
case DPAA2_ETH:
case DPAA2_CRYPTO:
@@ -689,10 +714,17 @@ fslmc_vfio_process_group(void)
}
break;
case DPAA2_CON:
-   case DPAA2_IO:
case DPAA2_CI:
case DPAA2_BPOOL:
case DPAA2_MUX:
+   /* IN case of secondary processes, all control objects
+* like dpbp, dpcon, dpci are not initialized/required
+* - all of these are assumed to be initialized and made
+*   available by primary.
+*/
+   if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+   continue;
+
/* Call the object creation routine and remove the
 * device entry from device list
 */
@@ -703,12 +735,15 @@ fslmc_vfio_process_group(void)
return -1;
}
 
-   /* This device is not required to be in the DPDK
-* exposed device list.
-*/
-   TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
-   free(dev);
-   dev = NULL;
+   break;
+   case DPAA2_IO:
+   ret = fslmc_process_iodevices(dev);
+   if (ret) {
+   DPAA2_BUS_DEBUG("Dev (%s) ini

[dpdk-dev] [PATCH v3 16/19] net/dpaa2: add API to support custom hash key

2019-01-11 Thread Shreyansh Jain
From: Nipun Gupta 

The DPAA2 hw can support a special offset based
configuration to program distribution on hash.
This is for all cases, which are not directly supported.

e.g. HASH based distribution on inner ip header
of a GRE tunnel.

Signed-off-by: Nipun Gupta 
---
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c  | 52 -
 drivers/net/dpaa2/rte_pmd_dpaa2.h   | 28 +++
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  1 +
 3 files changed, 80 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c 
b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index a6f86df8c..11f14931e 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016 NXP
+ *   Copyright 2016-2018 NXP
  *
  */
 
@@ -28,6 +28,56 @@ dpaa2_distset_to_dpkg_profile_cfg(
uint64_t req_dist_set,
struct dpkg_profile_cfg *kg_cfg);
 
+int
+rte_pmd_dpaa2_set_custom_hash(uint16_t port_id,
+ uint16_t offset,
+ uint8_t size)
+{
+   struct rte_eth_dev *eth_dev = &rte_eth_devices[port_id];
+   struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
+   struct fsl_mc_io *dpni = priv->hw;
+   struct dpni_rx_tc_dist_cfg tc_cfg;
+   struct dpkg_profile_cfg kg_cfg;
+   void *p_params;
+   int ret, tc_index = 0;
+
+   p_params = rte_zmalloc(
+   NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE);
+   if (!p_params) {
+   DPAA2_PMD_ERR("Unable to allocate flow-dist parameters");
+   return -ENOMEM;
+   }
+
+   kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_DATA;
+   kg_cfg.extracts[0].extract.from_data.offset = offset;
+   kg_cfg.extracts[0].extract.from_data.size = size;
+   kg_cfg.num_extracts = 1;
+
+   ret = dpkg_prepare_key_cfg(&kg_cfg, p_params);
+   if (ret) {
+   DPAA2_PMD_ERR("Unable to prepare extract parameters");
+   rte_free(p_params);
+   return ret;
+   }
+
+   memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg));
+   tc_cfg.key_cfg_iova = (size_t)(DPAA2_VADDR_TO_IOVA(p_params));
+   tc_cfg.dist_size = eth_dev->data->nb_rx_queues;
+   tc_cfg.dist_mode = DPNI_DIST_MODE_HASH;
+
+   ret = dpni_set_rx_tc_dist(dpni, CMD_PRI_LOW, priv->token, tc_index,
+ &tc_cfg);
+   rte_free(p_params);
+   if (ret) {
+   DPAA2_PMD_ERR(
+"Setting distribution for Rx failed with err: %d",
+ret);
+   return ret;
+   }
+
+   return 0;
+}
+
 int
 dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
  uint64_t req_dist_set)
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h 
b/drivers/net/dpaa2/rte_pmd_dpaa2.h
index 57de27f21..7052d9da9 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2.h
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h
@@ -59,4 +59,32 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id,
  struct rte_flow_item *pattern[],
  struct rte_flow_action *actions[]);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Create a custom hash key on basis of offset of start of packet and size.
+ * for e.g. if we need GRE packets (non-vlan and without any extra headers)
+ * to be hashed on basis of inner IP header, we will provide offset as:
+ * 14 (eth) + 20 (IP) + 4 (GRE) + 12 (Inner Src offset) = 50 and size
+ * as 8 bytes.
+ *
+ * @param port_id
+ *The port identifier of the Ethernet device.
+ * @param offset
+ *Offset from the start of packet which needs to be included to
+ *calculate hash
+ * @param size
+ *Size of the hash input key
+ *
+ * @return
+ *   - 0 if successful.
+ *   - Negative in case of failure.
+ */
+__rte_experimental
+int
+rte_pmd_dpaa2_set_custom_hash(uint16_t port_id,
+ uint16_t offset,
+ uint8_t size);
+
 #endif /* _RTE_PMD_DPAA2_H */
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map 
b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
index 1661c5fb5..d1b4cdb23 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
@@ -15,5 +15,6 @@ EXPERIMENTAL {
global:
 
rte_pmd_dpaa2_mux_flow_create;
+   rte_pmd_dpaa2_set_custom_hash;
rte_pmd_dpaa2_set_timestamp;
 } DPDK_17.11;
-- 
2.17.1



[dpdk-dev] [PATCH v3 18/19] net/dpaa2: change reference to private device

2019-01-11 Thread Shreyansh Jain
The I/O threads for DPAA2 take their reference for bpool ID, the
port ID and other info like qdid, from the rte_eth_dev. Further,
to get this data during I/O operation, a reference of the RTE
device is kept in the queue structure (dpaa2_queue).

In case of secondary processes, rte_eth_dev is not same as the
primary process. Thus, the reference goes invalid.

This patch changes the implementation to use the dev_private
rather than the rte_eth_dev as that is shared area across
all the processes.

Signed-off-by: Shreyansh Jain 
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |  5 -
 drivers/net/dpaa2/dpaa2_ethdev.c|  4 ++--
 drivers/net/dpaa2/dpaa2_rxtx.c  | 18 ++
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h 
b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 20c606dbe..626fcbbca 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -127,7 +127,10 @@ typedef void (dpaa2_queue_cb_dqrr_t)(struct qbman_swp *swp,
 
 struct dpaa2_queue {
struct rte_mempool *mb_pool; /**< mbuf pool to populate RX ring. */
-   void *dev;
+   union {
+   struct rte_eth_dev_data *eth_data;
+   void *dev;
+   };
int32_t eventfd;/*!< Event Fd of this queue */
uint32_t fqid;  /*!< Unique ID of this queue */
uint8_t tc_index;   /*!< traffic class identifier */
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 3a20158da..2b90f4021 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -244,7 +244,7 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev)
}
 
for (i = 0; i < priv->nb_rx_queues; i++) {
-   mc_q->dev = dev;
+   mc_q->eth_data = dev->data;
priv->rx_vq[i] = mc_q++;
dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[i];
dpaa2_q->q_storage = rte_malloc("dq_storage",
@@ -260,7 +260,7 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev)
}
 
for (i = 0; i < priv->nb_tx_queues; i++) {
-   mc_q->dev = dev;
+   mc_q->eth_data = dev->data;
mc_q->flow_id = 0x;
priv->tx_vq[i] = mc_q++;
dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i];
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 6e2e8abd7..2d4b9ef14 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -509,7 +509,7 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)
const struct qbman_fd *fd, *next_fd;
struct qbman_pull_desc pulldesc;
struct queue_storage_info_t *q_storage = dpaa2_q->q_storage;
-   struct rte_eth_dev *dev = dpaa2_q->dev;
+   struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data;
 
if (unlikely(!DPAA2_PER_LCORE_ETHRX_DPIO)) {
ret = dpaa2_affine_qbman_ethrx_swp();
@@ -613,9 +613,10 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)
bufs[num_rx] = eth_sg_fd_to_mbuf(fd);
else
bufs[num_rx] = eth_fd_to_mbuf(fd);
-   bufs[num_rx]->port = dev->data->port_id;
+   bufs[num_rx]->port = eth_data->port_id;
 
-   if (dev->data->dev_conf.rxmode.offloads & 
DEV_RX_OFFLOAD_VLAN_STRIP)
+   if (eth_data->dev_conf.rxmode.offloads &
+   DEV_RX_OFFLOAD_VLAN_STRIP)
rte_vlan_strip(bufs[num_rx]);
 
dq_storage++;
@@ -716,8 +717,8 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t 
nb_pkts)
struct qbman_swp *swp;
uint16_t num_tx = 0;
uint16_t bpid;
-   struct rte_eth_dev *dev = dpaa2_q->dev;
-   struct dpaa2_dev_priv *priv = dev->data->dev_private;
+   struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data;
+   struct dpaa2_dev_priv *priv = eth_data->dev_private;
uint32_t flags[MAX_TX_RING_SLOTS] = {0};
 
if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -729,7 +730,8 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t 
nb_pkts)
}
swp = DPAA2_PER_LCORE_PORTAL;
 
-   DPAA2_PMD_DP_DEBUG("===> dev =%p, fqid =%d\n", dev, dpaa2_q->fqid);
+   DPAA2_PMD_DP_DEBUG("===> eth_data =%p, fqid =%d\n",
+   eth_data, dpaa2_q->fqid);
 
/*Prepare enqueue descriptor*/
qbman_eq_desc_clear(&eqdesc);
@@ -772,7 +774,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t 
nb_pkts)
rte_mbuf_refcnt_read((*bufs)) == 1)) {
   

[dpdk-dev] [PATCH v3 14/19] bus/fslmc: add support for scanning DPDMUX object

2019-01-11 Thread Shreyansh Jain
From: Nipun Gupta 

Add support in bus and vfio to scan dpdmux type of objects

Signed-off-by: Nipun Gupta 
---
 drivers/bus/fslmc/fslmc_bus.c  | 5 -
 drivers/bus/fslmc/fslmc_vfio.c | 2 ++
 drivers/bus/fslmc/rte_fslmc.h  | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 565e0148f..fa1505377 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -187,6 +187,8 @@ scan_one_fslmc_device(char *dev_name)
dev->dev_type = DPAA2_MPORTAL;
else if (!strncmp("dpdmai", t_ptr, 6))
dev->dev_type = DPAA2_QDMA;
+   else if (!strncmp("dpdmux", t_ptr, 6))
+   dev->dev_type = DPAA2_MUX;
else
dev->dev_type = DPAA2_UNKNOWN;
 
@@ -245,7 +247,8 @@ rte_fslmc_parse(const char *name, void *addr)
strncmp("dpio", t_ptr, 4) &&
strncmp("dpci", t_ptr, 4) &&
strncmp("dpmcp", t_ptr, 5) &&
-   strncmp("dpdmai", t_ptr, 6)) {
+   strncmp("dpdmai", t_ptr, 6) &&
+   strncmp("dpdmux", t_ptr, 6)) {
DPAA2_BUS_ERR("Unknown or unsupported device");
goto err_out;
}
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index ce82a99f6..98768a46c 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -560,6 +560,7 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev)
case DPAA2_IO:
case DPAA2_CI:
case DPAA2_BPOOL:
+   case DPAA2_MUX:
TAILQ_FOREACH(object, &dpaa2_obj_list, next) {
if (dev->dev_type == object->dev_type)
object->create(dev_fd, &device_info,
@@ -691,6 +692,7 @@ fslmc_vfio_process_group(void)
case DPAA2_IO:
case DPAA2_CI:
case DPAA2_BPOOL:
+   case DPAA2_MUX:
/* Call the object creation routine and remove the
 * device entry from device list
 */
diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h
index cea5b78f9..5cfb24505 100644
--- a/drivers/bus/fslmc/rte_fslmc.h
+++ b/drivers/bus/fslmc/rte_fslmc.h
@@ -66,6 +66,7 @@ enum rte_dpaa2_dev_type {
DPAA2_CI,   /**< DPCI type device */
DPAA2_MPORTAL,  /**< DPMCP type device */
DPAA2_QDMA, /**< DPDMAI type device */
+   DPAA2_MUX,  /**< DPDMUX type device */
/* Unknown device placeholder */
DPAA2_UNKNOWN,
DPAA2_DEVTYPE_MAX,
-- 
2.17.1



[dpdk-dev] [PATCH v3 12/19] bus/fslmc: make portal func static

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

Change QBMAN portal function to static as it is not exposed outside
this file context.

Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 37723a094..cd28441f3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -229,7 +229,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, 
int lcoreid)
return 0;
 }
 
-struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int lcoreid)
+static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int lcoreid)
 {
struct dpaa2_dpio_dev *dpio_dev = NULL;
int ret;
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
index 462501a2e..4354c76de 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
@@ -37,8 +37,6 @@ extern uint8_t dpaa2_eqcr_size;
 
 extern struct dpaa2_io_portal_t dpaa2_io_portal[RTE_MAX_LCORE];
 
-struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id);
-
 /* Affine a DPIO portal to current processing thread */
 int dpaa2_affine_qbman_swp(void);
 
-- 
2.17.1



[dpdk-dev] [PATCH v3 13/19] net/dpaa2: add dpdmux mc flib

2019-01-11 Thread Shreyansh Jain
From: Nipun Gupta 

dpdmux object is added as a part of net driver as it is used to
de-multiplex packets to separate interfaces on basis of specific rules.
These rules can be configured from the software

Signed-off-by: Nipun Gupta 
---
 drivers/net/dpaa2/Makefile|   1 +
 drivers/net/dpaa2/mc/dpdmux.c | 929 ++
 drivers/net/dpaa2/mc/fsl_dpdmux.h | 410 
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h | 221 ++
 drivers/net/dpaa2/meson.build |   1 +
 5 files changed, 1562 insertions(+)
 create mode 100644 drivers/net/dpaa2/mc/dpdmux.c
 create mode 100644 drivers/net/dpaa2/mc/fsl_dpdmux.h
 create mode 100644 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h

diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile
index 2b9c011d6..c58a39725 100644
--- a/drivers/net/dpaa2/Makefile
+++ b/drivers/net/dpaa2/Makefile
@@ -35,6 +35,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpkg.c
+SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpdmux.c
 
 LDLIBS += -lrte_bus_fslmc
 LDLIBS += -lrte_mempool_dpaa2
diff --git a/drivers/net/dpaa2/mc/dpdmux.c b/drivers/net/dpaa2/mc/dpdmux.c
new file mode 100644
index 0..7962213b7
--- /dev/null
+++ b/drivers/net/dpaa2/mc/dpdmux.c
@@ -0,0 +1,929 @@
+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+ *
+ * Copyright 2013-2016 Freescale Semiconductor Inc.
+ * Copyright 2018 NXP
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+
+/** @addtogroup dpdmux
+ * @{
+ */
+
+/**
+ * dpdmux_open() - Open a control session for the specified object
+ * @mc_io: Pointer to MC portal's I/O object
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+ * @dpdmux_id: DPDMUX unique ID
+ * @token: Returned token; use in subsequent API calls
+ *
+ * This function can be used to open a control session for an
+ * already created object; an object may have been declared in
+ * the DPL or by calling the dpdmux_create() function.
+ * This function returns a unique authentication token,
+ * associated with the specific object ID and the specific MC
+ * portal; this token must be used in all subsequent commands for
+ * this specific object.
+ *
+ * Return: '0' on Success; Error code otherwise.
+ */
+int dpdmux_open(struct fsl_mc_io *mc_io,
+   uint32_t cmd_flags,
+   int dpdmux_id,
+   uint16_t *token)
+{
+   struct mc_command cmd = { 0 };
+   struct dpdmux_cmd_open *cmd_params;
+   int err;
+
+   /* prepare command */
+   cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_OPEN,
+ cmd_flags,
+ 0);
+   cmd_params = (struct dpdmux_cmd_open *)cmd.params;
+   cmd_params->dpdmux_id = cpu_to_le32(dpdmux_id);
+
+   /* send command to mc*/
+   err = mc_send_command(mc_io, &cmd);
+   if (err)
+   return err;
+
+   /* retrieve response parameters */
+   *token = mc_cmd_hdr_read_token(&cmd);
+
+   return 0;
+}
+
+/**
+ * dpdmux_close() - Close the control session of the object
+ * @mc_io: Pointer to MC portal's I/O object
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token: Token of DPDMUX object
+ *
+ * After this function is called, no further operations are
+ * allowed on the object without opening a new control session.
+ *
+ * Return: '0' on Success; Error code otherwise.
+ */
+int dpdmux_close(struct fsl_mc_io *mc_io,
+uint32_t cmd_flags,
+uint16_t token)
+{
+   struct mc_command cmd = { 0 };
+
+   /* prepare command */
+   cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_CLOSE,
+ cmd_flags,
+ token);
+
+   /* send command to mc*/
+   return mc_send_command(mc_io, &cmd);
+}
+
+/**
+ * dpdmux_create() - Create the DPDMUX object
+ * @mc_io: Pointer to MC portal's I/O object
+ * @dprc_token:Parent container token; '0' for default container
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+ * @cfg:   Configuration structure
+ * @obj_id: returned object id
+ *
+ * Create the DPDMUX object, allocate required resources and
+ * perform required initialization.
+ *
+ * The object can be created either by declaring it in the
+ * DPL file, or by calling this function.
+ *
+ * The function accepts an authentication token of a parent
+ * container that this object should be assigned to. The token
+ * can be '0' so the object will be assigned to the default container.
+ * The newly created object can be opened with the returned
+ * object id and using the container's associated tokens and MC portals.
+ *
+ * Return: '0' on Success; Error code otherwise.
+ */
+int dpdmux_create(struct fsl_mc_io *mc_io,

[dpdk-dev] [PATCH v3 09/19] bus/fslmc: upgrade to latest qbman library

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

This patch upgrades and sync the dpdk based qbman code
with new version of qbman flib.

Signed-off-by: Youri Querry 
Signed-off-by: Nipun Gupta 
Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/qbman/qbman_portal.c |  8 
 drivers/bus/fslmc/qbman/qbman_sys.h| 17 +++--
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c 
b/drivers/bus/fslmc/qbman/qbman_portal.c
index bbea37efc..2f572a08b 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -201,7 +201,7 @@ struct qbman_swp *qbman_swp_init(const struct 
qbman_swp_desc *d)
p->vdq.valid_bit = QB_VALID_BIT;
p->dqrr.valid_bit = QB_VALID_BIT;
qman_version = p->desc.qman_version;
-   if ((qman_version & 0x) < QMAN_REV_4100) {
+   if ((qman_version & QMAN_REV_MASK) < QMAN_REV_4100) {
p->dqrr.dqrr_size = 4;
p->dqrr.reset_bug = 1;
} else {
@@ -1315,9 +1315,9 @@ const struct qbman_result 
*qbman_swp_dqrr_next_mem_back(struct qbman_swp *s)
 */
flags = p->dq.stat;
response_verb = verb & QBMAN_RESPONSE_VERB_MASK;
-   if ((response_verb == QBMAN_RESULT_DQ) &&
-   (flags & QBMAN_DQ_STAT_VOLATILE) &&
-   (flags & QBMAN_DQ_STAT_EXPIRED))
+   if ((response_verb == QBMAN_RESULT_DQ)
+   && (flags & QBMAN_DQ_STAT_VOLATILE)
+   && (flags & QBMAN_DQ_STAT_EXPIRED))
atomic_inc(&s->vdq.busy);
return p;
 }
diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h 
b/drivers/bus/fslmc/qbman/qbman_sys.h
index 0571097ab..e3bd1c5e6 100644
--- a/drivers/bus/fslmc/qbman/qbman_sys.h
+++ b/drivers/bus/fslmc/qbman/qbman_sys.h
@@ -387,6 +387,10 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys 
*s,
 {
uint32_t reg;
int i;
+   int cena_region_size = 4*1024;
+
+   if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000)
+   cena_region_size = 64*1024;
 #ifdef RTE_ARCH_64
uint8_t wn = CENA_WRITE_ENABLE;
 #else
@@ -396,7 +400,8 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys 
*s,
s->addr_cena = d->cena_bar;
s->addr_cinh = d->cinh_bar;
s->idx = (uint32_t)d->idx;
-   s->cena = malloc(64*1024);
+   s->cena = malloc(cena_region_size);
+
if (!s->cena) {
pr_err("Could not allocate page for cena shadow\n");
return -1;
@@ -412,12 +417,12 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys 
*s,
QBMAN_BUG_ON(reg);
 #endif
if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000)
-   memset(s->addr_cena, 0, 64*1024);
+   memset(s->addr_cena, 0, cena_region_size);
else {
/* Invalidate the portal memory.
 * This ensures no stale cache lines
 */
-   for (i = 0; i < 0x1000; i += 64)
+   for (i = 0; i < cena_region_size; i += 64)
dccivac(s->addr_cena + i);
}
 
@@ -425,12 +430,12 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys 
*s,
reg = qbman_set_swp_cfg(dqrr_size, wn,
0, 3, 2, 3, 1, 1, 1, 1, 1, 1);
else {
-   if ((d->qman_version & QMAN_REV_MASK) < QMAN_REV_5000)
+   if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000)
reg = qbman_set_swp_cfg(dqrr_size, wn,
-   1, 3, 2, 2, 1, 1, 1, 1, 1, 1);
+   1, 3, 2, 0, 1, 1, 1, 1, 1, 1);
else
reg = qbman_set_swp_cfg(dqrr_size, wn,
-   1, 3, 2, 0, 1, 1, 1, 1, 1, 1);
+   1, 3, 2, 2, 1, 1, 1, 1, 1, 1);
}
 
if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) {
-- 
2.17.1



[dpdk-dev] [PATCH v3 11/19] bus/fslmc: rename portal pi index to consumer index

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

This is to align with the latest qbman hw library

Signed-off-by: Youri Querry 
Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/qbman/qbman_portal.c | 51 +++---
 drivers/bus/fslmc/qbman/qbman_portal.h |  2 +-
 2 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c 
b/drivers/bus/fslmc/qbman/qbman_portal.c
index 08bfdc9f8..14f4b0344 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -251,21 +251,21 @@ struct qbman_swp *qbman_swp_init(const struct 
qbman_swp_desc *d)
}
 
for (mask_size = p->eqcr.pi_ring_size; mask_size > 0; mask_size >>= 1)
-   p->eqcr.pi_mask = (p->eqcr.pi_mask<<1) + 1;
+   p->eqcr.pi_ci_mask = (p->eqcr.pi_ci_mask<<1) + 1;
eqcr_pi = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI);
-   p->eqcr.pi = eqcr_pi & p->eqcr.pi_mask;
+   p->eqcr.pi = eqcr_pi & p->eqcr.pi_ci_mask;
p->eqcr.pi_vb = eqcr_pi & QB_VALID_BIT;
if ((p->desc.qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
&& (d->cena_access_mode == qman_cena_fastest_access))
-   p->eqcr.ci = qbman_cinh_read(&p->sys,
-   QBMAN_CINH_SWP_EQCR_CI) & p->eqcr.pi_mask;
+   p->eqcr.ci = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI)
+& p->eqcr.pi_ci_mask;
else
-   p->eqcr.ci = qbman_cinh_read(&p->sys,
-   QBMAN_CINH_SWP_EQCR_PI) & p->eqcr.pi_mask;
+   p->eqcr.ci = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_CI)
+& p->eqcr.pi_ci_mask;
p->eqcr.available = p->eqcr.pi_ring_size -
qm_cyc_diff(p->eqcr.pi_ring_size,
-   p->eqcr.ci & (p->eqcr.pi_mask<<1),
-   p->eqcr.pi & (p->eqcr.pi_mask<<1));
+   p->eqcr.ci & (p->eqcr.pi_ci_mask<<1),
+   p->eqcr.pi & (p->eqcr.pi_ci_mask<<1));
 
portal_idx_map[p->desc.idx] = p;
return p;
@@ -646,8 +646,8 @@ static int qbman_swp_enqueue_ring_mode_direct(struct 
qbman_swp *s,
const uint32_t *cl = qb_cl(d);
uint32_t eqcr_ci, full_mask, half_mask;
 
-   half_mask = (s->eqcr.pi_mask>>1);
-   full_mask = s->eqcr.pi_mask;
+   half_mask = (s->eqcr.pi_ci_mask>>1);
+   full_mask = s->eqcr.pi_ci_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
s->eqcr.ci = qbman_cena_read_reg(&s->sys,
@@ -685,8 +685,8 @@ static int qbman_swp_enqueue_ring_mode_mem_back(struct 
qbman_swp *s,
const uint32_t *cl = qb_cl(d);
uint32_t eqcr_ci, full_mask, half_mask;
 
-   half_mask = (s->eqcr.pi_mask>>1);
-   full_mask = s->eqcr.pi_mask;
+   half_mask = (s->eqcr.pi_ci_mask>>1);
+   full_mask = s->eqcr.pi_ci_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
s->eqcr.ci = qbman_cena_read_reg(&s->sys,
@@ -743,8 +743,8 @@ static int qbman_swp_enqueue_multiple_direct(struct 
qbman_swp *s,
int i, num_enqueued = 0;
uint64_t addr_cena;
 
-   half_mask = (s->eqcr.pi_mask>>1);
-   full_mask = s->eqcr.pi_mask;
+   half_mask = (s->eqcr.pi_ci_mask>>1);
+   full_mask = s->eqcr.pi_ci_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
s->eqcr.ci = qbman_cena_read_reg(&s->sys,
@@ -811,8 +811,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct 
qbman_swp *s,
uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
int i, num_enqueued = 0;
 
-   half_mask = (s->eqcr.pi_mask>>1);
-   full_mask = s->eqcr.pi_mask;
+   half_mask = (s->eqcr.pi_ci_mask>>1);
+   full_mask = s->eqcr.pi_ci_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
s->eqcr.ci = qbman_cena_read_reg(&s->sys,
@@ -833,15 +833,6 @@ static int qbman_swp_enqueue_multiple_mem_back(struct 
qbman_swp *s,
QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
memcpy(&p[1], &cl[1], 28);
memcpy(&p[8], &fd[i], sizeof(*fd));
-   eqcr_pi++;
-   }
-
-   /* Set the verb byte, have to substitute in the valid-bit */
-   eqcr_pi = s->eqcr.pi;
-   for (i = 0; i < num_enqueued; i++) {
-   p = qbman_cena_write_start_wo_shadow(&s->sys,
-   QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
-   p[0] = cl[0] | s->eqcr.pi_vb;
if (flags && (flags[i] & QBMAN_ENQUEUE_FLAG_DCA)) {
struct qbman_eq_desc *d = (struct qbman_eq_desc *)p;
 
@@ -849,6 +840,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct 
qbman_swp *s,
((flags[i]) & QBMAN_EQCR_DCA_IDX

[dpdk-dev] [PATCH v3 10/19] bus/fslmc: add dynamic config for memback portal mode

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

Add flag in portal init to adjust the qbman memory type,
to decide between legacy portal mode or newly introduced
memory backed portals.

Signed-off-by: Roy Pledge 
Signed-off-by: Youri Querry 
Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c  |  2 +
 .../bus/fslmc/qbman/include/fsl_qbman_base.h  | 11 +++-
 drivers/bus/fslmc/qbman/qbman_portal.c| 52 +++
 drivers/bus/fslmc/qbman/qbman_sys.h   | 20 ---
 4 files changed, 53 insertions(+), 32 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index ba2e28ce1..37723a094 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -509,6 +509,8 @@ dpaa2_create_dpio_device(int vdev_fd,
p_des.cinh_bar = (void *)(dpio_dev->qbman_portal_ci_paddr);
p_des.irq = -1;
p_des.qman_version = attr.qbman_version;
+   p_des.eqcr_mode = qman_eqcr_vb_ring;
+   p_des.cena_access_mode = qman_cena_fastest_access;
 
dpio_dev->sw_portal = qbman_swp_init(&p_des);
if (dpio_dev->sw_portal == NULL) {
diff --git a/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h 
b/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h
index bb60a98f9..48bdaafa4 100644
--- a/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h
+++ b/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (C) 2014 Freescale Semiconductor, Inc.
+ * Copyright 2017-2018 NXP
  *
  */
 #ifndef _FSL_QBMAN_BASE_H
@@ -33,7 +34,12 @@ struct qbman_block_desc {
 
 enum qbman_eqcr_mode {
qman_eqcr_vb_ring = 2, /* Valid bit, with eqcr in ring mode */
-   qman_eqcr_vb_array, /* Valid bit, with eqcr in array mode */
+   qman_eqcr_vb_array,/* Valid bit, with eqcr in array mode */
+};
+
+enum qbman_cena_access_mode {
+   qman_cena_fastest_access = 0, /* Use memory backed node if available */
+   qman_cena_direct_access,  /* Use direct access to the CENA region */
 };
 
 /**
@@ -46,6 +52,8 @@ enum qbman_eqcr_mode {
  * @qman_version: the qman version.
  * @eqcr_mode: Select the eqcr mode, currently only valid bit ring mode and
  * valid bit array mode are supported.
+ * @cena_access_mode: Mode used to access the CENA region, direct
+ *or memory backed.
  *
  * Descriptor for a QBMan software portal, expressed in terms that make sense 
to
  * the user context. Ie. on MC, this information is likely to be true-physical,
@@ -62,6 +70,7 @@ struct qbman_swp_desc {
int idx;
uint32_t qman_version;
enum qbman_eqcr_mode eqcr_mode;
+   enum qbman_cena_access_mode cena_access_mode;
 };
 
 /* Driver object for managing a QBMan portal */
diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c 
b/drivers/bus/fslmc/qbman/qbman_portal.c
index 2f572a08b..08bfdc9f8 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -194,7 +194,8 @@ struct qbman_swp *qbman_swp_init(const struct 
qbman_swp_desc *d)
p->sdq |= qbman_sdqcr_dct_prio_ics << QB_SDQCR_DCT_SHIFT;
p->sdq |= qbman_sdqcr_fc_up_to_3 << QB_SDQCR_FC_SHIFT;
p->sdq |= QMAN_SDQCR_TOKEN << QB_SDQCR_TOK_SHIFT;
-   if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000)
+   if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
+   && (d->cena_access_mode == qman_cena_fastest_access))
p->mr.valid_bit = QB_VALID_BIT;
 
atomic_set(&p->vdq.busy, 1);
@@ -233,7 +234,8 @@ struct qbman_swp *qbman_swp_init(const struct 
qbman_swp_desc *d)
qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_SDQCR, 0);
 
p->eqcr.pi_ring_size = 8;
-   if ((qman_version & 0x) >= QMAN_REV_5000) {
+   if ((qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
+   && (d->cena_access_mode == qman_cena_fastest_access)) {
p->eqcr.pi_ring_size = 32;
qbman_swp_enqueue_array_mode_ptr =
qbman_swp_enqueue_array_mode_mem_back;
@@ -253,7 +255,8 @@ struct qbman_swp *qbman_swp_init(const struct 
qbman_swp_desc *d)
eqcr_pi = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI);
p->eqcr.pi = eqcr_pi & p->eqcr.pi_mask;
p->eqcr.pi_vb = eqcr_pi & QB_VALID_BIT;
-   if ((p->desc.qman_version & QMAN_REV_MASK) < QMAN_REV_5000)
+   if ((p->desc.qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
+   && (d->cena_access_mode == qman_cena_fastest_access))
p->eqcr.ci = qbman_cinh_read(&p->sys,
QBMAN_CINH_SWP_EQCR_CI) & p->eqcr.pi_mask;
else
@@ -362,10 +365,11 @@ void *qbman_swp_mc_start(struct qbman_swp *p)
 #ifdef QBMAN_CHECKING
QBMAN_BUG_ON(p->mc.check != swp_mc_can_start);
 #endif
-   if ((p->desc.qman_version & QMAN_REV_MASK) < QMAN_REV_5000)
-   ret = qbma

[dpdk-dev] [PATCH v3 07/19] net/dpaa2: fix device init for secondary process

2019-01-11 Thread Shreyansh Jain
In order to support I/O from secondary process, the
burst APIs and OPS APIs shall be mapped/plugged.

Fixes: c147eae01cb3 ("net/dpaa2: introduce NXP DPAA2 driver")
Cc: sta...@dpdk.org

Signed-off-by: Shreyansh Jain 
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 8d4ea1bca..39f85ae7b 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1918,8 +1918,15 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
PMD_INIT_FUNC_TRACE();
 
/* For secondary processes, the primary has done all the work */
-   if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+   if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+   /* In case of secondary, only burst and ops API need to be
+* plugged.
+*/
+   eth_dev->dev_ops = &dpaa2_ethdev_ops;
+   eth_dev->rx_pkt_burst = dpaa2_dev_prefetch_rx;
+   eth_dev->tx_pkt_burst = dpaa2_dev_tx;
return 0;
+   }
 
dpaa2_dev = container_of(dev, struct rte_dpaa2_device, device);
 
-- 
2.17.1



[dpdk-dev] [PATCH v3 08/19] net/dpaa2: enable optional timestamp in mbuf

2019-01-11 Thread Shreyansh Jain
From: Akhil Goyal 

This patch enables the population of timestamp field
in mbuf on packet receive.
It may give performance impact on LX2xxx platforms.
So, it has been made optional for Lx2xxx platform.
One shall call, rte_dpaa2_enable_ts() to enable it.

Nothing is required for LS2 and LS1088 platforms.

Signed-off-by: Akhil Goyal 
---
 doc/api/doxy-api-index.md   |  1 +
 doc/api/doxy-api.conf.in|  1 +
 drivers/net/dpaa2/Makefile  |  2 ++
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c  |  2 ++
 drivers/net/dpaa2/dpaa2_ethdev.c|  9 +
 drivers/net/dpaa2/dpaa2_ethdev.h|  4 +++
 drivers/net/dpaa2/dpaa2_rxtx.c  | 18 ++
 drivers/net/dpaa2/meson.build   |  2 ++
 drivers/net/dpaa2/rte_pmd_dpaa2.h   | 39 +
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  6 
 10 files changed, 84 insertions(+)
 create mode 100644 drivers/net/dpaa2/rte_pmd_dpaa2.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index e27874c5a..d95ad566c 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -43,6 +43,7 @@ The public API headers are grouped by topics:
   [i40e]   (@ref rte_pmd_i40e.h),
   [bnxt]   (@ref rte_pmd_bnxt.h),
   [dpaa]   (@ref rte_pmd_dpaa.h),
+  [dpaa2]  (@ref rte_pmd_dpaa2.h),
   [dpaa2_mempool]  (@ref rte_dpaa2_mempool.h),
   [dpaa2_cmdif](@ref rte_pmd_dpaa2_cmdif.h),
   [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h),
diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in
index 77ba327a8..bef9320c0 100644
--- a/doc/api/doxy-api.conf.in
+++ b/doc/api/doxy-api.conf.in
@@ -9,6 +9,7 @@ INPUT   = @TOPDIR@/doc/api/doxy-api-index.md \
   @TOPDIR@/drivers/net/bnxt \
   @TOPDIR@/drivers/net/bonding \
   @TOPDIR@/drivers/net/dpaa \
+  @TOPDIR@/drivers/net/dpaa2 \
   @TOPDIR@/drivers/net/i40e \
   @TOPDIR@/drivers/net/ixgbe \
   @TOPDIR@/drivers/net/softnic \
diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile
index ca5f7a336..2b9c011d6 100644
--- a/drivers/net/dpaa2/Makefile
+++ b/drivers/net/dpaa2/Makefile
@@ -42,4 +42,6 @@ LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 LDLIBS += -lrte_common_dpaax
 
+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA2_PMD)-include := rte_pmd_dpaa2.h
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c 
b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 713a41bf3..a6f86df8c 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -296,8 +296,10 @@ dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
 DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
 DPNI_BUF_LAYOUT_OPT_DATA_ALIGN |
+DPNI_BUF_LAYOUT_OPT_TIMESTAMP |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
 
+   layout.pass_timestamp = true;
layout.pass_frame_status = 1;
layout.private_data_size = DPAA2_FD_PTA_SIZE;
layout.pass_parser_result = 1;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 39f85ae7b..861fbcd90 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -56,6 +56,9 @@ static uint64_t dev_tx_offloads_nodis =
DEV_TX_OFFLOAD_MT_LOCKFREE |
DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 
+/* enable timestamp in mbuf */
+enum pmd_dpaa2_ts dpaa2_enable_ts;
+
 struct rte_dpaa2_xstats_name_off {
char name[RTE_ETH_XSTATS_NAME_SIZE];
uint8_t page_id; /* dpni statistics page id */
@@ -88,6 +91,12 @@ static int dpaa2_dev_mtu_set(struct rte_eth_dev *dev, 
uint16_t mtu);
 
 int dpaa2_logtype_pmd;
 
+__rte_experimental void
+rte_pmd_dpaa2_set_timestamp(enum pmd_dpaa2_ts enable)
+{
+   dpaa2_enable_ts = enable;
+}
+
 static int
 dpaa2_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 {
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index bd69f523d..7cf6e4191 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -9,6 +9,7 @@
 #define _DPAA2_ETHDEV_H
 
 #include 
+#include 
 
 #include 
 #include 
@@ -83,6 +84,9 @@
 #define DPAA2_PKT_TYPE_VLAN_1  0x0160
 #define DPAA2_PKT_TYPE_VLAN_2  0x0260
 
+/* enable timestamp in mbuf*/
+extern enum pmd_dpaa2_ts dpaa2_enable_ts;
+
 struct dpaa2_dev_priv {
void *hw;
int32_t hw_id;
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index eab943dcf..816ea00fd 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa

[dpdk-dev] [PATCH v3 05/19] bus/fslmc: fix to convert error msg to warning

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

This is just a information. No need to print
it as a error.

Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging")
Cc: sta...@dpdk.org

Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/fslmc_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 493b6e5be..ce82a99f6 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -176,7 +176,7 @@ static int vfio_map_irq_region(struct fslmc_vfio_group 
*group)
vaddr = (unsigned long *)mmap(NULL, 0x1000, PROT_WRITE |
PROT_READ, MAP_SHARED, container_device_fd, 0x603);
if (vaddr == MAP_FAILED) {
-   DPAA2_BUS_ERR("Unable to map region (errno = %d)", errno);
+   DPAA2_BUS_INFO("Unable to map region (errno = %d)", errno);
return -errno;
}
 
-- 
2.17.1



[dpdk-dev] [PATCH v3 06/19] bus/fslmc: fix parse method for bus devices

2019-01-11 Thread Shreyansh Jain
Current code expects that bus->parse() would get a string containing
the name of the bus. That is incorrect. bus->parse() is expected
to have strings like:
  dpni.1,key=val
  dpio.2,key=val

when user passed:
  -b fslmc:dpni.1,key=val

This commit fixes this behavior.

Fixes: 50245be05d1a ("bus/fslmc: support device blacklisting")
Cc: sta...@dpdk.org

Signed-off-by: Shreyansh Jain 
---
 drivers/bus/fslmc/fslmc_bus.c | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 89af9385a..565e0148f 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016 NXP
+ *   Copyright 2016,2018 NXP
  *
  */
 
@@ -227,20 +227,16 @@ static int
 rte_fslmc_parse(const char *name, void *addr)
 {
uint16_t dev_id;
-   char *t_ptr;
-   char *sep = strchr(name, ':');
+   char *t_ptr = NULL, *dname = NULL;
 
-   if (strncmp(name, RTE_STR(FSLMC_BUS_NAME),
-   strlen(RTE_STR(FSLMC_BUS_NAME {
-   return -EINVAL;
-   }
+   /* 'name' is expected to contain name of device, for example, dpio.1,
+* dpni.2, etc.
+*/
 
-   if (!sep) {
-   DPAA2_BUS_ERR("Incorrect device name observed");
+   dname = strdup(name);
+   if (!dname)
return -EINVAL;
-   }
-
-   t_ptr = (char *)(sep + 1);
+   t_ptr = dname;
 
if (strncmp("dpni", t_ptr, 4) &&
strncmp("dpseci", t_ptr, 6) &&
@@ -251,24 +247,29 @@ rte_fslmc_parse(const char *name, void *addr)
strncmp("dpmcp", t_ptr, 5) &&
strncmp("dpdmai", t_ptr, 6)) {
DPAA2_BUS_ERR("Unknown or unsupported device");
-   return -EINVAL;
+   goto err_out;
}
 
t_ptr = strchr(name, '.');
if (!t_ptr) {
DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr);
-   return -EINVAL;
+   goto err_out;
}
 
t_ptr = (char *)(t_ptr + 1);
if (sscanf(t_ptr, "%hu", &dev_id) <= 0) {
DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr);
-   return -EINVAL;
+   goto err_out;
}
+   free(dname);
 
if (addr)
-   strcpy(addr, (char *)(sep + 1));
+   strcpy(addr, name);
+
return 0;
+err_out:
+   free(dname);
+   return -EINVAL;
 }
 
 static int
-- 
2.17.1



[dpdk-dev] [PATCH v3 04/19] net/dpaa2: fix bad check for not-null

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

The check !dpaa2->cscn is not correct to check non-null value.

Fixes: 5d9a1e4d23fe ("net/dpaa2: enhance queue memory cleanup")
Cc: sta...@dpdk.org

Signed-off-by: Hemant Agrawal 
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index fa71807e6..8d4ea1bca 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -311,8 +311,7 @@ dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev)
/* cleanup tx queue cscn */
for (i = 0; i < priv->nb_tx_queues; i++) {
dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i];
-   if (!dpaa2_q->cscn)
-   rte_free(dpaa2_q->cscn);
+   rte_free(dpaa2_q->cscn);
}
/*free memory for all queues (RX+TX) */
rte_free(priv->rx_vq[0]);
-- 
2.17.1



[dpdk-dev] [PATCH v3 03/19] bus/fslmc: fix to use correct physical core for logical core

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

Existing code is using the lcore id as the physical core
id. Add code to get the right physical id.

Also, dpaa2 can not support one lcore mapping to multiple cpus,
print err on such cases.

Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging")
Cc: sta...@dpdk.org

Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 76 
 1 file changed, 63 insertions(+), 13 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 4fc6efec5..ba2e28ce1 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -53,6 +53,10 @@ static uint32_t io_space_count;
 /* Variable to store DPAA2 platform type */
 uint32_t dpaa2_svr_family;
 
+/* Physical core id for lcores running on dpaa2. */
+/* DPAA2 only support 1 lcore to 1 phy cpu mapping */
+static unsigned int dpaa2_cpu[RTE_MAX_LCORE];
+
 /* Variable to store DPAA2 DQRR size */
 uint8_t dpaa2_dqrr_size;
 /* Variable to store DPAA2 EQCR size */
@@ -92,7 +96,8 @@ dpaa2_core_cluster_sdest(int cpu_id)
 }
 
 #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV
-static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
+static void
+dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id, int lcoreid)
 {
 #define STRING_LEN 28
 #define COMMAND_LEN50
@@ -125,7 +130,7 @@ static void 
dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
return;
}
 
-   cpu_mask = cpu_mask << rte_lcore_id();
+   cpu_mask = cpu_mask << dpaa2_cpu[lcoreid];
snprintf(command, COMMAND_LEN, "echo %X > /proc/irq/%s/smp_affinity",
 cpu_mask, token);
ret = system(command);
@@ -139,7 +144,7 @@ static void 
dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
fclose(file);
 }
 
-static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)
+static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int lcoreid)
 {
struct epoll_event epoll_ev;
int eventfd, dpio_epoll_fd, ret;
@@ -176,32 +181,36 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev 
*dpio_dev)
}
dpio_dev->epoll_fd = dpio_epoll_fd;
 
-   dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id);
+   dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id, lcoreid);
 
return 0;
 }
 #endif
 
 static int
-dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
+dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int lcoreid)
 {
int sdest, ret;
+   int cpu_id;
 
/* Set the Stashing Destination */
-   if (cpu_id < 0) {
-   cpu_id = rte_get_master_lcore();
-   if (cpu_id < 0) {
+   if (lcoreid < 0) {
+   lcoreid = rte_get_master_lcore();
+   if (lcoreid < 0) {
DPAA2_BUS_ERR("Getting CPU Index failed");
return -1;
}
}
+
+   cpu_id = dpaa2_cpu[lcoreid];
+
/* Set the STASH Destination depending on Current CPU ID.
 * Valid values of SDEST are 4,5,6,7. Where,
 */
 
sdest = dpaa2_core_cluster_sdest(cpu_id);
-   DPAA2_BUS_DEBUG("Portal= %d  CPU= %u SDEST= %d",
-   dpio_dev->index, cpu_id, sdest);
+   DPAA2_BUS_DEBUG("Portal= %d  CPU= %u lcore id =%u SDEST= %d",
+   dpio_dev->index, cpu_id, lcoreid, sdest);
 
ret = dpio_set_stashing_destination(dpio_dev->dpio, CMD_PRI_LOW,
dpio_dev->token, sdest);
@@ -211,7 +220,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, 
int cpu_id)
}
 
 #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV
-   if (dpaa2_dpio_intr_init(dpio_dev)) {
+   if (dpaa2_dpio_intr_init(dpio_dev, lcoreid)) {
DPAA2_BUS_ERR("Interrupt registration failed for dpio");
return -1;
}
@@ -220,7 +229,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, 
int cpu_id)
return 0;
 }
 
-struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id)
+struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int lcoreid)
 {
struct dpaa2_dpio_dev *dpio_dev = NULL;
int ret;
@@ -236,7 +245,7 @@ struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id)
DPAA2_BUS_DEBUG("New Portal %p (%d) affined thread - %lu",
dpio_dev, dpio_dev->index, syscall(SYS_gettid));
 
-   ret = dpaa2_configure_stashing(dpio_dev, cpu_id);
+   ret = dpaa2_configure_stashing(dpio_dev, lcoreid);
if (ret)
DPAA2_BUS_ERR("dpaa2_configure_stashing failed");
 
@@ -340,6 +349,39 @@ dpaa2_affine_qbman_ethrx_swp(void)
}
 }
 
+/*
+ * This checks for not supported lcore mappings as well as get the physical
+ * cpuid for the lcore.
+ * one lcore can only map to 1 cpu i.e. 1@10-14 not supported.
+ * one cpu can be mapped to more than one lcores.
+ */

[dpdk-dev] [PATCH v3 02/19] bus/fslmc: fix the ring mode to use correct cache settings

2019-01-11 Thread Shreyansh Jain
From: Youri Querry 

The code was incorrectly using the cache inhibited access.
It shall use cached enabled access for better performance.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: sta...@dpdk.org

Signed-off-by: Youri Querry 
---
 drivers/bus/fslmc/qbman/qbman_portal.c | 12 ++--
 drivers/bus/fslmc/qbman/qbman_sys.h|  1 +
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c 
b/drivers/bus/fslmc/qbman/qbman_portal.c
index 3380e54f5..bbea37efc 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -683,8 +683,8 @@ static int qbman_swp_enqueue_ring_mode_mem_back(struct 
qbman_swp *s,
full_mask = s->eqcr.pi_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
-   s->eqcr.ci = qbman_cinh_read(&s->sys,
-   QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+   s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+   QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
eqcr_ci, s->eqcr.ci);
if (!s->eqcr.available)
@@ -809,8 +809,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct 
qbman_swp *s,
full_mask = s->eqcr.pi_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
-   s->eqcr.ci = qbman_cinh_read(&s->sys,
-   QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+   s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+   QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
eqcr_ci, s->eqcr.ci);
if (!s->eqcr.available)
@@ -941,8 +941,8 @@ static int qbman_swp_enqueue_multiple_desc_mem_back(struct 
qbman_swp *s,
full_mask = s->eqcr.pi_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
-   s->eqcr.ci = qbman_cinh_read(&s->sys,
-   QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+   s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+   QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
eqcr_ci, s->eqcr.ci);
if (!s->eqcr.available)
diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h 
b/drivers/bus/fslmc/qbman/qbman_sys.h
index d41af8358..0571097ab 100644
--- a/drivers/bus/fslmc/qbman/qbman_sys.h
+++ b/drivers/bus/fslmc/qbman/qbman_sys.h
@@ -55,6 +55,7 @@
 #define QBMAN_CENA_SWP_RR(vb)  (0x700 + ((uint32_t)(vb) >> 1))
 #define QBMAN_CENA_SWP_VDQCR   0x780
 #define QBMAN_CENA_SWP_EQCR_CI 0x840
+#define QBMAN_CENA_SWP_EQCR_CI_MEMBACK 0x1840
 
 /* CENA register offsets in memory-backed mode */
 #define QBMAN_CENA_SWP_DQRR_MEM(n)  (0x800 + ((uint32_t)(n) << 6))
-- 
2.17.1



[dpdk-dev] [PATCH v3 01/19] bus/fslmc: fix to reset portal memory before use

2019-01-11 Thread Shreyansh Jain
From: Sachin Saxena 

Uninitialized portal memory is causing unwanted issues.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: sta...@dpdk.org

Signed-off-by: Sachin Saxena 
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index ce0699842..4fc6efec5 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -369,6 +369,8 @@ dpaa2_create_dpio_device(int vdev_fd,
dpio_dev->mc_portal = rte_mcp_ptr_list[MC_PORTAL_INDEX];
 
dpio_dev->dpio = malloc(sizeof(struct fsl_mc_io));
+   memset(dpio_dev->dpio, 0, sizeof(struct fsl_mc_io));
+
if (!dpio_dev->dpio) {
DPAA2_BUS_ERR("Memory allocation failure");
goto err;
-- 
2.17.1



[dpdk-dev] [PATCH v3 00/20] NXP DPAA2 fixes and enhancements

2019-01-11 Thread Shreyansh Jain
(N: Original series was by Hemant - due to RC window timeline and
his unavailability, respining on his behalf)

This patch set covers following:

1. Fixes in the existing NXP DPAA2 bus and net pmd
2. New object (DPDMUX) support in NIC driver for better classification
3. Improvements to support secondary process
4. Upgrade the low level QBMAN HW lib

History:
v1->v2:
 - Fix warning on Patch 20/20 - moved printfs to logging macro
   and PRIx changes
 - reset author of 07/20 as the signoff and author didn't match
 - Validate over master (a958a5c07f4b5e)
 - Reword patch headline/commit based on check-git-log script

v2->v3:
 - Remove last (20/20) patch which was introducing a new API
   within FSLMC layer

Akhil Goyal (1):
  net/dpaa2: enable optional timestamp in mbuf

Hemant Agrawal (7):
  bus/fslmc: fix to use correct physical core for logical core
  net/dpaa2: fix bad check for not-null
  bus/fslmc: fix to convert error msg to warning
  bus/fslmc: upgrade to latest qbman library
  bus/fslmc: add dynamic config for memback portal mode
  bus/fslmc: rename portal pi index to consumer index
  bus/fslmc: make portal func static

Nipun Gupta (4):
  net/dpaa2: add dpdmux mc flib
  bus/fslmc: add support for scanning DPDMUX object
  net/dpaa2: add dpdmux initialization and configuration
  net/dpaa2: add API to support custom hash key

Sachin Saxena (1):
  bus/fslmc: fix to reset portal memory before use

Shreyansh Jain (5):
  bus/fslmc: fix parse method for bus devices
  net/dpaa2: fix device init for secondary process
  mempool/dpaa2: support saving context of buffer pool
  net/dpaa2: change reference to private device
  bus/fslmc: add support for secondary processes

Youri Querry (1):
  bus/fslmc: fix the ring mode to use correct cache settings

 doc/api/doxy-api-index.md |   1 +
 doc/api/doxy-api.conf.in  |   1 +
 drivers/bus/fslmc/fslmc_bus.c |  38 +-
 drivers/bus/fslmc/fslmc_vfio.c|  55 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c  | 100 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h  |   2 -
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   |   6 +-
 .../bus/fslmc/qbman/include/fsl_qbman_base.h  |  11 +-
 drivers/bus/fslmc/qbman/qbman_portal.c| 123 ++-
 drivers/bus/fslmc/qbman/qbman_portal.h|   2 +-
 drivers/bus/fslmc/qbman/qbman_sys.h   |  34 +-
 drivers/bus/fslmc/rte_fslmc.h |   1 +
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  |  12 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.h  |   2 +-
 drivers/net/dpaa2/Makefile|   4 +
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c|  54 +-
 drivers/net/dpaa2/dpaa2_ethdev.c  |  26 +-
 drivers/net/dpaa2/dpaa2_ethdev.h  |   6 +
 drivers/net/dpaa2/dpaa2_mux.c | 222 +
 drivers/net/dpaa2/dpaa2_rxtx.c|  41 +-
 drivers/net/dpaa2/mc/dpdmux.c | 929 ++
 drivers/net/dpaa2/mc/fsl_dpdmux.h | 410 
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h | 221 +
 drivers/net/dpaa2/meson.build |   4 +
 drivers/net/dpaa2/rte_pmd_dpaa2.h |  90 ++
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map   |   8 +
 26 files changed, 2267 insertions(+), 136 deletions(-)
 create mode 100644 drivers/net/dpaa2/dpaa2_mux.c
 create mode 100644 drivers/net/dpaa2/mc/dpdmux.c
 create mode 100644 drivers/net/dpaa2/mc/fsl_dpdmux.h
 create mode 100644 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h
 create mode 100644 drivers/net/dpaa2/rte_pmd_dpaa2.h

-- 
2.17.1



Re: [dpdk-dev] [PATCH 20/20] bus/fslmc: add function to map any addr via VFIO

2019-01-11 Thread Shreyansh Jain
On 11/01/19 5:28 PM, Ferruh Yigit wrote:
> On 1/10/2019 9:58 AM, Shreyansh Jain wrote:
>> Hello Ferruh,
>>
>> Replying on behalf of Hemant...
>>
>> On 08/01/19 7:40 PM, Ferruh Yigit wrote:
>>> On 12/27/2018 6:23 AM, Hemant Agrawal wrote:
>>>> From: Pankaj Chauhan 

[...]

>>>> +DPDK_19.02 {
>>>> +  global:
>>>> +
>>>> +  rte_fslmc_vfio_mem_dmamap;
>>>
>>> Is this need to be an API? Who is the consumer of this API, I don't see 
>>> anyone
>>> calls this function?
>>>
>>
>> This API (internal to FSLMC) was added for one of NXP's internal
>> software stack over DPDK. As this is an internal API, I don't think it
>> would pollute the outer namespace - isn't it? And, I think its consumers
>> won't necessarily be within DPDK stack.
>>
>> Or, if this is conflicting case, I will remove this patch (it is
>> independent) and send again. Let me know your reservation.
> 
> API consumers doesn't have to be in DPDK but than it is not an internal API.
> 
> And for API we recently decided to have an implementation for new APIs, it can
> be unit test, sample application, or app like testpmd, so that we can detect
> when it is broken.
> 
> Perhaps it can be good idea to separate patch, as you suggested, to not block
> the rest of the patchset.
> 

Oops, I think I sent my series just about the time you wrote this.
I will send it again (v3) without the last patch. I am OK with that API 
not making it in right now.


[dpdk-dev] [PATCH v2 16/20] net/dpaa2: add API to support custom hash key

2019-01-11 Thread Shreyansh Jain
From: Nipun Gupta 

The DPAA2 hw can support a special offset based
configuration to program distribution on hash.
This is for all cases, which are not directly supported.

e.g. HASH based distribution on inner ip header
of a GRE tunnel.

Signed-off-by: Nipun Gupta 
---
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c  | 52 -
 drivers/net/dpaa2/rte_pmd_dpaa2.h   | 28 +++
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  1 +
 3 files changed, 80 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c 
b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index a6f86df8c..11f14931e 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016 NXP
+ *   Copyright 2016-2018 NXP
  *
  */
 
@@ -28,6 +28,56 @@ dpaa2_distset_to_dpkg_profile_cfg(
uint64_t req_dist_set,
struct dpkg_profile_cfg *kg_cfg);
 
+int
+rte_pmd_dpaa2_set_custom_hash(uint16_t port_id,
+ uint16_t offset,
+ uint8_t size)
+{
+   struct rte_eth_dev *eth_dev = &rte_eth_devices[port_id];
+   struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
+   struct fsl_mc_io *dpni = priv->hw;
+   struct dpni_rx_tc_dist_cfg tc_cfg;
+   struct dpkg_profile_cfg kg_cfg;
+   void *p_params;
+   int ret, tc_index = 0;
+
+   p_params = rte_zmalloc(
+   NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE);
+   if (!p_params) {
+   DPAA2_PMD_ERR("Unable to allocate flow-dist parameters");
+   return -ENOMEM;
+   }
+
+   kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_DATA;
+   kg_cfg.extracts[0].extract.from_data.offset = offset;
+   kg_cfg.extracts[0].extract.from_data.size = size;
+   kg_cfg.num_extracts = 1;
+
+   ret = dpkg_prepare_key_cfg(&kg_cfg, p_params);
+   if (ret) {
+   DPAA2_PMD_ERR("Unable to prepare extract parameters");
+   rte_free(p_params);
+   return ret;
+   }
+
+   memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg));
+   tc_cfg.key_cfg_iova = (size_t)(DPAA2_VADDR_TO_IOVA(p_params));
+   tc_cfg.dist_size = eth_dev->data->nb_rx_queues;
+   tc_cfg.dist_mode = DPNI_DIST_MODE_HASH;
+
+   ret = dpni_set_rx_tc_dist(dpni, CMD_PRI_LOW, priv->token, tc_index,
+ &tc_cfg);
+   rte_free(p_params);
+   if (ret) {
+   DPAA2_PMD_ERR(
+"Setting distribution for Rx failed with err: %d",
+ret);
+   return ret;
+   }
+
+   return 0;
+}
+
 int
 dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
  uint64_t req_dist_set)
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h 
b/drivers/net/dpaa2/rte_pmd_dpaa2.h
index 57de27f21..7052d9da9 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2.h
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h
@@ -59,4 +59,32 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id,
  struct rte_flow_item *pattern[],
  struct rte_flow_action *actions[]);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Create a custom hash key on basis of offset of start of packet and size.
+ * for e.g. if we need GRE packets (non-vlan and without any extra headers)
+ * to be hashed on basis of inner IP header, we will provide offset as:
+ * 14 (eth) + 20 (IP) + 4 (GRE) + 12 (Inner Src offset) = 50 and size
+ * as 8 bytes.
+ *
+ * @param port_id
+ *The port identifier of the Ethernet device.
+ * @param offset
+ *Offset from the start of packet which needs to be included to
+ *calculate hash
+ * @param size
+ *Size of the hash input key
+ *
+ * @return
+ *   - 0 if successful.
+ *   - Negative in case of failure.
+ */
+__rte_experimental
+int
+rte_pmd_dpaa2_set_custom_hash(uint16_t port_id,
+ uint16_t offset,
+ uint8_t size);
+
 #endif /* _RTE_PMD_DPAA2_H */
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map 
b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
index 1661c5fb5..d1b4cdb23 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
@@ -15,5 +15,6 @@ EXPERIMENTAL {
global:
 
rte_pmd_dpaa2_mux_flow_create;
+   rte_pmd_dpaa2_set_custom_hash;
rte_pmd_dpaa2_set_timestamp;
 } DPDK_17.11;
-- 
2.17.1



[dpdk-dev] [PATCH v2 20/20] bus/fslmc: add function to map any addr via VFIO

2019-01-11 Thread Shreyansh Jain
From: Pankaj Chauhan 

This is required to map any accelerator memory
and PCI address to VFIO using QDMA.

Signed-off-by: Minghuan Lian 
Signed-off-by: Pankaj Chauhan 
---
 drivers/bus/fslmc/fslmc_vfio.c  | 43 +
 drivers/bus/fslmc/fslmc_vfio.h  |  1 +
 drivers/bus/fslmc/rte_bus_fslmc_version.map |  7 
 3 files changed, 51 insertions(+)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 1aae56fa9..786089334 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -50,6 +50,7 @@ static struct fslmc_vfio_group vfio_group;
 static struct fslmc_vfio_container vfio_container;
 static int container_device_fd;
 static char *g_container;
+static int fslmc_iommu_type;
 static uint32_t *msi_intr_vaddr;
 void *(*rte_mcp_ptr_list);
 
@@ -90,6 +91,9 @@ fslmc_get_container_group(int *groupid)
}
}
 
+   fslmc_iommu_type = (rte_vfio_noiommu_is_enabled() == 1) ?
+   RTE_VFIO_NOIOMMU : VFIO_TYPE1_IOMMU;
+
/* get group number */
ret = rte_vfio_get_group_num(SYSFS_FSL_MC_DEVICES,
 g_container, groupid);
@@ -344,6 +348,45 @@ fslmc_dmamap_seg(const struct rte_memseg_list *msl 
__rte_unused,
return ret;
 }
 
+int rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size)
+{
+   int ret;
+   struct fslmc_vfio_group *group;
+   struct vfio_iommu_type1_dma_map dma_map = {
+   .argsz = sizeof(struct vfio_iommu_type1_dma_map),
+   .flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE,
+   };
+
+   if (fslmc_iommu_type == RTE_VFIO_NOIOMMU) {
+   DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
+   return 0;
+   }
+
+   /* SET DMA MAP for IOMMU */
+   group = &vfio_group;
+   if (!group->container) {
+   DPAA2_BUS_ERR("Container is not connected");
+   return -1;
+   }
+
+   dma_map.size = size;
+   dma_map.vaddr = vaddr;
+   dma_map.iova = iova;
+
+   DPAA2_BUS_DEBUG("FSLMC VFIO dmamap 0x%"PRIx64":0x%"PRIx64","
+   " size 0x%"PRIx64"", (uint64_t)dma_map.vaddr,
+   (uint64_t)dma_map.iova, (uint64_t)dma_map.size);
+   ret = ioctl(group->container->fd, VFIO_IOMMU_MAP_DMA,
+   &dma_map);
+   if (ret) {
+   DPAA2_BUS_ERR("Unable to map DMA address (errno = %d)",
+ errno);
+   return ret;
+   }
+
+   return 0;
+}
+
 int rte_fslmc_vfio_dmamap(void)
 {
int i = 0, ret;
diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h
index 9e2c4feef..4e750d623 100644
--- a/drivers/bus/fslmc/fslmc_vfio.h
+++ b/drivers/bus/fslmc/fslmc_vfio.h
@@ -50,5 +50,6 @@ int fslmc_vfio_process_group(void);
 char *fslmc_get_container(void);
 int fslmc_get_container_group(int *gropuid);
 int rte_fslmc_vfio_dmamap(void);
+int rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size);
 
 #endif /* _FSLMC_VFIO_H_ */
diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map 
b/drivers/bus/fslmc/rte_bus_fslmc_version.map
index dcc4e082e..c4192d978 100644
--- a/drivers/bus/fslmc/rte_bus_fslmc_version.map
+++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map
@@ -129,3 +129,10 @@ DPDK_18.11 {
dpci_set_opr;
 
 } DPDK_18.05;
+
+DPDK_19.02 {
+   global:
+
+   rte_fslmc_vfio_mem_dmamap;
+
+} DPDK_18.11;
-- 
2.17.1



[dpdk-dev] [PATCH v2 19/20] bus/fslmc: add support for secondary processes

2019-01-11 Thread Shreyansh Jain
Previously FSLMC bus only supported blacklisting of DPNI (eth),
DPSECI (crypto) devices. With this patch, devices like DPIO,
DPMCP, and other DP* can also be blacklisted/whitelisted.

This is a required condition for secondary processes where the
secondary needs to be passed a mutually exclusive list of
resources as compared the primary and all other secondaries.

This patch also moves the DPIO memory from malloc to hugepage so
that in future in case the DPIO list can be shared, it can be
accessed in secondaries.

Once this patch is done, multi-process cases can be executed by
whitelisting/blacklisting devices in each instance.

Signed-off-by: Shreyansh Jain 
---
 drivers/bus/fslmc/fslmc_vfio.c   | 51 
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 24 +--
 2 files changed, 63 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 98768a46c..1aae56fa9 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016 NXP
+ *   Copyright 2016-2018 NXP
  *
  */
 
@@ -610,6 +610,15 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
 
/* check the MC version compatibility */
dpmng.regs = (void *)v_addr;
+
+   /* In case of secondary processes, MC version check is no longer
+* required.
+*/
+   if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+   rte_mcp_ptr_list[0] = (void *)v_addr;
+   return 0;
+   }
+
if (mc_get_version(&dpmng, CMD_PRI_LOW, &mc_ver_info)) {
DPAA2_BUS_ERR("Unable to obtain MC version");
ret = -1;
@@ -653,6 +662,15 @@ fslmc_vfio_process_group(void)
/* Search the MCP as that should be initialized first. */
TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
if (dev->dev_type == DPAA2_MPORTAL) {
+   if (dev->device.devargs &&
+   dev->device.devargs->policy == RTE_DEV_BLACKLISTED) 
{
+   DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping",
+ dev->device.name);
+   TAILQ_REMOVE(&rte_fslmc_bus.device_list,
+   dev, next);
+   continue;
+   }
+
ret = fslmc_process_mcp(dev);
if (ret) {
DPAA2_BUS_ERR("Unable to map MC Portal");
@@ -677,6 +695,13 @@ fslmc_vfio_process_group(void)
}
 
TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
+   if (dev->device.devargs &&
+   dev->device.devargs->policy == RTE_DEV_BLACKLISTED) {
+   DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping",
+ dev->device.name);
+   TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
+   continue;
+   }
switch (dev->dev_type) {
case DPAA2_ETH:
case DPAA2_CRYPTO:
@@ -689,10 +714,17 @@ fslmc_vfio_process_group(void)
}
break;
case DPAA2_CON:
-   case DPAA2_IO:
case DPAA2_CI:
case DPAA2_BPOOL:
case DPAA2_MUX:
+   /* IN case of secondary processes, all control objects
+* like dpbp, dpcon, dpci are not initialized/required
+* - all of these are assumed to be initialized and made
+*   available by primary.
+*/
+   if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+   continue;
+
/* Call the object creation routine and remove the
 * device entry from device list
 */
@@ -703,12 +735,15 @@ fslmc_vfio_process_group(void)
return -1;
}
 
-   /* This device is not required to be in the DPDK
-* exposed device list.
-*/
-   TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
-   free(dev);
-   dev = NULL;
+   break;
+   case DPAA2_IO:
+   ret = fslmc_process_iodevices(dev);
+   if (ret) {
+   DPAA2_BUS_DEBUG("Dev (%s) ini

[dpdk-dev] [PATCH v2 17/20] mempool/dpaa2: support saving context of buffer pool

2019-01-11 Thread Shreyansh Jain
Initial design was to have the buffer pool per process where a
global static array stores the bpids. But, in case of secondary
processes, this would not allow the I/O threads to translate the
bpid in Rx'd packets.

This patch moves the array to a global area (rte_malloc) and in
case of Rx thread not containing a valid reference to the array,
reference is build using the handle avaialble in the dpaa2_queue.

Signed-off-by: Shreyansh Jain 
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h  |  1 +
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 12 +++-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.h |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c |  1 +
 drivers/net/dpaa2/dpaa2_rxtx.c   |  5 +
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h 
b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index efbeebef9..20c606dbe 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -141,6 +141,7 @@ struct dpaa2_queue {
};
struct rte_event ev;
dpaa2_queue_cb_dqrr_t *cb;
+   struct dpaa2_bp_info *bp_array;
 };
 
 struct swp_active_dqs {
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c 
b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 790cded80..335eae40e 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -32,7 +32,7 @@
 
 #include 
 
-struct dpaa2_bp_info rte_dpaa2_bpid_info[MAX_BPID];
+struct dpaa2_bp_info *rte_dpaa2_bpid_info;
 static struct dpaa2_bp_list *h_bp_list;
 
 /* Dynamic logging identified for mempool */
@@ -50,6 +50,16 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp)
 
avail_dpbp = dpaa2_alloc_dpbp_dev();
 
+   if (rte_dpaa2_bpid_info == NULL) {
+   rte_dpaa2_bpid_info = (struct dpaa2_bp_info *)rte_malloc(NULL,
+ sizeof(struct dpaa2_bp_info) * MAX_BPID,
+ RTE_CACHE_LINE_SIZE);
+   if (rte_dpaa2_bpid_info == NULL)
+   return -ENOMEM;
+   memset(rte_dpaa2_bpid_info, 0,
+  sizeof(struct dpaa2_bp_info) * MAX_BPID);
+   }
+
if (!avail_dpbp) {
DPAA2_MEMPOOL_ERR("DPAA2 pool not available!");
return -ENOENT;
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.h 
b/drivers/mempool/dpaa2/dpaa2_hw_mempool.h
index 4d3468746..93694616e 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.h
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.h
@@ -59,7 +59,7 @@ struct dpaa2_bp_info {
 #define mempool_to_bpinfo(mp) ((struct dpaa2_bp_info *)(mp)->pool_data)
 #define mempool_to_bpid(mp) ((mempool_to_bpinfo(mp))->bpid)
 
-extern struct dpaa2_bp_info rte_dpaa2_bpid_info[MAX_BPID];
+extern struct dpaa2_bp_info *rte_dpaa2_bpid_info;
 
 int rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool,
   void **obj_table, unsigned int count);
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 861fbcd90..3a20158da 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -485,6 +485,7 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
}
dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[rx_queue_id];
dpaa2_q->mb_pool = mb_pool; /**< mbuf pool to populate RX ring. */
+   dpaa2_q->bp_array = rte_dpaa2_bpid_info;
 
/*Get the flow id from given VQ id*/
flow_id = rx_queue_id % priv->nb_rx_queues;
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 816ea00fd..6e2e8abd7 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -518,6 +518,11 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)
return 0;
}
}
+
+   if (unlikely(!rte_dpaa2_bpid_info &&
+rte_eal_process_type() == RTE_PROC_SECONDARY))
+   rte_dpaa2_bpid_info = dpaa2_q->bp_array;
+
swp = DPAA2_PER_LCORE_ETHRX_PORTAL;
pull_size = (nb_pkts > dpaa2_dqrr_size) ? dpaa2_dqrr_size : nb_pkts;
if (unlikely(!q_storage->active_dqs)) {
-- 
2.17.1



[dpdk-dev] [PATCH v2 15/20] net/dpaa2: add dpdmux initialization and configuration

2019-01-11 Thread Shreyansh Jain
From: Nipun Gupta 

This patch introduces an rte pmd API to configure dpdmux from
the application.
dpdmux can work in association with dpni as an additional
distribution capability on the NIC.

Signed-off-by: Nipun Gupta 
---
 drivers/net/dpaa2/Makefile  |   1 +
 drivers/net/dpaa2/dpaa2_ethdev.h|   2 +
 drivers/net/dpaa2/dpaa2_mux.c   | 222 
 drivers/net/dpaa2/meson.build   |   1 +
 drivers/net/dpaa2/rte_pmd_dpaa2.h   |  23 ++
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map |   1 +
 6 files changed, 250 insertions(+)
 create mode 100644 drivers/net/dpaa2/dpaa2_mux.c

diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile
index c58a39725..562551175 100644
--- a/drivers/net/dpaa2/Makefile
+++ b/drivers/net/dpaa2/Makefile
@@ -33,6 +33,7 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += base/dpaa2_hw_dpni.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_mux.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpkg.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpdmux.c
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 7cf6e4191..420ad6446 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -11,6 +11,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c
new file mode 100644
index 0..1d043dcdc
--- /dev/null
+++ b/drivers/net/dpaa2/dpaa2_mux.c
@@ -0,0 +1,222 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+struct dpaa2_dpdmux_dev {
+   TAILQ_ENTRY(dpaa2_dpdmux_dev) next;
+   /**< Pointer to Next device instance */
+   struct fsl_mc_io dpdmux;  /** handle to DPDMUX portal object */
+   uint16_t token;
+   uint32_t dpdmux_id; /*HW ID for DPDMUX object */
+   uint8_t num_ifs;   /* Number of interfaces in DPDMUX */
+};
+
+struct rte_flow {
+   struct dpdmux_rule_cfg rule;
+};
+
+TAILQ_HEAD(dpdmux_dev_list, dpaa2_dpdmux_dev);
+static struct dpdmux_dev_list dpdmux_dev_list =
+   TAILQ_HEAD_INITIALIZER(dpdmux_dev_list); /*!< DPDMUX device list */
+
+static struct dpaa2_dpdmux_dev *get_dpdmux_from_id(uint32_t dpdmux_id)
+{
+   struct dpaa2_dpdmux_dev *dpdmux_dev = NULL;
+
+   /* Get DPBP dev handle from list using index */
+   TAILQ_FOREACH(dpdmux_dev, &dpdmux_dev_list, next) {
+   if (dpdmux_dev->dpdmux_id == dpdmux_id)
+   break;
+   }
+
+   return dpdmux_dev;
+}
+
+struct rte_flow *
+rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id,
+ struct rte_flow_item *pattern[],
+ struct rte_flow_action *actions[])
+{
+   struct dpaa2_dpdmux_dev *dpdmux_dev;
+   struct dpkg_profile_cfg kg_cfg;
+   const struct rte_flow_item_ipv4 *spec;
+   const struct rte_flow_action_vf *vf_conf;
+   struct dpdmux_cls_action dpdmux_action;
+   struct rte_flow *flow = NULL;
+   void *key_iova, *mask_iova, *key_cfg_iova = NULL;
+   int ret;
+
+   if (pattern[0]->type != RTE_FLOW_ITEM_TYPE_IPV4) {
+   DPAA2_PMD_ERR("Not supported pattern type: %d",
+ pattern[0]->type);
+   return NULL;
+   }
+
+   /* Find the DPDMUX from dpdmux_id in our list */
+   dpdmux_dev = get_dpdmux_from_id(dpdmux_id);
+   if (!dpdmux_dev) {
+   DPAA2_PMD_ERR("Invalid dpdmux_id: %d", dpdmux_id);
+   return NULL;
+   }
+
+   key_cfg_iova = rte_zmalloc(NULL, DIST_PARAM_IOVA_SIZE,
+  RTE_CACHE_LINE_SIZE);
+   if (!key_cfg_iova) {
+   DPAA2_PMD_ERR("Unable to allocate flow-dist parameters");
+   return NULL;
+   }
+
+   /* Currently taking only IP protocol as an extract type.
+* This can be exended to other fields using pattern->type.
+*/
+   memset(&kg_cfg, 0, sizeof(struct dpkg_profile_cfg));
+   kg_cfg.extracts[0].extract.from_hdr.prot = NET_PROT_IP;
+   kg_cfg.extracts[0].extract.from_hdr.field = NH_FLD_IP_PROTO;
+   kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_HDR;
+   kg_cfg.extracts[0].extract.from_hdr.type = DPKG_FULL_FIELD;
+   kg_cfg.num_extracts = 1;
+
+   ret = dpkg_prepare_key_cfg(&kg_cfg, key_cfg_iova);
+   if (ret) {
+   DPAA2_PMD_ERR("dpkg_prepare_key_cfg failed: err(%d)", ret);
+   goto creation_error;
+   }
+
+   ret = dpdmux_set_custom_key(&dpdmux_dev->dpdmux, CMD_PRI_LOW,
+ 

[dpdk-dev] [PATCH v2 18/20] net/dpaa2: change reference to private device

2019-01-11 Thread Shreyansh Jain
The I/O threads for DPAA2 take their reference for bpool ID, the
port ID and other info like qdid, from the rte_eth_dev. Further,
to get this data during I/O operation, a reference of the RTE
device is kept in the queue structure (dpaa2_queue).

In case of secondary processes, rte_eth_dev is not same as the
primary process. Thus, the reference goes invalid.

This patch changes the implementation to use the dev_private
rather than the rte_eth_dev as that is shared area across
all the processes.

Signed-off-by: Shreyansh Jain 
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |  5 -
 drivers/net/dpaa2/dpaa2_ethdev.c|  4 ++--
 drivers/net/dpaa2/dpaa2_rxtx.c  | 18 ++
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h 
b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 20c606dbe..626fcbbca 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -127,7 +127,10 @@ typedef void (dpaa2_queue_cb_dqrr_t)(struct qbman_swp *swp,
 
 struct dpaa2_queue {
struct rte_mempool *mb_pool; /**< mbuf pool to populate RX ring. */
-   void *dev;
+   union {
+   struct rte_eth_dev_data *eth_data;
+   void *dev;
+   };
int32_t eventfd;/*!< Event Fd of this queue */
uint32_t fqid;  /*!< Unique ID of this queue */
uint8_t tc_index;   /*!< traffic class identifier */
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 3a20158da..2b90f4021 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -244,7 +244,7 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev)
}
 
for (i = 0; i < priv->nb_rx_queues; i++) {
-   mc_q->dev = dev;
+   mc_q->eth_data = dev->data;
priv->rx_vq[i] = mc_q++;
dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[i];
dpaa2_q->q_storage = rte_malloc("dq_storage",
@@ -260,7 +260,7 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev)
}
 
for (i = 0; i < priv->nb_tx_queues; i++) {
-   mc_q->dev = dev;
+   mc_q->eth_data = dev->data;
mc_q->flow_id = 0x;
priv->tx_vq[i] = mc_q++;
dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i];
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 6e2e8abd7..2d4b9ef14 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -509,7 +509,7 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)
const struct qbman_fd *fd, *next_fd;
struct qbman_pull_desc pulldesc;
struct queue_storage_info_t *q_storage = dpaa2_q->q_storage;
-   struct rte_eth_dev *dev = dpaa2_q->dev;
+   struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data;
 
if (unlikely(!DPAA2_PER_LCORE_ETHRX_DPIO)) {
ret = dpaa2_affine_qbman_ethrx_swp();
@@ -613,9 +613,10 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)
bufs[num_rx] = eth_sg_fd_to_mbuf(fd);
else
bufs[num_rx] = eth_fd_to_mbuf(fd);
-   bufs[num_rx]->port = dev->data->port_id;
+   bufs[num_rx]->port = eth_data->port_id;
 
-   if (dev->data->dev_conf.rxmode.offloads & 
DEV_RX_OFFLOAD_VLAN_STRIP)
+   if (eth_data->dev_conf.rxmode.offloads &
+   DEV_RX_OFFLOAD_VLAN_STRIP)
rte_vlan_strip(bufs[num_rx]);
 
dq_storage++;
@@ -716,8 +717,8 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t 
nb_pkts)
struct qbman_swp *swp;
uint16_t num_tx = 0;
uint16_t bpid;
-   struct rte_eth_dev *dev = dpaa2_q->dev;
-   struct dpaa2_dev_priv *priv = dev->data->dev_private;
+   struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data;
+   struct dpaa2_dev_priv *priv = eth_data->dev_private;
uint32_t flags[MAX_TX_RING_SLOTS] = {0};
 
if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
@@ -729,7 +730,8 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t 
nb_pkts)
}
swp = DPAA2_PER_LCORE_PORTAL;
 
-   DPAA2_PMD_DP_DEBUG("===> dev =%p, fqid =%d\n", dev, dpaa2_q->fqid);
+   DPAA2_PMD_DP_DEBUG("===> eth_data =%p, fqid =%d\n",
+   eth_data, dpaa2_q->fqid);
 
/*Prepare enqueue descriptor*/
qbman_eq_desc_clear(&eqdesc);
@@ -772,7 +774,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t 
nb_pkts)
rte_mbuf_refcnt_read((*bufs)) == 1)) {
   

[dpdk-dev] [PATCH v2 14/20] bus/fslmc: add support for scanning DPDMUX object

2019-01-11 Thread Shreyansh Jain
From: Nipun Gupta 

Add support in bus and vfio to scan dpdmux type of objects

Signed-off-by: Nipun Gupta 
---
 drivers/bus/fslmc/fslmc_bus.c  | 5 -
 drivers/bus/fslmc/fslmc_vfio.c | 2 ++
 drivers/bus/fslmc/rte_fslmc.h  | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 565e0148f..fa1505377 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -187,6 +187,8 @@ scan_one_fslmc_device(char *dev_name)
dev->dev_type = DPAA2_MPORTAL;
else if (!strncmp("dpdmai", t_ptr, 6))
dev->dev_type = DPAA2_QDMA;
+   else if (!strncmp("dpdmux", t_ptr, 6))
+   dev->dev_type = DPAA2_MUX;
else
dev->dev_type = DPAA2_UNKNOWN;
 
@@ -245,7 +247,8 @@ rte_fslmc_parse(const char *name, void *addr)
strncmp("dpio", t_ptr, 4) &&
strncmp("dpci", t_ptr, 4) &&
strncmp("dpmcp", t_ptr, 5) &&
-   strncmp("dpdmai", t_ptr, 6)) {
+   strncmp("dpdmai", t_ptr, 6) &&
+   strncmp("dpdmux", t_ptr, 6)) {
DPAA2_BUS_ERR("Unknown or unsupported device");
goto err_out;
}
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index ce82a99f6..98768a46c 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -560,6 +560,7 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev)
case DPAA2_IO:
case DPAA2_CI:
case DPAA2_BPOOL:
+   case DPAA2_MUX:
TAILQ_FOREACH(object, &dpaa2_obj_list, next) {
if (dev->dev_type == object->dev_type)
object->create(dev_fd, &device_info,
@@ -691,6 +692,7 @@ fslmc_vfio_process_group(void)
case DPAA2_IO:
case DPAA2_CI:
case DPAA2_BPOOL:
+   case DPAA2_MUX:
/* Call the object creation routine and remove the
 * device entry from device list
 */
diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h
index cea5b78f9..5cfb24505 100644
--- a/drivers/bus/fslmc/rte_fslmc.h
+++ b/drivers/bus/fslmc/rte_fslmc.h
@@ -66,6 +66,7 @@ enum rte_dpaa2_dev_type {
DPAA2_CI,   /**< DPCI type device */
DPAA2_MPORTAL,  /**< DPMCP type device */
DPAA2_QDMA, /**< DPDMAI type device */
+   DPAA2_MUX,  /**< DPDMUX type device */
/* Unknown device placeholder */
DPAA2_UNKNOWN,
DPAA2_DEVTYPE_MAX,
-- 
2.17.1



[dpdk-dev] [PATCH v2 12/20] bus/fslmc: make portal func static

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

Change QBMAN portal function to static as it is not exposed outside
this file context.

Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 37723a094..cd28441f3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -229,7 +229,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, 
int lcoreid)
return 0;
 }
 
-struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int lcoreid)
+static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int lcoreid)
 {
struct dpaa2_dpio_dev *dpio_dev = NULL;
int ret;
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
index 462501a2e..4354c76de 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
@@ -37,8 +37,6 @@ extern uint8_t dpaa2_eqcr_size;
 
 extern struct dpaa2_io_portal_t dpaa2_io_portal[RTE_MAX_LCORE];
 
-struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id);
-
 /* Affine a DPIO portal to current processing thread */
 int dpaa2_affine_qbman_swp(void);
 
-- 
2.17.1



[dpdk-dev] [PATCH v2 13/20] net/dpaa2: add dpdmux mc flib

2019-01-11 Thread Shreyansh Jain
From: Nipun Gupta 

dpdmux object is added as a part of net driver as it is used to
de-multiplex packets to separate interfaces on basis of specific rules.
These rules can be configured from the software

Signed-off-by: Nipun Gupta 
---
 drivers/net/dpaa2/Makefile|   1 +
 drivers/net/dpaa2/mc/dpdmux.c | 929 ++
 drivers/net/dpaa2/mc/fsl_dpdmux.h | 410 
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h | 221 ++
 drivers/net/dpaa2/meson.build |   1 +
 5 files changed, 1562 insertions(+)
 create mode 100644 drivers/net/dpaa2/mc/dpdmux.c
 create mode 100644 drivers/net/dpaa2/mc/fsl_dpdmux.h
 create mode 100644 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h

diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile
index 2b9c011d6..c58a39725 100644
--- a/drivers/net/dpaa2/Makefile
+++ b/drivers/net/dpaa2/Makefile
@@ -35,6 +35,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.c
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpkg.c
+SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpdmux.c
 
 LDLIBS += -lrte_bus_fslmc
 LDLIBS += -lrte_mempool_dpaa2
diff --git a/drivers/net/dpaa2/mc/dpdmux.c b/drivers/net/dpaa2/mc/dpdmux.c
new file mode 100644
index 0..7962213b7
--- /dev/null
+++ b/drivers/net/dpaa2/mc/dpdmux.c
@@ -0,0 +1,929 @@
+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+ *
+ * Copyright 2013-2016 Freescale Semiconductor Inc.
+ * Copyright 2018 NXP
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+
+/** @addtogroup dpdmux
+ * @{
+ */
+
+/**
+ * dpdmux_open() - Open a control session for the specified object
+ * @mc_io: Pointer to MC portal's I/O object
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+ * @dpdmux_id: DPDMUX unique ID
+ * @token: Returned token; use in subsequent API calls
+ *
+ * This function can be used to open a control session for an
+ * already created object; an object may have been declared in
+ * the DPL or by calling the dpdmux_create() function.
+ * This function returns a unique authentication token,
+ * associated with the specific object ID and the specific MC
+ * portal; this token must be used in all subsequent commands for
+ * this specific object.
+ *
+ * Return: '0' on Success; Error code otherwise.
+ */
+int dpdmux_open(struct fsl_mc_io *mc_io,
+   uint32_t cmd_flags,
+   int dpdmux_id,
+   uint16_t *token)
+{
+   struct mc_command cmd = { 0 };
+   struct dpdmux_cmd_open *cmd_params;
+   int err;
+
+   /* prepare command */
+   cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_OPEN,
+ cmd_flags,
+ 0);
+   cmd_params = (struct dpdmux_cmd_open *)cmd.params;
+   cmd_params->dpdmux_id = cpu_to_le32(dpdmux_id);
+
+   /* send command to mc*/
+   err = mc_send_command(mc_io, &cmd);
+   if (err)
+   return err;
+
+   /* retrieve response parameters */
+   *token = mc_cmd_hdr_read_token(&cmd);
+
+   return 0;
+}
+
+/**
+ * dpdmux_close() - Close the control session of the object
+ * @mc_io: Pointer to MC portal's I/O object
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token: Token of DPDMUX object
+ *
+ * After this function is called, no further operations are
+ * allowed on the object without opening a new control session.
+ *
+ * Return: '0' on Success; Error code otherwise.
+ */
+int dpdmux_close(struct fsl_mc_io *mc_io,
+uint32_t cmd_flags,
+uint16_t token)
+{
+   struct mc_command cmd = { 0 };
+
+   /* prepare command */
+   cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_CLOSE,
+ cmd_flags,
+ token);
+
+   /* send command to mc*/
+   return mc_send_command(mc_io, &cmd);
+}
+
+/**
+ * dpdmux_create() - Create the DPDMUX object
+ * @mc_io: Pointer to MC portal's I/O object
+ * @dprc_token:Parent container token; '0' for default container
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+ * @cfg:   Configuration structure
+ * @obj_id: returned object id
+ *
+ * Create the DPDMUX object, allocate required resources and
+ * perform required initialization.
+ *
+ * The object can be created either by declaring it in the
+ * DPL file, or by calling this function.
+ *
+ * The function accepts an authentication token of a parent
+ * container that this object should be assigned to. The token
+ * can be '0' so the object will be assigned to the default container.
+ * The newly created object can be opened with the returned
+ * object id and using the container's associated tokens and MC portals.
+ *
+ * Return: '0' on Success; Error code otherwise.
+ */
+int dpdmux_create(struct fsl_mc_io *mc_io,

[dpdk-dev] [PATCH v2 11/20] bus/fslmc: rename portal pi index to consumer index

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

This is to align with the latest qbman hw library

Signed-off-by: Youri Querry 
Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/qbman/qbman_portal.c | 51 +++---
 drivers/bus/fslmc/qbman/qbman_portal.h |  2 +-
 2 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c 
b/drivers/bus/fslmc/qbman/qbman_portal.c
index 08bfdc9f8..14f4b0344 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -251,21 +251,21 @@ struct qbman_swp *qbman_swp_init(const struct 
qbman_swp_desc *d)
}
 
for (mask_size = p->eqcr.pi_ring_size; mask_size > 0; mask_size >>= 1)
-   p->eqcr.pi_mask = (p->eqcr.pi_mask<<1) + 1;
+   p->eqcr.pi_ci_mask = (p->eqcr.pi_ci_mask<<1) + 1;
eqcr_pi = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI);
-   p->eqcr.pi = eqcr_pi & p->eqcr.pi_mask;
+   p->eqcr.pi = eqcr_pi & p->eqcr.pi_ci_mask;
p->eqcr.pi_vb = eqcr_pi & QB_VALID_BIT;
if ((p->desc.qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
&& (d->cena_access_mode == qman_cena_fastest_access))
-   p->eqcr.ci = qbman_cinh_read(&p->sys,
-   QBMAN_CINH_SWP_EQCR_CI) & p->eqcr.pi_mask;
+   p->eqcr.ci = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI)
+& p->eqcr.pi_ci_mask;
else
-   p->eqcr.ci = qbman_cinh_read(&p->sys,
-   QBMAN_CINH_SWP_EQCR_PI) & p->eqcr.pi_mask;
+   p->eqcr.ci = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_CI)
+& p->eqcr.pi_ci_mask;
p->eqcr.available = p->eqcr.pi_ring_size -
qm_cyc_diff(p->eqcr.pi_ring_size,
-   p->eqcr.ci & (p->eqcr.pi_mask<<1),
-   p->eqcr.pi & (p->eqcr.pi_mask<<1));
+   p->eqcr.ci & (p->eqcr.pi_ci_mask<<1),
+   p->eqcr.pi & (p->eqcr.pi_ci_mask<<1));
 
portal_idx_map[p->desc.idx] = p;
return p;
@@ -646,8 +646,8 @@ static int qbman_swp_enqueue_ring_mode_direct(struct 
qbman_swp *s,
const uint32_t *cl = qb_cl(d);
uint32_t eqcr_ci, full_mask, half_mask;
 
-   half_mask = (s->eqcr.pi_mask>>1);
-   full_mask = s->eqcr.pi_mask;
+   half_mask = (s->eqcr.pi_ci_mask>>1);
+   full_mask = s->eqcr.pi_ci_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
s->eqcr.ci = qbman_cena_read_reg(&s->sys,
@@ -685,8 +685,8 @@ static int qbman_swp_enqueue_ring_mode_mem_back(struct 
qbman_swp *s,
const uint32_t *cl = qb_cl(d);
uint32_t eqcr_ci, full_mask, half_mask;
 
-   half_mask = (s->eqcr.pi_mask>>1);
-   full_mask = s->eqcr.pi_mask;
+   half_mask = (s->eqcr.pi_ci_mask>>1);
+   full_mask = s->eqcr.pi_ci_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
s->eqcr.ci = qbman_cena_read_reg(&s->sys,
@@ -743,8 +743,8 @@ static int qbman_swp_enqueue_multiple_direct(struct 
qbman_swp *s,
int i, num_enqueued = 0;
uint64_t addr_cena;
 
-   half_mask = (s->eqcr.pi_mask>>1);
-   full_mask = s->eqcr.pi_mask;
+   half_mask = (s->eqcr.pi_ci_mask>>1);
+   full_mask = s->eqcr.pi_ci_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
s->eqcr.ci = qbman_cena_read_reg(&s->sys,
@@ -811,8 +811,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct 
qbman_swp *s,
uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
int i, num_enqueued = 0;
 
-   half_mask = (s->eqcr.pi_mask>>1);
-   full_mask = s->eqcr.pi_mask;
+   half_mask = (s->eqcr.pi_ci_mask>>1);
+   full_mask = s->eqcr.pi_ci_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
s->eqcr.ci = qbman_cena_read_reg(&s->sys,
@@ -833,15 +833,6 @@ static int qbman_swp_enqueue_multiple_mem_back(struct 
qbman_swp *s,
QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
memcpy(&p[1], &cl[1], 28);
memcpy(&p[8], &fd[i], sizeof(*fd));
-   eqcr_pi++;
-   }
-
-   /* Set the verb byte, have to substitute in the valid-bit */
-   eqcr_pi = s->eqcr.pi;
-   for (i = 0; i < num_enqueued; i++) {
-   p = qbman_cena_write_start_wo_shadow(&s->sys,
-   QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
-   p[0] = cl[0] | s->eqcr.pi_vb;
if (flags && (flags[i] & QBMAN_ENQUEUE_FLAG_DCA)) {
struct qbman_eq_desc *d = (struct qbman_eq_desc *)p;
 
@@ -849,6 +840,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct 
qbman_swp *s,
((flags[i]) & QBMAN_EQCR_DCA_IDX

[dpdk-dev] [PATCH v2 09/20] bus/fslmc: upgrade to latest qbman library

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

This patch upgrades and sync the dpdk based qbman code
with new version of qbman flib.

Signed-off-by: Youri Querry 
Signed-off-by: Nipun Gupta 
Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/qbman/qbman_portal.c |  8 
 drivers/bus/fslmc/qbman/qbman_sys.h| 17 +++--
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c 
b/drivers/bus/fslmc/qbman/qbman_portal.c
index bbea37efc..2f572a08b 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -201,7 +201,7 @@ struct qbman_swp *qbman_swp_init(const struct 
qbman_swp_desc *d)
p->vdq.valid_bit = QB_VALID_BIT;
p->dqrr.valid_bit = QB_VALID_BIT;
qman_version = p->desc.qman_version;
-   if ((qman_version & 0x) < QMAN_REV_4100) {
+   if ((qman_version & QMAN_REV_MASK) < QMAN_REV_4100) {
p->dqrr.dqrr_size = 4;
p->dqrr.reset_bug = 1;
} else {
@@ -1315,9 +1315,9 @@ const struct qbman_result 
*qbman_swp_dqrr_next_mem_back(struct qbman_swp *s)
 */
flags = p->dq.stat;
response_verb = verb & QBMAN_RESPONSE_VERB_MASK;
-   if ((response_verb == QBMAN_RESULT_DQ) &&
-   (flags & QBMAN_DQ_STAT_VOLATILE) &&
-   (flags & QBMAN_DQ_STAT_EXPIRED))
+   if ((response_verb == QBMAN_RESULT_DQ)
+   && (flags & QBMAN_DQ_STAT_VOLATILE)
+   && (flags & QBMAN_DQ_STAT_EXPIRED))
atomic_inc(&s->vdq.busy);
return p;
 }
diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h 
b/drivers/bus/fslmc/qbman/qbman_sys.h
index 0571097ab..e3bd1c5e6 100644
--- a/drivers/bus/fslmc/qbman/qbman_sys.h
+++ b/drivers/bus/fslmc/qbman/qbman_sys.h
@@ -387,6 +387,10 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys 
*s,
 {
uint32_t reg;
int i;
+   int cena_region_size = 4*1024;
+
+   if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000)
+   cena_region_size = 64*1024;
 #ifdef RTE_ARCH_64
uint8_t wn = CENA_WRITE_ENABLE;
 #else
@@ -396,7 +400,8 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys 
*s,
s->addr_cena = d->cena_bar;
s->addr_cinh = d->cinh_bar;
s->idx = (uint32_t)d->idx;
-   s->cena = malloc(64*1024);
+   s->cena = malloc(cena_region_size);
+
if (!s->cena) {
pr_err("Could not allocate page for cena shadow\n");
return -1;
@@ -412,12 +417,12 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys 
*s,
QBMAN_BUG_ON(reg);
 #endif
if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000)
-   memset(s->addr_cena, 0, 64*1024);
+   memset(s->addr_cena, 0, cena_region_size);
else {
/* Invalidate the portal memory.
 * This ensures no stale cache lines
 */
-   for (i = 0; i < 0x1000; i += 64)
+   for (i = 0; i < cena_region_size; i += 64)
dccivac(s->addr_cena + i);
}
 
@@ -425,12 +430,12 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys 
*s,
reg = qbman_set_swp_cfg(dqrr_size, wn,
0, 3, 2, 3, 1, 1, 1, 1, 1, 1);
else {
-   if ((d->qman_version & QMAN_REV_MASK) < QMAN_REV_5000)
+   if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000)
reg = qbman_set_swp_cfg(dqrr_size, wn,
-   1, 3, 2, 2, 1, 1, 1, 1, 1, 1);
+   1, 3, 2, 0, 1, 1, 1, 1, 1, 1);
else
reg = qbman_set_swp_cfg(dqrr_size, wn,
-   1, 3, 2, 0, 1, 1, 1, 1, 1, 1);
+   1, 3, 2, 2, 1, 1, 1, 1, 1, 1);
}
 
if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) {
-- 
2.17.1



[dpdk-dev] [PATCH v2 10/20] bus/fslmc: add dynamic config for memback portal mode

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

Add flag in portal init to adjust the qbman memory type,
to decide between legacy portal mode or newly introduced
memory backed portals.

Signed-off-by: Roy Pledge 
Signed-off-by: Youri Querry 
Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c  |  2 +
 .../bus/fslmc/qbman/include/fsl_qbman_base.h  | 11 +++-
 drivers/bus/fslmc/qbman/qbman_portal.c| 52 +++
 drivers/bus/fslmc/qbman/qbman_sys.h   | 20 ---
 4 files changed, 53 insertions(+), 32 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index ba2e28ce1..37723a094 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -509,6 +509,8 @@ dpaa2_create_dpio_device(int vdev_fd,
p_des.cinh_bar = (void *)(dpio_dev->qbman_portal_ci_paddr);
p_des.irq = -1;
p_des.qman_version = attr.qbman_version;
+   p_des.eqcr_mode = qman_eqcr_vb_ring;
+   p_des.cena_access_mode = qman_cena_fastest_access;
 
dpio_dev->sw_portal = qbman_swp_init(&p_des);
if (dpio_dev->sw_portal == NULL) {
diff --git a/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h 
b/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h
index bb60a98f9..48bdaafa4 100644
--- a/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h
+++ b/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (C) 2014 Freescale Semiconductor, Inc.
+ * Copyright 2017-2018 NXP
  *
  */
 #ifndef _FSL_QBMAN_BASE_H
@@ -33,7 +34,12 @@ struct qbman_block_desc {
 
 enum qbman_eqcr_mode {
qman_eqcr_vb_ring = 2, /* Valid bit, with eqcr in ring mode */
-   qman_eqcr_vb_array, /* Valid bit, with eqcr in array mode */
+   qman_eqcr_vb_array,/* Valid bit, with eqcr in array mode */
+};
+
+enum qbman_cena_access_mode {
+   qman_cena_fastest_access = 0, /* Use memory backed node if available */
+   qman_cena_direct_access,  /* Use direct access to the CENA region */
 };
 
 /**
@@ -46,6 +52,8 @@ enum qbman_eqcr_mode {
  * @qman_version: the qman version.
  * @eqcr_mode: Select the eqcr mode, currently only valid bit ring mode and
  * valid bit array mode are supported.
+ * @cena_access_mode: Mode used to access the CENA region, direct
+ *or memory backed.
  *
  * Descriptor for a QBMan software portal, expressed in terms that make sense 
to
  * the user context. Ie. on MC, this information is likely to be true-physical,
@@ -62,6 +70,7 @@ struct qbman_swp_desc {
int idx;
uint32_t qman_version;
enum qbman_eqcr_mode eqcr_mode;
+   enum qbman_cena_access_mode cena_access_mode;
 };
 
 /* Driver object for managing a QBMan portal */
diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c 
b/drivers/bus/fslmc/qbman/qbman_portal.c
index 2f572a08b..08bfdc9f8 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -194,7 +194,8 @@ struct qbman_swp *qbman_swp_init(const struct 
qbman_swp_desc *d)
p->sdq |= qbman_sdqcr_dct_prio_ics << QB_SDQCR_DCT_SHIFT;
p->sdq |= qbman_sdqcr_fc_up_to_3 << QB_SDQCR_FC_SHIFT;
p->sdq |= QMAN_SDQCR_TOKEN << QB_SDQCR_TOK_SHIFT;
-   if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000)
+   if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
+   && (d->cena_access_mode == qman_cena_fastest_access))
p->mr.valid_bit = QB_VALID_BIT;
 
atomic_set(&p->vdq.busy, 1);
@@ -233,7 +234,8 @@ struct qbman_swp *qbman_swp_init(const struct 
qbman_swp_desc *d)
qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_SDQCR, 0);
 
p->eqcr.pi_ring_size = 8;
-   if ((qman_version & 0x) >= QMAN_REV_5000) {
+   if ((qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
+   && (d->cena_access_mode == qman_cena_fastest_access)) {
p->eqcr.pi_ring_size = 32;
qbman_swp_enqueue_array_mode_ptr =
qbman_swp_enqueue_array_mode_mem_back;
@@ -253,7 +255,8 @@ struct qbman_swp *qbman_swp_init(const struct 
qbman_swp_desc *d)
eqcr_pi = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI);
p->eqcr.pi = eqcr_pi & p->eqcr.pi_mask;
p->eqcr.pi_vb = eqcr_pi & QB_VALID_BIT;
-   if ((p->desc.qman_version & QMAN_REV_MASK) < QMAN_REV_5000)
+   if ((p->desc.qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
+   && (d->cena_access_mode == qman_cena_fastest_access))
p->eqcr.ci = qbman_cinh_read(&p->sys,
QBMAN_CINH_SWP_EQCR_CI) & p->eqcr.pi_mask;
else
@@ -362,10 +365,11 @@ void *qbman_swp_mc_start(struct qbman_swp *p)
 #ifdef QBMAN_CHECKING
QBMAN_BUG_ON(p->mc.check != swp_mc_can_start);
 #endif
-   if ((p->desc.qman_version & QMAN_REV_MASK) < QMAN_REV_5000)
-   ret = qbma

[dpdk-dev] [PATCH v2 08/20] net/dpaa2: enable optional timestamp in mbuf

2019-01-11 Thread Shreyansh Jain
From: Akhil Goyal 

This patch enables the population of timestamp field
in mbuf on packet receive.
It may give performance impact on LX2xxx platforms.
So, it has been made optional for Lx2xxx platform.
One shall call, rte_dpaa2_enable_ts() to enable it.

Nothing is required for LS2 and LS1088 platforms.

Signed-off-by: Akhil Goyal 
---
 doc/api/doxy-api-index.md   |  1 +
 doc/api/doxy-api.conf.in|  1 +
 drivers/net/dpaa2/Makefile  |  2 ++
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c  |  2 ++
 drivers/net/dpaa2/dpaa2_ethdev.c|  9 +
 drivers/net/dpaa2/dpaa2_ethdev.h|  4 +++
 drivers/net/dpaa2/dpaa2_rxtx.c  | 18 ++
 drivers/net/dpaa2/meson.build   |  2 ++
 drivers/net/dpaa2/rte_pmd_dpaa2.h   | 39 +
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  6 
 10 files changed, 84 insertions(+)
 create mode 100644 drivers/net/dpaa2/rte_pmd_dpaa2.h

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index e27874c5a..d95ad566c 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -43,6 +43,7 @@ The public API headers are grouped by topics:
   [i40e]   (@ref rte_pmd_i40e.h),
   [bnxt]   (@ref rte_pmd_bnxt.h),
   [dpaa]   (@ref rte_pmd_dpaa.h),
+  [dpaa2]  (@ref rte_pmd_dpaa2.h),
   [dpaa2_mempool]  (@ref rte_dpaa2_mempool.h),
   [dpaa2_cmdif](@ref rte_pmd_dpaa2_cmdif.h),
   [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h),
diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in
index 77ba327a8..bef9320c0 100644
--- a/doc/api/doxy-api.conf.in
+++ b/doc/api/doxy-api.conf.in
@@ -9,6 +9,7 @@ INPUT   = @TOPDIR@/doc/api/doxy-api-index.md \
   @TOPDIR@/drivers/net/bnxt \
   @TOPDIR@/drivers/net/bonding \
   @TOPDIR@/drivers/net/dpaa \
+  @TOPDIR@/drivers/net/dpaa2 \
   @TOPDIR@/drivers/net/i40e \
   @TOPDIR@/drivers/net/ixgbe \
   @TOPDIR@/drivers/net/softnic \
diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile
index ca5f7a336..2b9c011d6 100644
--- a/drivers/net/dpaa2/Makefile
+++ b/drivers/net/dpaa2/Makefile
@@ -42,4 +42,6 @@ LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 LDLIBS += -lrte_common_dpaax
 
+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA2_PMD)-include := rte_pmd_dpaa2.h
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c 
b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 713a41bf3..a6f86df8c 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -296,8 +296,10 @@ dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
 DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
 DPNI_BUF_LAYOUT_OPT_DATA_ALIGN |
+DPNI_BUF_LAYOUT_OPT_TIMESTAMP |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
 
+   layout.pass_timestamp = true;
layout.pass_frame_status = 1;
layout.private_data_size = DPAA2_FD_PTA_SIZE;
layout.pass_parser_result = 1;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 39f85ae7b..861fbcd90 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -56,6 +56,9 @@ static uint64_t dev_tx_offloads_nodis =
DEV_TX_OFFLOAD_MT_LOCKFREE |
DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 
+/* enable timestamp in mbuf */
+enum pmd_dpaa2_ts dpaa2_enable_ts;
+
 struct rte_dpaa2_xstats_name_off {
char name[RTE_ETH_XSTATS_NAME_SIZE];
uint8_t page_id; /* dpni statistics page id */
@@ -88,6 +91,12 @@ static int dpaa2_dev_mtu_set(struct rte_eth_dev *dev, 
uint16_t mtu);
 
 int dpaa2_logtype_pmd;
 
+__rte_experimental void
+rte_pmd_dpaa2_set_timestamp(enum pmd_dpaa2_ts enable)
+{
+   dpaa2_enable_ts = enable;
+}
+
 static int
 dpaa2_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 {
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index bd69f523d..7cf6e4191 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -9,6 +9,7 @@
 #define _DPAA2_ETHDEV_H
 
 #include 
+#include 
 
 #include 
 #include 
@@ -83,6 +84,9 @@
 #define DPAA2_PKT_TYPE_VLAN_1  0x0160
 #define DPAA2_PKT_TYPE_VLAN_2  0x0260
 
+/* enable timestamp in mbuf*/
+extern enum pmd_dpaa2_ts dpaa2_enable_ts;
+
 struct dpaa2_dev_priv {
void *hw;
int32_t hw_id;
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index eab943dcf..816ea00fd 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa

[dpdk-dev] [PATCH v2 07/20] net/dpaa2: fix device init for secondary process

2019-01-11 Thread Shreyansh Jain
In order to support I/O from secondary process, the
burst APIs and OPS APIs shall be mapped/plugged.

Fixes: c147eae01cb3 ("net/dpaa2: introduce NXP DPAA2 driver")
Cc: sta...@dpdk.org

Signed-off-by: Shreyansh Jain 
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 8d4ea1bca..39f85ae7b 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1918,8 +1918,15 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
PMD_INIT_FUNC_TRACE();
 
/* For secondary processes, the primary has done all the work */
-   if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+   if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+   /* In case of secondary, only burst and ops API need to be
+* plugged.
+*/
+   eth_dev->dev_ops = &dpaa2_ethdev_ops;
+   eth_dev->rx_pkt_burst = dpaa2_dev_prefetch_rx;
+   eth_dev->tx_pkt_burst = dpaa2_dev_tx;
return 0;
+   }
 
dpaa2_dev = container_of(dev, struct rte_dpaa2_device, device);
 
-- 
2.17.1



[dpdk-dev] [PATCH v2 06/20] bus/fslmc: fix parse method for bus devices

2019-01-11 Thread Shreyansh Jain
Current code expects that bus->parse() would get a string containing
the name of the bus. That is incorrect. bus->parse() is expected
to have strings like:
  dpni.1,key=val
  dpio.2,key=val

when user passed:
  -b fslmc:dpni.1,key=val

This commit fixes this behavior.

Fixes: 50245be05d1a ("bus/fslmc: support device blacklisting")
Cc: sta...@dpdk.org

Signed-off-by: Shreyansh Jain 
---
 drivers/bus/fslmc/fslmc_bus.c | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 89af9385a..565e0148f 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016 NXP
+ *   Copyright 2016,2018 NXP
  *
  */
 
@@ -227,20 +227,16 @@ static int
 rte_fslmc_parse(const char *name, void *addr)
 {
uint16_t dev_id;
-   char *t_ptr;
-   char *sep = strchr(name, ':');
+   char *t_ptr = NULL, *dname = NULL;
 
-   if (strncmp(name, RTE_STR(FSLMC_BUS_NAME),
-   strlen(RTE_STR(FSLMC_BUS_NAME {
-   return -EINVAL;
-   }
+   /* 'name' is expected to contain name of device, for example, dpio.1,
+* dpni.2, etc.
+*/
 
-   if (!sep) {
-   DPAA2_BUS_ERR("Incorrect device name observed");
+   dname = strdup(name);
+   if (!dname)
return -EINVAL;
-   }
-
-   t_ptr = (char *)(sep + 1);
+   t_ptr = dname;
 
if (strncmp("dpni", t_ptr, 4) &&
strncmp("dpseci", t_ptr, 6) &&
@@ -251,24 +247,29 @@ rte_fslmc_parse(const char *name, void *addr)
strncmp("dpmcp", t_ptr, 5) &&
strncmp("dpdmai", t_ptr, 6)) {
DPAA2_BUS_ERR("Unknown or unsupported device");
-   return -EINVAL;
+   goto err_out;
}
 
t_ptr = strchr(name, '.');
if (!t_ptr) {
DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr);
-   return -EINVAL;
+   goto err_out;
}
 
t_ptr = (char *)(t_ptr + 1);
if (sscanf(t_ptr, "%hu", &dev_id) <= 0) {
DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr);
-   return -EINVAL;
+   goto err_out;
}
+   free(dname);
 
if (addr)
-   strcpy(addr, (char *)(sep + 1));
+   strcpy(addr, name);
+
return 0;
+err_out:
+   free(dname);
+   return -EINVAL;
 }
 
 static int
-- 
2.17.1



[dpdk-dev] [PATCH v2 05/20] bus/fslmc: fix to convert error msg to warning

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

This is just a information. No need to print
it as a error.

Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging")
Cc: sta...@dpdk.org

Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/fslmc_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 493b6e5be..ce82a99f6 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -176,7 +176,7 @@ static int vfio_map_irq_region(struct fslmc_vfio_group 
*group)
vaddr = (unsigned long *)mmap(NULL, 0x1000, PROT_WRITE |
PROT_READ, MAP_SHARED, container_device_fd, 0x603);
if (vaddr == MAP_FAILED) {
-   DPAA2_BUS_ERR("Unable to map region (errno = %d)", errno);
+   DPAA2_BUS_INFO("Unable to map region (errno = %d)", errno);
return -errno;
}
 
-- 
2.17.1



[dpdk-dev] [PATCH v2 03/20] bus/fslmc: fix to use correct physical core for logical core

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

Existing code is using the lcore id as the physical core
id. Add code to get the right physical id.

Also, dpaa2 can not support one lcore mapping to multiple cpus,
print err on such cases.

Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging")
Cc: sta...@dpdk.org

Signed-off-by: Hemant Agrawal 
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 76 
 1 file changed, 63 insertions(+), 13 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 4fc6efec5..ba2e28ce1 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -53,6 +53,10 @@ static uint32_t io_space_count;
 /* Variable to store DPAA2 platform type */
 uint32_t dpaa2_svr_family;
 
+/* Physical core id for lcores running on dpaa2. */
+/* DPAA2 only support 1 lcore to 1 phy cpu mapping */
+static unsigned int dpaa2_cpu[RTE_MAX_LCORE];
+
 /* Variable to store DPAA2 DQRR size */
 uint8_t dpaa2_dqrr_size;
 /* Variable to store DPAA2 EQCR size */
@@ -92,7 +96,8 @@ dpaa2_core_cluster_sdest(int cpu_id)
 }
 
 #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV
-static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
+static void
+dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id, int lcoreid)
 {
 #define STRING_LEN 28
 #define COMMAND_LEN50
@@ -125,7 +130,7 @@ static void 
dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
return;
}
 
-   cpu_mask = cpu_mask << rte_lcore_id();
+   cpu_mask = cpu_mask << dpaa2_cpu[lcoreid];
snprintf(command, COMMAND_LEN, "echo %X > /proc/irq/%s/smp_affinity",
 cpu_mask, token);
ret = system(command);
@@ -139,7 +144,7 @@ static void 
dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
fclose(file);
 }
 
-static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)
+static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int lcoreid)
 {
struct epoll_event epoll_ev;
int eventfd, dpio_epoll_fd, ret;
@@ -176,32 +181,36 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev 
*dpio_dev)
}
dpio_dev->epoll_fd = dpio_epoll_fd;
 
-   dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id);
+   dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id, lcoreid);
 
return 0;
 }
 #endif
 
 static int
-dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
+dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int lcoreid)
 {
int sdest, ret;
+   int cpu_id;
 
/* Set the Stashing Destination */
-   if (cpu_id < 0) {
-   cpu_id = rte_get_master_lcore();
-   if (cpu_id < 0) {
+   if (lcoreid < 0) {
+   lcoreid = rte_get_master_lcore();
+   if (lcoreid < 0) {
DPAA2_BUS_ERR("Getting CPU Index failed");
return -1;
}
}
+
+   cpu_id = dpaa2_cpu[lcoreid];
+
/* Set the STASH Destination depending on Current CPU ID.
 * Valid values of SDEST are 4,5,6,7. Where,
 */
 
sdest = dpaa2_core_cluster_sdest(cpu_id);
-   DPAA2_BUS_DEBUG("Portal= %d  CPU= %u SDEST= %d",
-   dpio_dev->index, cpu_id, sdest);
+   DPAA2_BUS_DEBUG("Portal= %d  CPU= %u lcore id =%u SDEST= %d",
+   dpio_dev->index, cpu_id, lcoreid, sdest);
 
ret = dpio_set_stashing_destination(dpio_dev->dpio, CMD_PRI_LOW,
dpio_dev->token, sdest);
@@ -211,7 +220,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, 
int cpu_id)
}
 
 #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV
-   if (dpaa2_dpio_intr_init(dpio_dev)) {
+   if (dpaa2_dpio_intr_init(dpio_dev, lcoreid)) {
DPAA2_BUS_ERR("Interrupt registration failed for dpio");
return -1;
}
@@ -220,7 +229,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, 
int cpu_id)
return 0;
 }
 
-struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id)
+struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int lcoreid)
 {
struct dpaa2_dpio_dev *dpio_dev = NULL;
int ret;
@@ -236,7 +245,7 @@ struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id)
DPAA2_BUS_DEBUG("New Portal %p (%d) affined thread - %lu",
dpio_dev, dpio_dev->index, syscall(SYS_gettid));
 
-   ret = dpaa2_configure_stashing(dpio_dev, cpu_id);
+   ret = dpaa2_configure_stashing(dpio_dev, lcoreid);
if (ret)
DPAA2_BUS_ERR("dpaa2_configure_stashing failed");
 
@@ -340,6 +349,39 @@ dpaa2_affine_qbman_ethrx_swp(void)
}
 }
 
+/*
+ * This checks for not supported lcore mappings as well as get the physical
+ * cpuid for the lcore.
+ * one lcore can only map to 1 cpu i.e. 1@10-14 not supported.
+ * one cpu can be mapped to more than one lcores.
+ */

[dpdk-dev] [PATCH v2 02/20] bus/fslmc: fix the ring mode to use correct cache settings

2019-01-11 Thread Shreyansh Jain
From: Youri Querry 

The code was incorrectly using the cache inhibited access.
It shall use cached enabled access for better performance.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: sta...@dpdk.org

Signed-off-by: Youri Querry 
---
 drivers/bus/fslmc/qbman/qbman_portal.c | 12 ++--
 drivers/bus/fslmc/qbman/qbman_sys.h|  1 +
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c 
b/drivers/bus/fslmc/qbman/qbman_portal.c
index 3380e54f5..bbea37efc 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -683,8 +683,8 @@ static int qbman_swp_enqueue_ring_mode_mem_back(struct 
qbman_swp *s,
full_mask = s->eqcr.pi_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
-   s->eqcr.ci = qbman_cinh_read(&s->sys,
-   QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+   s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+   QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
eqcr_ci, s->eqcr.ci);
if (!s->eqcr.available)
@@ -809,8 +809,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct 
qbman_swp *s,
full_mask = s->eqcr.pi_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
-   s->eqcr.ci = qbman_cinh_read(&s->sys,
-   QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+   s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+   QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
eqcr_ci, s->eqcr.ci);
if (!s->eqcr.available)
@@ -941,8 +941,8 @@ static int qbman_swp_enqueue_multiple_desc_mem_back(struct 
qbman_swp *s,
full_mask = s->eqcr.pi_mask;
if (!s->eqcr.available) {
eqcr_ci = s->eqcr.ci;
-   s->eqcr.ci = qbman_cinh_read(&s->sys,
-   QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+   s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+   QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
eqcr_ci, s->eqcr.ci);
if (!s->eqcr.available)
diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h 
b/drivers/bus/fslmc/qbman/qbman_sys.h
index d41af8358..0571097ab 100644
--- a/drivers/bus/fslmc/qbman/qbman_sys.h
+++ b/drivers/bus/fslmc/qbman/qbman_sys.h
@@ -55,6 +55,7 @@
 #define QBMAN_CENA_SWP_RR(vb)  (0x700 + ((uint32_t)(vb) >> 1))
 #define QBMAN_CENA_SWP_VDQCR   0x780
 #define QBMAN_CENA_SWP_EQCR_CI 0x840
+#define QBMAN_CENA_SWP_EQCR_CI_MEMBACK 0x1840
 
 /* CENA register offsets in memory-backed mode */
 #define QBMAN_CENA_SWP_DQRR_MEM(n)  (0x800 + ((uint32_t)(n) << 6))
-- 
2.17.1



[dpdk-dev] [PATCH v2 04/20] net/dpaa2: fix bad check for not-null

2019-01-11 Thread Shreyansh Jain
From: Hemant Agrawal 

The check !dpaa2->cscn is not correct to check non-null value.

Fixes: 5d9a1e4d23fe ("net/dpaa2: enhance queue memory cleanup")
Cc: sta...@dpdk.org

Signed-off-by: Hemant Agrawal 
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index fa71807e6..8d4ea1bca 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -311,8 +311,7 @@ dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev)
/* cleanup tx queue cscn */
for (i = 0; i < priv->nb_tx_queues; i++) {
dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i];
-   if (!dpaa2_q->cscn)
-   rte_free(dpaa2_q->cscn);
+   rte_free(dpaa2_q->cscn);
}
/*free memory for all queues (RX+TX) */
rte_free(priv->rx_vq[0]);
-- 
2.17.1



[dpdk-dev] [PATCH v2 01/20] bus/fslmc: fix to reset portal memory before use

2019-01-11 Thread Shreyansh Jain
From: Sachin Saxena 

Uninitialized portal memory is causing unwanted issues.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: sta...@dpdk.org

Signed-off-by: Sachin Saxena 
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index ce0699842..4fc6efec5 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -369,6 +369,8 @@ dpaa2_create_dpio_device(int vdev_fd,
dpio_dev->mc_portal = rte_mcp_ptr_list[MC_PORTAL_INDEX];
 
dpio_dev->dpio = malloc(sizeof(struct fsl_mc_io));
+   memset(dpio_dev->dpio, 0, sizeof(struct fsl_mc_io));
+
if (!dpio_dev->dpio) {
DPAA2_BUS_ERR("Memory allocation failure");
goto err;
-- 
2.17.1



[dpdk-dev] [PATCH v2 00/20] NXP DPAA2 fixes and enhancements

2019-01-11 Thread Shreyansh Jain
(N: Original series was by Hemant - due to RC window timeline and
his unavailability, respining on his behalf)

This patch set covers following:

1. Fixes in the existing NXP DPAA2 bus and net pmd
2. New object (DPDMUX) support in NIC driver for better classification
3. Improvements to support secondary process
4. Upgrade the low level QBMAN HW lib

History:
v1->v2:
 - Fix warning on Patch 20/20 - moved printfs to logging macro
   and PRIx changes
 - reset author of 07/20 as the signoff and author didn't match
 - Validate over master (a958a5c07f4b5e)
 - Reword patch headline/commit based on check-git-log script

Akhil Goyal (1):
  net/dpaa2: enable optional timestamp in mbuf

Hemant Agrawal (7):
  bus/fslmc: fix to use correct physical core for logical core
  net/dpaa2: fix bad check for not-null
  bus/fslmc: fix to convert error msg to warning
  bus/fslmc: upgrade to latest qbman library
  bus/fslmc: add dynamic config for memback portal mode
  bus/fslmc: rename portal pi index to consumer index
  bus/fslmc: make portal func static

Nipun Gupta (4):
  net/dpaa2: add dpdmux mc flib
  bus/fslmc: add support for scanning DPDMUX object
  net/dpaa2: add dpdmux initialization and configuration
  net/dpaa2: add API to support custom hash key

Pankaj Chauhan (1):
  bus/fslmc: add function to map any addr via VFIO

Sachin Saxena (1):
  bus/fslmc: fix to reset portal memory before use

Shreyansh Jain (5):
  bus/fslmc: fix parse method for bus devices
  net/dpaa2: fix device init for secondary process
  mempool/dpaa2: support saving context of buffer pool
  net/dpaa2: change reference to private device
  bus/fslmc: add support for secondary processes

Youri Querry (1):
  bus/fslmc: fix the ring mode to use correct cache settings

 doc/api/doxy-api-index.md |   1 +
 doc/api/doxy-api.conf.in  |   1 +
 drivers/bus/fslmc/fslmc_bus.c |  38 +-
 drivers/bus/fslmc/fslmc_vfio.c|  98 +-
 drivers/bus/fslmc/fslmc_vfio.h|   1 +
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c  | 100 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h  |   2 -
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h   |   6 +-
 .../bus/fslmc/qbman/include/fsl_qbman_base.h  |  11 +-
 drivers/bus/fslmc/qbman/qbman_portal.c| 123 ++-
 drivers/bus/fslmc/qbman/qbman_portal.h|   2 +-
 drivers/bus/fslmc/qbman/qbman_sys.h   |  34 +-
 drivers/bus/fslmc/rte_bus_fslmc_version.map   |   7 +
 drivers/bus/fslmc/rte_fslmc.h |   1 +
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  |  12 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.h  |   2 +-
 drivers/net/dpaa2/Makefile|   4 +
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c|  54 +-
 drivers/net/dpaa2/dpaa2_ethdev.c  |  26 +-
 drivers/net/dpaa2/dpaa2_ethdev.h  |   6 +
 drivers/net/dpaa2/dpaa2_mux.c | 222 +
 drivers/net/dpaa2/dpaa2_rxtx.c|  41 +-
 drivers/net/dpaa2/mc/dpdmux.c | 929 ++
 drivers/net/dpaa2/mc/fsl_dpdmux.h | 410 
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h | 221 +
 drivers/net/dpaa2/meson.build |   4 +
 drivers/net/dpaa2/rte_pmd_dpaa2.h |  90 ++
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map   |   8 +
 28 files changed, 2318 insertions(+), 136 deletions(-)
 create mode 100644 drivers/net/dpaa2/dpaa2_mux.c
 create mode 100644 drivers/net/dpaa2/mc/dpdmux.c
 create mode 100644 drivers/net/dpaa2/mc/fsl_dpdmux.h
 create mode 100644 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h
 create mode 100644 drivers/net/dpaa2/rte_pmd_dpaa2.h

-- 
2.17.1



Re: [dpdk-dev] [PATCH 20/20] bus/fslmc: add function to map any addr via VFIO

2019-01-10 Thread Shreyansh Jain
Hello Ferruh,

Replying on behalf of Hemant...

On 08/01/19 7:40 PM, Ferruh Yigit wrote:
> On 12/27/2018 6:23 AM, Hemant Agrawal wrote:
>> From: Pankaj Chauhan 
>>
>> This is required to map any accelerator memory
>> and PCI address to VFIO using QDMA.
>>
>> Signed-off-by: Minghuan Lian 
>> Signed-off-by: Pankaj Chauhan 
> 
> This requires either sign-off or ack from 'bus/fslmc' maintainers, which are:
>   M: Hemant Agrawal 
> 
> 
> 
>   M: Shreyansh Jain 
> 
> I think Hemant sending the patchset implies that this has been reviewed by him
> but this information get lost in git, so better to explicitly provide 
> review/ack
> tags whenever appropriate.

What I will do is, re-spin the complete series (with error below 
fixed...) and send again. All the patches are on FSLMC/DPAA2 drivers 
only so probably Hemant's or my Acks would work directly.

> 
> <...>
> 
>> +printf("PCIe vfio map 0x%llx:0x%llx, size 0x%llx\n", dma_map.vaddr,
>> +dma_map.iova, dma_map.size);
> 
> This is causing build error [1], but why at first place using 'printf()' 
> instead
> of logging macros?

I will fix this.

> 
> [1]
> .../drivers/bus/fslmc/fslmc_vfio.c: In function ‘rte_fslmc_vfio_mem_dmamap’:
> .../drivers/bus/fslmc/fslmc_vfio.c:376:29: error: format ‘%llx’ expects 
> argument
> of type ‘long long unsigned int’, but argument 2 has type ‘__u64’ {aka ‘long
> unsigned int’} [-Werror=format=]
>printf("PCIe vfio map 0x%llx:0x%llx, size 0x%llx\n", dma_map.vaddr,
>~~~^ ~
>%lx
> 
> <...>
> 
>> +DPDK_19.02 {
>> +global:
>> +
>> +rte_fslmc_vfio_mem_dmamap;
> 
> Is this need to be an API? Who is the consumer of this API, I don't see anyone
> calls this function?
> 

This API (internal to FSLMC) was added for one of NXP's internal 
software stack over DPDK. As this is an internal API, I don't think it 
would pollute the outer namespace - isn't it? And, I think its consumers 
won't necessarily be within DPDK stack.

Or, if this is conflicting case, I will remove this patch (it is 
independent) and send again. Let me know your reservation.

-
Shreyansh



Re: [dpdk-dev] [PATCH 0/4] NXP DPAA fixes and enhancements

2019-01-04 Thread Shreyansh Jain
On Wednesday 26 December 2018 05:03 PM, Hemant Agrawal wrote:
> Few fixes and minor enhancements in NXP DPAA driver
> 
> Hemant Agrawal (4):
>bus/dpaa: fix the logical to physical core affine logic
>net/dpaa: fix the secondary process
>net/dpaa: update supported ptypes
>net/dpaa: update RSS offload types
> 
>   drivers/bus/dpaa/dpaa_bus.c| 41 +-
>   drivers/net/dpaa/dpaa_ethdev.c | 19 +++-
>   drivers/net/dpaa/dpaa_ethdev.h | 12 ++
>   3 files changed, 42 insertions(+), 30 deletions(-)
> 

Series-Acked-by: Shreyansh Jain 


Re: [dpdk-dev] [PATCH v3 2/2] doc: add guide for debug and troubleshoot

2019-01-03 Thread Shreyansh Jain
Hello Vipin,

Some comments and lots of nitpicks inlined.
(I know this comes months late - apologies, just didn't stumble on this 
earlier).

On Monday 26 November 2018 12:38 PM, Vipin Varghese wrote:
> Add user guide on debug and troubleshoot for common issues and bottleneck
> found in various application models running on single or multi stages.
> 
> Signed-off-by: Vipin Varghese 
> Acked-by: Marko Kovacevic 
> ---
> 
> V3:
>   - reorder for removing warning in 'make doc-guides-html' - Thomas Monjalon
> 
> V2:
>   - add offload flag check - Vipin Varghese
>   - change tab to space - Marko Kovacevic
>   - spelling correction - Marko Kovacevic
>   - remove extra characters - Marko Kovacevic
>   - add ACK by Marko - Vipn Varghese
> ---
>   doc/guides/howto/debug_troubleshoot_guide.rst | 351 ++
>   doc/guides/howto/index.rst|   1 +
>   2 files changed, 352 insertions(+)
>   create mode 100644 doc/guides/howto/debug_troubleshoot_guide.rst
> 
> diff --git a/doc/guides/howto/debug_troubleshoot_guide.rst 
> b/doc/guides/howto/debug_troubleshoot_guide.rst
> new file mode 100644
> index 0..55589085e
> --- /dev/null
> +++ b/doc/guides/howto/debug_troubleshoot_guide.rst
> @@ -0,0 +1,351 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +Copyright(c) 2018 Intel Corporation.
> +
> +.. _debug_troubleshoot_via_pmd:
> +
> +Debug & Troubleshoot guide via PMD
> +==
> +
> +DPDK applications can be designed to run as single thread simple stage to
> +multiple threads with complex pipeline stages. These application can use poll
> +mode devices which helps in offloading CPU cycles. A few models are
> +
> +  *  single primary
> +  *  multiple primary
> +  *  single primary single secondary
> +  *  single primary multiple secondary
> +
> +In all the above cases, it is a tedious task to isolate, debug and understand
> +odd behaviour which can occurring random or periodic. The goal of guide is to
  ^^   ^
either of: which can occur randomly or periodically ...this
   which occurs randomly or periodically

> +share and explore a few commonly seen patterns and behaviour. Then isolate 
> and
 ^^^
super nitpick:  Then, isolate

> +identify the root cause via step by step debug at various processing stages.
> +
> +Application Overview
> +
> +
> +Let us take up an example application as reference for explaining issues and
> +patterns commonly seen. The sample application in discussion makes use of
> +single primary model with various pipeline stages. The application uses PMD
> +and libraries such as service cores, mempool, pkt mbuf, event, crypto, QoS
> +and eth.
> +
> +The overview of an application modeled using PMD is shown in
> +:numref:`dtg_sample_app_model`.
> +
> +.. _dtg_sample_app_model:
> +
> +.. figure:: img/dtg_sample_app_model.*
> +
> +   Overview of pipeline stage of an application
> +
> +Bottleneck Analysis
> +---
> +
> +To debug the bottleneck and performance issues the desired application
> +is made to run in an environment matching as below
> +
> +#. Linux 64-bit|32-bit
> +#. DPDK PMD and libraries are used
> +#. Libraries and PMD are either static or shared. But not both
> +#. Machine flag optimizations of gcc or compiler are made constant
> +
> +Is there mismatch in packet rate (received < send)?
> +~~~
> +
> +RX Port and associated core :numref:`dtg_rx_rate`.
> +
> +.. _dtg_rx_rate:
> +
> +.. figure:: img/dtg_rx_rate.*
> +
> +   RX send rate compared against Received rate
> +
> +#. are generic configuration correct?
> +-  What is port Speed, Duplex? rte_eth_link_get()
> +-  Is packet of higher sizes are dropped? rte_eth_get_mtu()
   ^
   Are packets of higher size dropped?

> +-  Are only specific MAC are received? rte_eth_promiscuous_get()
^^^
   can be removed

What about checking vlan-filters, if any? - that is, if packets have 
some vlan stamped and hardware is configured to filter that.

> +
> +#. are there NIC specific drops?
> +-  Check rte_eth_rx_queue_info_get() for nb_desc, scattered_rx,
> +-  Check rte_eth_dev_stats() for Stats per queue
> +-  Is stats of other queues shows no change via
> +   rte_eth_dev_dev_rss_hash_conf_get()

   Does stat for other queues shows no change via ...
Or, maybe you intend to say - check stats for all queues in case RSS is 
configured and packets are being distributed to a queue not being 
listened to.

> +-  Check if port offload and queue offload matches.
> +
> +#. If problem still persists, this might be at RX lcore thread
> +-  Check if RX thread, distributor or

[dpdk-dev] [PATCH] examples/l3fwd: support separate buffer pool per port

2019-01-03 Thread Shreyansh Jain
Traditionally, only a single buffer pool per port
(or, per-port-per-socket) is created in l3fwd application.

If separate pools are created per-port, it might lead to gain in
performance as packet alloc/dealloc requests would be isolated
across ports (and their corresponding lcores).

This patch adds an argument '--per-port-pool' to the l3fwd application.
By default, old mode of single pool per port (split on sockets) is
active.

Signed-off-by: Shreyansh Jain 
---

RFC: https://mails.dpdk.org/archives/dev/2018-November/120002.html

 examples/l3fwd/main.c | 74 +++
 1 file changed, 53 insertions(+), 21 deletions(-)

diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index e4b99efe0..7b9683187 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -69,11 +69,13 @@ static int promiscuous_on;
 static int l3fwd_lpm_on;
 static int l3fwd_em_on;
 
+/* Global variables. */
+
 static int numa_on = 1; /**< NUMA is enabled by default. */
 static int parse_ptype; /**< Parse packet type using rx callback, and */
/**< disabled by default */
-
-/* Global variables. */
+static int per_port_pool; /**< Use separate buffer pools per port; disabled */
+ /**< by default */
 
 volatile bool force_quit;
 
@@ -133,7 +135,8 @@ static struct rte_eth_conf port_conf = {
},
 };
 
-static struct rte_mempool * pktmbuf_pool[NB_SOCKETS];
+static struct rte_mempool *pktmbuf_pool[RTE_MAX_ETHPORTS][NB_SOCKETS];
+static uint8_t lkp_per_socket[NB_SOCKETS];
 
 struct l3fwd_lkp_mode {
void  (*setup)(int);
@@ -285,7 +288,8 @@ print_usage(const char *prgname)
" [--no-numa]"
" [--hash-entry-num]"
" [--ipv6]"
-   " [--parse-ptype]\n\n"
+   " [--parse-ptype]"
+   " [--per-port-pool]\n\n"
 
"  -p PORTMASK: Hexadecimal bitmask of ports to configure\n"
"  -P : Enable promiscuous mode\n"
@@ -299,7 +303,8 @@ print_usage(const char *prgname)
"  --no-numa: Disable numa awareness\n"
"  --hash-entry-num: Specify the hash entry number in 
hexadecimal to be setup\n"
"  --ipv6: Set if running ipv6 packets\n"
-   "  --parse-ptype: Set to use software to analyze packet 
type\n\n",
+   "  --parse-ptype: Set to use software to analyze packet type\n"
+   "  --per-port-pool: Use separate buffer pool per port\n\n",
prgname);
 }
 
@@ -452,6 +457,7 @@ static const char short_options[] =
 #define CMD_LINE_OPT_ENABLE_JUMBO "enable-jumbo"
 #define CMD_LINE_OPT_HASH_ENTRY_NUM "hash-entry-num"
 #define CMD_LINE_OPT_PARSE_PTYPE "parse-ptype"
+#define CMD_LINE_OPT_PER_PORT_POOL "per-port-pool"
 enum {
/* long options mapped to a short option */
 
@@ -465,6 +471,7 @@ enum {
CMD_LINE_OPT_ENABLE_JUMBO_NUM,
CMD_LINE_OPT_HASH_ENTRY_NUM_NUM,
CMD_LINE_OPT_PARSE_PTYPE_NUM,
+   CMD_LINE_OPT_PARSE_PER_PORT_POOL,
 };
 
 static const struct option lgopts[] = {
@@ -475,6 +482,7 @@ static const struct option lgopts[] = {
{CMD_LINE_OPT_ENABLE_JUMBO, 0, 0, CMD_LINE_OPT_ENABLE_JUMBO_NUM},
{CMD_LINE_OPT_HASH_ENTRY_NUM, 1, 0, CMD_LINE_OPT_HASH_ENTRY_NUM_NUM},
{CMD_LINE_OPT_PARSE_PTYPE, 0, 0, CMD_LINE_OPT_PARSE_PTYPE_NUM},
+   {CMD_LINE_OPT_PER_PORT_POOL, 0, 0, CMD_LINE_OPT_PARSE_PER_PORT_POOL},
{NULL, 0, 0, 0}
 };
 
@@ -485,10 +493,10 @@ static const struct option lgopts[] = {
  * RTE_MAX is used to ensure that NB_MBUF never goes below a minimum
  * value of 8192
  */
-#define NB_MBUF RTE_MAX(   \
-   (nb_ports*nb_rx_queue*nb_rxd +  \
-   nb_ports*nb_lcores*MAX_PKT_BURST +  \
-   nb_ports*n_tx_queue*nb_txd +\
+#define NB_MBUF(nports) RTE_MAX(   \
+   (nports*nb_rx_queue*nb_rxd +\
+   nports*nb_lcores*MAX_PKT_BURST +\
+   nports*n_tx_queue*nb_txd +  \
nb_lcores*MEMPOOL_CACHE_SIZE),  \
(unsigned)8192)
 
@@ -594,6 +602,11 @@ parse_args(int argc, char **argv)
parse_ptype = 1;
break;
 
+   case CMD_LINE_OPT_PARSE_PER_PORT_POOL:
+   printf("per port buffer pool is enabled\n");
+   per_port_pool = 1;
+   break;
+
default:
print_usage(prgname);
return -1;
@@ -642,7 +655,7 @@ print_ethaddr(const char *name, const struct ether_addr 
*eth_addr)
 }
 
 static int
-init_mem(unsigned nb_mbuf)
+init_mem(uint16_t portid, unsigned int nb_mbuf)
 {
struct lcore_conf *qconf;
int socketid;
@@ -664

Re: [dpdk-dev] 18.08.1 patches review and test

2018-12-25 Thread Shreyansh Jain
Hello Kevin,

I have an issue with one of the patches originating from me and targeted 
for stable. In-lined below.

On Thursday 20 December 2018 05:07 PM, Kevin Traynor wrote:
> (resend with correct subject)
> 
> Hi all,
> 
> Here is a list of patches targeted for stable release 18.08.1. Please
> help review and test. The planned date for the final release is 16th
> January. Before that, please shout if anyone has objections with these
> patches being applied.
> 
> Also for the companies committed to running regression tests,
> please run the tests and report any issue before the release date.
> 
> A release candidate tarball can be found at:
> 
>  https://dpdk.org/browse/dpdk-stable/tag/?id=v18.08.1-rc1
> 
> These patches are located at branch 18.08 of dpdk-stable repo:
>  https://dpdk.org/browse/dpdk-stable/
> 

[...]

> Shreyansh Jain (2):
>bus/fslmc: fix physical addressing check
>raw/skeleton: fix memory leak on test failure < this

Please don't apply the 'raw/skeleton: fix memory leak on test failure' 
patch. There is problem with this as reported in another patch [1]. I 
will push a fix out (which would actually be reverting this patch)

[1] https://patches.dpdk.org/patch/48635/

[...]

-
Shreyansh


Re: [dpdk-dev] [PATCH] raw/skeleton: fix segmentation fault on rawdev_autotest

2018-12-12 Thread Shreyansh Jain
On Tuesday 11 December 2018 06:44 PM, Harman Kalra wrote:
> segmentation fault ocured as vdev->device.driver->name did not
> return correct value.
> Test2 failed as dummy_value was freed before it was used.
> 
> Signed-off-by: Kallio Marko 
> Signed-off-by: Harman Kalra 
> ---
>   drivers/raw/skeleton_rawdev/skeleton_rawdev.c  | 3 ++-
>   drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c | 4 ++--
>   2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev.c 
> b/drivers/raw/skeleton_rawdev/skeleton_rawdev.c
> index d7630fc69..c957ced11 100644
> --- a/drivers/raw/skeleton_rawdev/skeleton_rawdev.c
> +++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev.c
> @@ -585,7 +585,8 @@ skeleton_rawdev_create(const char *name,
>   
>   rawdev->dev_ops = &skeleton_rawdev_ops;
>   rawdev->device = &vdev->device;
> - rawdev->driver_name = vdev->device.driver->name;
> +
> + rawdev->driver_name = rawdev->name;

This is not right. rawdev->name is name of the device and not that of a 
driver.

But, this also highlights a much bigger issue here:


$ master+* ± grep driver_name * -rn
dpaa2_cmdif/dpaa2_cmdif.c:214:  rawdev->driver_name = 
vdev->device.driver->name;
dpaa2_qdma/dpaa2_qdma.c:958:rawdev->driver_name = 
dpaa2_drv->driver.name;
ifpga_rawdev/ifpga_rawdev.c:421:rawdev->driver_name = 
pci_dev->device.driver->name;
skeleton_rawdev/skeleton_rawdev.c:588:  rawdev->driver_name = 
vdev->device.driver->name;


So, it seems that all rawdev drivers are assuming that even before probe 
is over (this assignment is path of probe within driver), they can 
assign the name to the 'device.driver'.

Here is the snippet from bus/pci/pci_common.c
--->8---
 ret = dr->probe(dr, dev);
...
 if (ret) {
/* Error case */
...
 } else {
 dev->device.driver = &dr->driver;
 }
--->8---

And from bus/vdev/vdev.c

--->8---
 ret = driver->probe(dev);
 if (ret == 0)
 dev->device.driver = &driver->driver;
--->8---

So, the bus is actually assigning device.driver part *after* probe is 
successfully complete.

So, if your's segfaulted, there is a high probability others too would 
encounter the same.
This needs investigation.



>   
>   skeldev = skeleton_rawdev_get_priv(rawdev);
>   
> diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c 
> b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
> index 359c9e296..788c3f1b9 100644
> --- a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
> +++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
> @@ -294,14 +294,14 @@ test_rawdev_attr_set_get(void)
> "Attribute (Test1) not set correctly (%" PRIu64 
> ")",
> ret_value);
>   
> - free(dummy_value);
> -
>   ret_value = 0;
>   ret = rte_rawdev_get_attr(TEST_DEV_ID, "Test2", &ret_value);
>   RTE_TEST_ASSERT_EQUAL(*((int *)(uintptr_t)ret_value), 200,
> "Attribute (Test2) not set correctly (%" PRIu64 
> ")",
> ret_value);
>   
> + free(dummy_value);
> +

The issue that you report is correct - that dummy_value is being 
released before next test - causing segfault.

The problem here is that if free(dummy_value) is called *after* "Test2", 
coverity reports error [See: 88d0e47880ec ("raw/skeleton: fix memory 
leak on test failure"] - and rightly so because RTE_TES_ASSERT_EQUAL() 
returns in case of error.

I will try and find a way out of this.

>   return TEST_SUCCESS;
>   }
>   
> 



Re: [dpdk-dev] [PATCH] bus/dpaa: do nothing if bus not present

2018-12-06 Thread Shreyansh Jain
On Thursday 06 December 2018 03:32 AM, Stephen Hemminger wrote:
> The DPAA bus support code put out messages like:
>   dpaax: read_memory_node():   Unable to glob device-tree memory 
> node: (/proc/device-tree/memory[@0-9]*/reg)(3)
>   dpaax: PA->VA translation not available;
>   dpaax: Expect performance impact.

Though I agree with the change below, I am surprised that you are 
observing such logs as above. These were disabled by bumping the dpaax 
library default log level to ERR:

--->8---
commit 93ec301495316922c0fb1df762e9322bad90b8dc
Author: Shreyansh Jain 
Date:   Wed Oct 17 10:10:34 2018 +

 common/dpaax: reduce log level
---8>---

And the messages you observed above were either WARN or DEBUG.
Is this system running in debug mode?

> 
> These are unnecessary and likely to confuse the end user.
> Fix this by doing nothing if bus is empty.
> 
> Fixes: 5a7dbb934d75 ("dpaa: enable dpaax library")
> Signed-off-by: Stephen Hemminger 
> ---
>   drivers/bus/dpaa/dpaa_bus.c | 7 +--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
> index 203f60dc18cb..204a50b1eba3 100644
> --- a/drivers/bus/dpaa/dpaa_bus.c
> +++ b/drivers/bus/dpaa/dpaa_bus.c
> @@ -542,6 +542,10 @@ rte_dpaa_bus_probe(void)
>   unsigned int svr_ver;
>   int probe_all = rte_dpaa_bus.bus.conf.scan_mode != 
> RTE_BUS_SCAN_WHITELIST;
>   
> + /* If DPAA bus is not present nothing needs to be done */
> + if (TAILQ_EMPTY(&rte_dpaa_bus.device_list))
> + return 0;
> +
>   svr_file = fopen(DPAA_SOC_ID_FILE, "r");
>   if (svr_file) {
>   if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
> @@ -586,8 +590,7 @@ rte_dpaa_bus_probe(void)
>   /* Register DPAA mempool ops only if any DPAA device has
>* been detected.
>*/
> - if (!TAILQ_EMPTY(&rte_dpaa_bus.device_list))
> - rte_mbuf_set_platform_mempool_ops(DPAA_MEMPOOL_OPS_NAME);
> + rte_mbuf_set_platform_mempool_ops(DPAA_MEMPOOL_OPS_NAME);
>   
>   return 0;
>   }
> 

This is actually the right thing to do - No work should be done by probe 
if scan didn't find anything. Thanks.

Acked-by: Shreyansh Jain 


[dpdk-dev] RFC: Support for multiple buffer pool in examples/l3fwd

2018-11-29 Thread Shreyansh Jain
Currently examples/l3fwd/main.c has support for pktmbuf_pool per socket.

L136: static struct rte_mempool * pktmbuf_pool[NB_SOCKETS]; 
 

In various setups, having a separate buffer pool per port (or even per queue) 
can achieve performance many-folds higher than single pool case.
Being the most widely used/referred example application for raw performance, 
examples/l3fwd needs to support such scenarios.

The changes I am expecting are very minimal:

1. Changing pktmbuf_pool[NB_SOCKETS] to either
  - a multi-dimensional array for pktmbuf_pool[NB_SOCKETS][RTE_MAX_ETHPORTS]
  - or pktmbuf_pool[NB_SOCKETS*RTE_MAX_ETHPORTS]
Such that for a given (port, socket) combination, a buffer pool is allocated.
2. This would be done on passing a l3fwd specific argument "--per-port-bpool"
3. During rte_eth_rx_queue_setup(), pool passed would continue to be the one 
for that (port,socket) combination

It is also possible to extend this behavior to per queue basis, but probably 
for the first iteration per-port can be supported. If use-cases for per-queue 
arise, another "-per-queue-bpool" can be added. (But, that would also need a 
larger pktmbuf_pool array.

I am hoping to push out a first-cut very soon.

Regards,
Shreyansh


Re: [dpdk-dev] [PATCH] doc: announce deprecation of rawdev exposed array

2018-11-26 Thread Shreyansh Jain
On Saturday 24 November 2018 11:03 PM, Thomas Monjalon wrote:
> 23/11/2018 17:32, Jerin Jacob:
>> From: Shreyansh Jain 
>>>
>>> rte_rawdevs is expected to be deprecated in future releases. This is
>>> not expected to be directly used, without API access that is, by any
>>> external application or driver.
>>>
>>> Signed-off-by: Shreyansh Jain 
>>
>> Acked-by: Jerin Jacob 
> 
> There are not enoughs acks for this change.
> Anyway, you should first make this array useless by removing any access
> from rte_rawdev_pmd.h. Then you will be able to deprecate it from public API.

Ok. I will send removals in this release (1902) and resend the deprecation.

Thanks Jerin for reading through and Ack.


Re: [dpdk-dev] [PATCH v5 0/4] introduces the enetc PMD driver

2018-11-22 Thread Shreyansh Jain
Hello Ferruh,

On Wednesday 21 November 2018 11:06 PM, Ferruh Yigit wrote:
> On 10/3/2018 8:48 PM, Ferruh Yigit wrote:
>> On 10/3/2018 2:36 PM, Gagandeep Singh wrote:
>>> *ENETC* PMD driver which integrates with the existing PCI bus.
>>> Document is also part of the set
>>>
...
...
>>> Gagandeep Singh (4):
>>>net/enetc: add ENETC PMD with basic operations
>>>net/enetc: enable Rx and Tx
>>>net/enetc: support packet parse type
>>>doc: add usage doc for ENETC PMD
>>
>> For series,
>> Reviewed-by: Ferruh Yigit 
>>
>> Acked-by: Shreyansh Jain 
>>
>> Series applied to dpdk-next-net/master, thanks.
>>
> 
> Can you please send a web page patch [1], to announce NIC support [2]?
> 
> You can benefit from recent samples like 'Marvell NETA' [3] or 'Aquantia
> Atlantic' [4].

I have sent a patch for this here [5] - which also fixes/elaborates 
existing device names.

[5] https://mails.dpdk.org/archives/web/2018-November/000948.html

> 
> Thanks,
> ferruh
> 
> 
> [1]
> https://git.dpdk.org/tools/dpdk-web/
> 
> [2]
> https://core.dpdk.org/supported/
> 
> [3]
> https://mails.dpdk.org/archives/web/2018-October/000908.html
> 
> [4]
> https://mails.dpdk.org/archives/web/2018-November/000922.html
> 



[dpdk-dev] [PATCH] doc: add tested NXP NICs information

2018-11-21 Thread Shreyansh Jain
18.11-rc4 verification done on NXP SoCs with integrated NICs.

Signed-off-by: Shreyansh Jain 
---
 doc/guides/rel_notes/release_18_11.rst | 12 
 1 file changed, 12 insertions(+)

diff --git a/doc/guides/rel_notes/release_18_11.rst 
b/doc/guides/rel_notes/release_18_11.rst
index 32ff0e5c0..ff98b15b5 100644
--- a/doc/guides/rel_notes/release_18_11.rst
+++ b/doc/guides/rel_notes/release_18_11.rst
@@ -586,3 +586,15 @@ Tested Platforms
This section is a comment. Do not overwrite or remove it.
Also, make sure to start the actual text at the margin.
=
+
+* ARM SoC combinations from NXP (with integrated NICs)
+
+   * SoC:
+
+ * NXP/Freescale QorIQ LS1046A with ARM Cortex A72
+ * NXP/Freescale QorIQ LS2088A with ARM Cortex A72
+
+   * OS:
+
+ * Ubuntu 18.04.1 LTS with NXP QorIQ LSDK 1809 support packages
+ * Ubuntu 16.04.3 LTS with NXP QorIQ LSDK 1803 support packages
-- 
2.17.1



[dpdk-dev] [PATCH] doc: announce deprecation of dpaa2 exposed mem structure

2018-11-15 Thread Shreyansh Jain
rte_dpaa2_memsegs is no more required once the dpaax (pa-va) translation
library has been introduced. This can be made internal (for fallback
operations) in subsequent release.

Signed-off-by: Shreyansh Jain 
---
 This diff was generated over a previous patch on same file (a para
 before) [1] - so, it might not apply in case [1] is missed.
 It is possible to merge this and [1] as well, if that makes better sense.

 [1] http://patches.dpdk.org/patch/48118/

 doc/guides/rel_notes/deprecation.rst | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 776b9b245..a2c0d21bc 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -60,3 +60,9 @@ Deprecation Notices
   Currently this is exposed from the library. Ideally, no application should
   be directly using it. This is expected to be deprecated and made internal
   in v19.02 or later.
+
+* dpaa2: removal of ``rte_dpaa2_memsegs`` structure which has been replaced
+  by a pa-va search library. This structure was earlier being used for holding
+  memory segments used by dpaa2 driver for faster pa->va translation. This
+  structure would be made internal (or removed if all dependencies are cleared)
+  in future releases.
-- 
2.17.1



[dpdk-dev] [PATCH] doc: announce deprecation of rawdev exposed array

2018-11-15 Thread Shreyansh Jain
rte_rawdevs is expected to be deprecated in future releases. This is
not expected to be directly used, without API access that is, by any
external application or driver.

Signed-off-by: Shreyansh Jain 

---
 This is in sync with discussion in [1]
 [1] http://mails.dpdk.org/archives/dev/2018-October/114592.html
---
 doc/guides/rel_notes/deprecation.rst | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 34b28234c..776b9b245 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -55,3 +55,8 @@ Deprecation Notices
   - ``rte_pdump_set_socket_dir`` will be removed;
   - The parameter, ``path``, of ``rte_pdump_init`` will be removed;
   - The enum ``rte_pdump_socktype`` will be removed.
+
+* rawdev: ``rte_rawdevs`` is an array containing all registered raw devices.
+  Currently this is exposed from the library. Ideally, no application should
+  be directly using it. This is expected to be deprecated and made internal
+  in v19.02 or later.
-- 
2.17.1



Re: [dpdk-dev] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0

2018-11-01 Thread Shreyansh Jain
On Thursday 01 November 2018 06:49 PM, Ferruh Yigit wrote:
> build error:
> In function ‘fman_if_init’,
>  .../drivers/bus/dpaa/base/fman/fman.c:186:2:
>  error: ‘strncpy’ output may be truncated copying 4095 bytes from a
> string of length 4095 [-Werror=stringop-truncation]
>  strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
> 
> strncpy may result a not null-terminated string,
> replaced it with rte_strscpy
> 
> Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Ferruh Yigit 
> ---

I don't have gcc 9.0 environment to verify this, but the fix looks 
reasonable to me:

Acked-by: Shreyansh Jain 


Re: [dpdk-dev] [PATCH] eal: don't double space init alert messages

2018-10-24 Thread Shreyansh Jain
On Tuesday 23 October 2018 09:59 PM, Stephen Hemminger wrote:
> rte_init_alert already adds a newline, don't do it twice.
> 
> Signed-off-by: Stephen Hemminger 
> ---
>   lib/librte_eal/bsdapp/eal/eal.c   | 24 
>   lib/librte_eal/linuxapp/eal/eal.c | 28 ++--
>   2 files changed, 26 insertions(+), 26 deletions(-)
> 

Reviewed-by: Shreyansh Jain 



[dpdk-dev] [PATCH] common/dpaax: fix incorrect error case

2018-10-23 Thread Shreyansh Jain
In case the memory for nodes cannot be allocated, there is no need
to check for the length. Also, `node_count` is an unsigned value
and cannot be less than 0.

Coverity issue: 323521

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: shreyansh.j...@nxp.com

Signed-off-by: Shreyansh Jain 
---
 drivers/common/dpaax/dpaax_iova_table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.c 
b/drivers/common/dpaax/dpaax_iova_table.c
index d54267bb7..19a4e8c58 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -172,7 +172,7 @@ dpaax_iova_table_populate(void)
}
 
nodes = read_memory_node(&node_count);
-   if (nodes == NULL || node_count <= 0) {
+   if (nodes == NULL) {
DPAAX_WARN("PA->VA translation not available;");
DPAAX_WARN("Expect performance impact.");
return -1;
-- 
2.17.1



[dpdk-dev] [PATCH] raw/skeleton_rawdev: fix memory leak on test failure

2018-10-23 Thread Shreyansh Jain
In skeleton_rawdev unit tests, a malloc'd memory was leaking in case
the next sequential test fails. This fix moves the free of the
malloc'd memory above the failing test.

Coverity issue: 260402

Fixes: 55ca1b0f2151 ("raw/skeleton: add test cases")
Cc: shreyansh.j...@nxp.com

Signed-off-by: Shreyansh Jain 
---
 drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c 
b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
index 3405b8984..359c9e296 100644
--- a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
@@ -294,13 +294,14 @@ test_rawdev_attr_set_get(void)
  "Attribute (Test1) not set correctly (%" PRIu64 
")",
  ret_value);
 
+   free(dummy_value);
+
ret_value = 0;
ret = rte_rawdev_get_attr(TEST_DEV_ID, "Test2", &ret_value);
RTE_TEST_ASSERT_EQUAL(*((int *)(uintptr_t)ret_value), 200,
  "Attribute (Test2) not set correctly (%" PRIu64 
")",
  ret_value);
 
-   free(dummy_value);
return TEST_SUCCESS;
 }
 
-- 
2.17.1



Re: [dpdk-dev] [PATCH] drivers/raw/ifpga_rawdev: fix coverity issue 323508

2018-10-23 Thread Shreyansh Jain
On Tuesday 23 October 2018 03:21 PM, Ferruh Yigit wrote:
> On 10/23/2018 8:09 AM, Shreyansh Jain wrote:
>> Besides the comment I sent before about 'Fixes' before sign-off, a
>> single trivial comment inline ...
>>
>> On Tuesday 23 October 2018 07:20 AM, Rosen Xu wrote:
>>> This patch fixes rte_eal_hotplug_add without checking return value issue
>>>
>>> Signed-off-by: Rosen Xu 
>>> Fixes: ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
>>> Cc: rosen...@intel.com
>>> ---
>>>drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 5 +++--
>>>1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c 
>>> b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
>>> index 3fed057..32e318f 100644
>>> --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
>>> +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
>>> @@ -542,6 +542,7 @@
>>> int port;
>>> char *name = NULL;
>>> char dev_name[RTE_RAWDEV_NAME_MAX_LEN];
>>> +   int ret = -1;
>>>
>>> devargs = dev->device.devargs;
>>>
>>> @@ -583,7 +584,7 @@
>>> snprintf(dev_name, RTE_RAWDEV_NAME_MAX_LEN, "%d|%s",
>>> port, name);
>>>
>>> -   rte_eal_hotplug_add(RTE_STR(IFPGA_BUS_NAME),
>>> +   ret = rte_eal_hotplug_add(RTE_STR(IFPGA_BUS_NAME),
>>> dev_name, devargs->args);
>>
>> Ideally, the function argument spreading on next line should start
>> underneath the previous arguments - something like:
>>
>>  ret = rte_eal_hotplug_add(RTE_STR(IFPGA_BUS_NAME),
>>dev_name, devargs->args);
> 
> Hi Shreyansh,
> 
> According dpdk coding convention [1], indentation done by hard tab, code seems
> inline with coding convention, only perhaps can be done single tab instead of
> double.
> 
> And to remind again, I am not for syntax discussions but just defining one and
> consistently follow it .
> 
> [1]
> https://doc.dpdk.org/guides/contributing/coding_style.html#c-indentation
> https://doc.dpdk.org/guides/contributing/coding_style.html#prototypes
> 

Oh!. Thanks - something I had missed reading.

I don't want to hijack the conversation, but for my clarity, I think

 >>>snprintf(dev_name, RTE_RAWDEV_NAME_MAX_LEN, "%d|%s",
 >>>port, name);

won't be correct. Right?
I am not suggesting that it should be changed now that it is already 
part of code.

>>
>> But, in this file this is not being done at multiple places (for
>> example, the snprintf in this code snippet). So, either you can ignore
>> this comment, or fix it for just this change.
>>
>>>end:
>>> if (kvlist)
>>> @@ -591,7 +592,7 @@
>>> if (name)
>>> free(name);
>>>
>>> -   return 0;
>>> +   return ret;
>>>}
>>>
>>>static int
>>>
>>
>> Otherwise, the patch is simple enough.
>>
>> Acked-by: Shreyansh Jain 
>>
> 



Re: [dpdk-dev] [PATCH] drivers/raw/ifpga_rawdev: fix coverity issue 323508

2018-10-23 Thread Shreyansh Jain
Besides the comment I sent before about 'Fixes' before sign-off, a 
single trivial comment inline ...

On Tuesday 23 October 2018 07:20 AM, Rosen Xu wrote:
> This patch fixes rte_eal_hotplug_add without checking return value issue
> 
> Signed-off-by: Rosen Xu 
> Fixes: ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
> Cc: rosen...@intel.com
> ---
>   drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c 
> b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> index 3fed057..32e318f 100644
> --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> @@ -542,6 +542,7 @@
>   int port;
>   char *name = NULL;
>   char dev_name[RTE_RAWDEV_NAME_MAX_LEN];
> + int ret = -1;
>   
>   devargs = dev->device.devargs;
>   
> @@ -583,7 +584,7 @@
>   snprintf(dev_name, RTE_RAWDEV_NAME_MAX_LEN, "%d|%s",
>   port, name);
>   
> - rte_eal_hotplug_add(RTE_STR(IFPGA_BUS_NAME),
> + ret = rte_eal_hotplug_add(RTE_STR(IFPGA_BUS_NAME),
>   dev_name, devargs->args);

Ideally, the function argument spreading on next line should start 
underneath the previous arguments - something like:

ret = rte_eal_hotplug_add(RTE_STR(IFPGA_BUS_NAME),
  dev_name, devargs->args);

But, in this file this is not being done at multiple places (for 
example, the snprintf in this code snippet). So, either you can ignore 
this comment, or fix it for just this change.

>   end:
>   if (kvlist)
> @@ -591,7 +592,7 @@
>   if (name)
>   free(name);
>   
> - return 0;
> + return ret;
>   }
>   
>   static int
> 

Otherwise, the patch is simple enough.

Acked-by: Shreyansh Jain 


Re: [dpdk-dev] [PATCH] drivers/raw/ifpga_rawdev: fix coverity issue 323508

2018-10-22 Thread Shreyansh Jain
On Tuesday 23 October 2018 07:20 AM, Rosen Xu wrote:
> This patch fixes rte_eal_hotplug_add without checking return value issue
> 
> Signed-off-by: Rosen Xu 
> Fixes: ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
> Cc: rosen...@intel.com
> ---

Fixes comes *before* signed-off.




..





Re: [dpdk-dev] [PATCH] doc: show internal functions in doxygen

2018-10-21 Thread Shreyansh Jain
On Friday 19 October 2018 01:09 PM, Ferruh Yigit wrote:
> On 10/18/2018 6:04 PM, Thomas Monjalon wrote:
>> 18/10/2018 18:22, Ferruh Yigit:
>>> On 10/18/2018 5:08 PM, Thomas Monjalon wrote:
 Not sure we want to show the internal functions to users.
 It may be useful only for PMD developers.
 Do we vote? +1 / -1 welcome!
>>>
>>> What is affected from this setting, can you give an example what was not 
>>> shown
>>> will be shown now?
>>
>> For instance, most of the things in rte_ethdev_core.h.
>> All the doxygen with @internal tag are affected.
> 
> rte_ethdev_core.h is not part of API documentation but I randomly checked
> rte_lpm.h which has some @internal structures.
> 
> But those in the lpm header is the ones for ABI versioning, I think it is
> confusing to expose them to the user, and documentation doesn't highlight that
> it is internal.
> 
> So not a strong opinion, but from my side -1
> 

-1 from me as well.

Even I think it would be overload of information in Doxygen. And to add, 
some places might require re-documenting to cleanup internal markers.
My opinion: direct code would help better than doxygen for these cases.


Re: [dpdk-dev] [PATCH v3 0/4] ethdev port freeing

2018-10-17 Thread Shreyansh Jain
On 10/17/2018 7:24 AM, Thomas Monjalon wrote:
> 

[...]

> 
> Note: this patchset depends on multi-process hotplug series by Qi Zhang,
> which is accepted but waiting for an unrelated DPAA compilation issue
> to be fixed, before landing on master tree.
> 

Can you please point me to which DPAA compilation issue is being 
referred here?

Is that [1]? (which is DPAA2 and patch already sent)

[1] https://mails.dpdk.org/archives/test-report/2018-October/066840.html


[dpdk-dev] [PATCH v2 3/3] net/dpaa2: convert logs from errors to debug

2018-10-17 Thread Shreyansh Jain
In case the link is down during initial link state check, messages for
link state check flood the console. Reducing the log level for these.

Signed-off-by: Shreyansh Jain 
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 3987d13df..d8b7fa186 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1412,7 +1412,7 @@ dpaa2_dev_link_update(struct rte_eth_dev *dev,
 
ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state);
if (ret < 0) {
-   DPAA2_PMD_ERR("error: dpni_get_link_state %d", ret);
+   DPAA2_PMD_DEBUG("error: dpni_get_link_state %d", ret);
return -1;
}
 
@@ -1474,7 +1474,7 @@ dpaa2_dev_set_link_up(struct rte_eth_dev *dev)
}
ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state);
if (ret < 0) {
-   DPAA2_PMD_ERR("Unable to get link state (%d)", ret);
+   DPAA2_PMD_DEBUG("Unable to get link state (%d)", ret);
return -1;
}
 
-- 
2.17.1



[dpdk-dev] [PATCH v2 2/3] bus/fslmc: ignore dpaax pa-va table errors

2018-10-17 Thread Shreyansh Jain
Presence of PA-VA Table is transparent to the drivers. Ignoring the
return values from table update call.

Signed-off-by: Shreyansh Jain 
---
 drivers/bus/fslmc/fslmc_bus.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 5ba5ce96b..db3026f4e 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -386,11 +386,11 @@ rte_fslmc_probe(void)
 * This has to be done before probe as some device initialization
 * (during) probe allocate memory (dpaa2_sec) which needs to be pinned
 * to this table.
+*
+* Error is ignored as relevant logs are handled within dpaax and
+* handling for unavailable dpaax table too is transparent to caller.
 */
-   ret = dpaax_iova_table_populate();
-   if (ret) {
-   DPAA2_BUS_WARN("PA->VA Translation table not available;");
-   }
+   dpaax_iova_table_populate();
 
TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) {
TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
-- 
2.17.1



[dpdk-dev] [PATCH v2 1/3] common/dpaax: reduce logging level

2018-10-17 Thread Shreyansh Jain
DPAAX is a library used by various NXP drivers. In case of non-NXP
environment, this start spewing message about unavailability of
necessary environment.

This patch reduces the log level for certain messages as well as
reduces overall log-level. As a library, these message are not
necessarily relevant at higher log level, either.

Signed-off-by: Shreyansh Jain 
---
 drivers/common/dpaax/dpaax_iova_table.c | 35 +
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.c 
b/drivers/common/dpaax/dpaax_iova_table.c
index 075053b1a..213f75dff 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -69,8 +69,8 @@ read_memory_node(unsigned int *count)
 
ret = glob(MEM_NODE_PATH_GLOB, 0, NULL, &result);
if (ret != 0) {
-   DPAAX_ERR("Unable to glob device-tree memory node: (%s)(%d)",
-  MEM_NODE_PATH_GLOB, ret);
+   DPAAX_DEBUG("Unable to glob device-tree memory node: (%s)(%d)",
+   MEM_NODE_PATH_GLOB, ret);
goto out;
}
 
@@ -78,8 +78,8 @@ read_memory_node(unsigned int *count)
/* Either more than one memory@ node found, or none.
 * In either case, cannot work ahead.
 */
-   DPAAX_ERR("Found (%zu) entries in device-tree. Not supported!",
- result.gl_pathc);
+   DPAAX_DEBUG("Found (%zu) entries in device-tree. Not 
supported!",
+   result.gl_pathc);
goto out;
}
 
@@ -87,28 +87,29 @@ read_memory_node(unsigned int *count)
result.gl_pathv[0]);
fd = open(result.gl_pathv[0], O_RDONLY);
if (fd < 0) {
-   DPAAX_ERR("Unable to open the device-tree node: (%s)(fd=%d)",
- MEM_NODE_PATH_GLOB, fd);
+   DPAAX_DEBUG("Unable to open the device-tree node: (%s)(fd=%d)",
+   MEM_NODE_PATH_GLOB, fd);
goto cleanup;
}
 
/* Stat to get the file size */
ret = fstat(fd, &statbuf);
if (ret != 0) {
-   DPAAX_ERR("Unable to get device-tree memory node size.");
+   DPAAX_DEBUG("Unable to get device-tree memory node size.");
goto cleanup;
}
 
DPAAX_DEBUG("Size of device-tree mem node: %lu", statbuf.st_size);
if (statbuf.st_size > MEM_NODE_FILE_LEN) {
-   DPAAX_WARN("More memory nodes available than assumed.");
-   DPAAX_WARN("System may not work properly!");
+   DPAAX_DEBUG("More memory nodes available than assumed.");
+   DPAAX_DEBUG("System may not work properly!");
}
 
ret = read(fd, file_data, statbuf.st_size > MEM_NODE_FILE_LEN ?
  MEM_NODE_FILE_LEN : statbuf.st_size);
if (ret <= 0) {
-   DPAAX_ERR("Unable to read device-tree memory node: (%d)", ret);
+   DPAAX_DEBUG("Unable to read device-tree memory node: (%d)",
+   ret);
goto cleanup;
}
 
@@ -117,15 +118,15 @@ read_memory_node(unsigned int *count)
 */
*count = (statbuf.st_size / 16);
if ((*count) <= 0 || (statbuf.st_size % 16 != 0)) {
-   DPAAX_ERR("Invalid memory node values or count. (size=%lu)",
- statbuf.st_size);
+   DPAAX_DEBUG("Invalid memory node values or count. (size=%lu)",
+   statbuf.st_size);
goto cleanup;
}
 
/* each entry is of 16 bytes, and size/16 is total count of entries */
nodes = malloc(sizeof(struct reg_node) * (*count));
if (!nodes) {
-   DPAAX_ERR("Failure in allocating working memory.");
+   DPAAX_DEBUG("Failure in allocating working memory.");
goto cleanup;
}
memset(nodes, 0, sizeof(struct reg_node) * (*count));
@@ -420,9 +421,9 @@ dpaax_memevent_cb(enum rte_mem_event type, const void 
*addr, size_t len,
ret = dpaax_iova_table_update(phys_addr, 0, map_len);
 
if (ret != 0) {
-   DPAAX_ERR("PA-Table entry update failed. "
- "Map=%d, addr=%p, len=%zu, err:(%d)",
- type, va, map_len, ret);
+   DPAAX_DEBUG("PA-Table entry update failed. "
+   "Map=%d, addr=%p, len=%zu, err:(%d)",
+   type, va, map_len, ret);
return;
 

[dpdk-dev] [PATCH v2 0/3] Reduce logging level for dpaax and fslmc

2018-10-17 Thread Shreyansh Jain
Based on discussion in [1], some logs for dpaax have been reduced
to DEBUG state only. All logs which are not part of exposed API
(like dpaax_iova_table_populate), only dump DEBUG now. Other exposed
API also don't dump ERR as this library needs to be transparent. Only
WARN is used.

Patch 1:
 .) change ERR -> DEBUG
 .) Default log level is set to ERR
Patch 2:
 .) Not checking the returns from dpaax library - even if that is failed,
the PA->VA translation would still work, albeit with old method.
Patch 3:
 .) While working on Patch 1, some logs from net/dpaa2 were also
observed which shouldn't necessarily be ERR. Changed them to
DEBUG.

[1] http://mails.dpdk.org/archives/dev/2018-October/116096.html

Version History:
v2:
 - Added patch description in patch 1

Shreyansh Jain (3):
  common/dpaax: reduce logging level
  bus/fslmc: ignore dpaax pa-va table errors
  net/dpaa2: convert logs from errors to debug

 drivers/bus/fslmc/fslmc_bus.c   |  8 +++---
 drivers/common/dpaax/dpaax_iova_table.c | 35 +
 drivers/net/dpaa2/dpaa2_ethdev.c|  4 +--
 3 files changed, 24 insertions(+), 23 deletions(-)

-- 
2.17.1



Re: [dpdk-dev] dpaax warnings

2018-10-17 Thread Shreyansh Jain
On Wednesday 17 October 2018 11:29 AM, Shreyansh Jain wrote:
> On Wednesday 17 October 2018 03:57 AM, Thomas Monjalon wrote:
>> Hi Shreyansh,
>>
>> When initializing DPDK on x86, we get those warnings:
>>  dpaax: Unable to glob device-tree memory node: 
>> (/proc/device-tree/memory[@0-9]*/reg)(3)
>>  dpaax: PA->VA translation not available;
>>  dpaax: Expect performance impact.
>>
>> Is it possible to avoid running dpaax init when not available?
>>
> 
> I will send a fix. I think only option I have is to reduce the level of
> the messages. This message essentially states that as dpaax bus was not
> found, the library won't work.
> 
> I will send a patch.
> 

Sent a set of patches for this:
http://patches.dpdk.org/project/dpdk/list/?series=1947

-
Shreyansh



[dpdk-dev] [PATCH 3/3] net/dpaa2: convert logs from errors to debug

2018-10-17 Thread Shreyansh Jain
In case the link is down during initial link state check, messages for
link state check flood the console. Reducing the log level for these.

Signed-off-by: Shreyansh Jain 
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 3987d13df..d8b7fa186 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1412,7 +1412,7 @@ dpaa2_dev_link_update(struct rte_eth_dev *dev,
 
ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state);
if (ret < 0) {
-   DPAA2_PMD_ERR("error: dpni_get_link_state %d", ret);
+   DPAA2_PMD_DEBUG("error: dpni_get_link_state %d", ret);
return -1;
}
 
@@ -1474,7 +1474,7 @@ dpaa2_dev_set_link_up(struct rte_eth_dev *dev)
}
ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state);
if (ret < 0) {
-   DPAA2_PMD_ERR("Unable to get link state (%d)", ret);
+   DPAA2_PMD_DEBUG("Unable to get link state (%d)", ret);
return -1;
}
 
-- 
2.17.1



[dpdk-dev] [PATCH 0/3] Reduce logging level for dpaax and fslmc

2018-10-17 Thread Shreyansh Jain
Based on discussion in [1], some logs for dpaax have been reduced
to DEBUG state only. All logs which are not part of exposed API
(like dpaax_iova_table_populate), only dump DEBUG now. Other exposed
API also don't dump ERR as this library needs to be transparent. Only
WARN is used.

Patch 1:
 .) change ERR -> DEBUG
 .) Default log level is set to ERR
Patch 2:
 .) Not checking the returns from dpaax library - even if that is failed,
the PA->VA translation would still work, albeit with old method.
Patch 3:
 .) While working on Patch 1, some logs from net/dpaa2 were also
observed which shouldn't necessarily be ERR. Changed them to
DEBUG.

[1] http://mails.dpdk.org/archives/dev/2018-October/116096.html

Shreyansh Jain (3):
  common/dpaax: reduce logging level
  bus/fslmc: ignore dpaax pa-va table errors
  net/dpaa2: convert logs from errors to debug

 drivers/bus/fslmc/fslmc_bus.c   |  8 +++---
 drivers/common/dpaax/dpaax_iova_table.c | 35 +
 drivers/net/dpaa2/dpaa2_ethdev.c|  4 +--
 3 files changed, 24 insertions(+), 23 deletions(-)

-- 
2.17.1



  1   2   3   4   5   6   7   8   9   10   >