[dpdk-dev] [PATCH v2] pcap, null: Fix memory leaks of 'struct rte_kvargs'

2015-03-17 Thread Thomas Monjalon
2015-03-17 13:12, Tetsuya Mukawa:
> 'struct rte_kvargs' is allocated in rte_kvargs_parse(), and should be
> freed with rte_kvargs_free().
> This patch fixes memory leaks of 'struct rte_kvargs' in below PMDs.
>  - pcap PMD
>  - null PMD
> 
> Reported-by: Mcnamara, John 
> Signed-off-by: Tetsuya Mukawa 

Split and applied, thanks



[dpdk-dev] [PATCH] tools: remove chmod absolute path in setup.sh

2015-03-17 Thread Thomas Monjalon
2015-03-12 18:18, Andre Richter:
> setup.sh uses /usr/bin/chmod, but depending on distribution, it is not always 
> there.
> For example, Ubuntu has /bin/chmod. Fix this by removing the absolute path, 
> like it is
> done e.g. with grep.

Applied, thanks



[dpdk-dev] [PATCH] rte_mbuf: bulk allocation and freeing functions + unittest

2015-03-17 Thread Vadim Suraev
Hi, Olivier,

>I don't understand the "assumes refcnt has been already decremented".

I changed to 'assumes refcnt equals 0'

>Adding this function is not a problem today because it is the free
> function associated to rte_pktmbuf_bulk_raw_alloc().

>However, I think that the 'raw' alloc/free functions should be removed
>in the future as they are just wrappers to mempool_get/put. There is
> a problem with that today because the raw alloc also sets the refcnt,
> but I think it could go in pktmbuf_reset(). I plan to do that for dpdk
> 2.1, what do you think?

raw* functions in this patch seem to be redundant, removed it.

Regarding the rest of comments, applied and re-posted the patch.
Regards,
 Vadim.

On Mon, Mar 16, 2015 at 11:50 AM, Olivier MATZ 
wrote:

> Hi Vadim,
>
> Please see some comments below.
>
> On 03/13/2015 11:14 AM, vadim.suraev at gmail.com wrote:
> > From: "vadim.suraev at gmail.com" 
> >
> > - an API function to allocate a bulk of rte_mbufs
> > - an API function to free a bulk of rte_mbufs
> > - an API function to free a chained rte_mbuf
> > - unittest for aboce
> >
> > Signed-off-by: vadim.suraev at gmail.com 
> > ---
> >  app/test/test_mbuf.c   |   73 
> >  lib/librte_mbuf/rte_mbuf.h |  101
> 
> >  2 files changed, 174 insertions(+)
> >
> > diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
> > index 1ff66cb..a557705 100644
> > --- a/app/test/test_mbuf.c
> > +++ b/app/test/test_mbuf.c
> > @@ -405,6 +405,67 @@ test_pktmbuf_pool(void)
> >   return ret;
> >  }
> >
> > +/* test pktmbuf bulk allocation and freeing
> > +*/
> > +static int
> > +test_pktmbuf_pool_bulk(void)
> > +{
> > + unsigned i;
> > + unsigned mbufs_to_allocate = NB_MBUF - 32; /* size of mempool -
> size of local cache, otherwise may fail */
>
> Can you add a constant for local cache size?
>
>
> > + struct rte_mbuf *m[mbufs_to_allocate];
> > + int ret = 0;
> > + unsigned mbuf_count_before_allocation =
> rte_mempool_count(pktmbuf_pool);
> > +
> > + for (i=0; i > + m[i] = NULL;
> > + /* alloc NB_MBUF-32 mbufs */
> > + if ((ret = rte_pktmbuf_alloc_bulk(pktmbuf_pool, m,
> mbufs_to_allocate))) {
> > + printf("cannot allocate %d mbufs bulk mempool_count=%d
> ret=%d\n", mbufs_to_allocate, rte_mempool_count(pktmbuf_pool), ret);
> > + return -1;
> > + }
> > + if ((rte_mempool_count(pktmbuf_pool) + mbufs_to_allocate) !=
> mbuf_count_before_allocation) {
> > + printf("mempool count %d + allocated %d != initial %d\n",
> > + rte_mempool_count(pktmbuf_pool),
> mbufs_to_allocate, mbuf_count_before_allocation);
> > + return -1;
> > + }
>
> Could you verify your modifications with checkpatch? It will triggers
> warnings for lines exceeding 80 columns or missing spaces around
> operators (even though it's like this in the rest of the file).
>
>
> > + /* free them */
> > + rte_pktmbuf_bulk_free(m, mbufs_to_allocate);
> > +
> > + if (rte_mempool_count(pktmbuf_pool)  !=
> mbuf_count_before_allocation) {
> > + printf("mempool count %d != initial %d\n",
> > + rte_mempool_count(pktmbuf_pool),
> mbuf_count_before_allocation);
> > + return -1;
> > + }
> > + for (i=0; i > + m[i] = NULL;
> > +
> > + /* alloc NB_MBUF-32 mbufs */
> > + if ((ret = rte_pktmbuf_alloc_bulk(pktmbuf_pool, m,
> mbufs_to_allocate))) {
> > + printf("cannot allocate %d mbufs bulk mempool_count=%d
> ret=%d\n", mbufs_to_allocate, rte_mempool_count(pktmbuf_pool), ret);
> > + return -1;
> > + }
> > + if ((rte_mempool_count(pktmbuf_pool) + mbufs_to_allocate) !=
> mbuf_count_before_allocation) {
> > + printf("mempool count %d + allocated %d != initial %d\n",
> > + rte_mempool_count(pktmbuf_pool),
> mbufs_to_allocate, mbuf_count_before_allocation);
> > + return -1;
> > + }
> > +
> > + /* chain it */
> > + for (i=0; i< mbufs_to_allocate - 1; i++) {
> > + m[i]->next = m[i + 1];
> > + m[0]->nb_segs++;
> > + }
> > + /* free them */
> > + rte_pktmbuf_free_chain(m[0]);
> > +
> > + if (rte_mempool_count(pktmbuf_pool)  !=
> mbuf_count_before_allocation) {
> > + printf("mempool count %d != initial %d\n",
> > + rte_mempool_count(pktmbuf_pool),
> mbuf_count_before_allocation);
> > + return -1;
> > + }
> > + return ret;
> > +}
> > +
> >  /*
> >   * test that the pointer to the data on a packet mbuf is set properly
> >   */
> > @@ -790,6 +851,18 @@ test_mbuf(void)
> >   return -1;
> >   }
> >
> > + /* test bulk allocation and freeing */
> > + if (test_pktmbuf_pool_bulk() < 0) {
> > + printf("test_pktmbuf_pool_bulk() failed\n");
> > +

[dpdk-dev] [PATCH] version: fix include

2015-03-17 Thread Thomas Monjalon
> When including rte_version.h without string.h, there is a compilation error:
> include/rte_version.h: error: implicit declaration of function ?strlen?
> 
> Signed-off-by: Thomas Monjalon 

Applied


[dpdk-dev] [PATCH v5] ABI: Add abi checking utility

2015-03-17 Thread Thomas Monjalon
2015-03-17 14:08, Neil Horman:
> There was a request for an abi validation utilty for the ongoing ABI stability
> work.  As it turns out there is a abi compliance checker in development that
> seems to be under active development and provides fairly detailed ABI 
> compliance
> reports.  Its not yet intellegent enough to understand symbol versioning, but 
> it
> does provide the ability to identify symbols which have changed between
> releases, along with details of the change, and offers developers the
> opportunity to identify which symbols then need versioning and validation for 
> a
> given update via manual testing.
> 
> This script automates the use of the compliance checker between two 
> arbitrarily
> specified tags within the dpdk tree.  To execute enter the $RTE_SDK directory
> and run:
> 
> ./scripts/validate_abi.sh $GIT_TAG1 $GIT_TAG2 $CONFIG
> 
> where $GIT_TAG1 and 2 are git tags and $CONFIG is a config specification
> suitable for passing as the T= variable in the make config command.
> 
> Note the upstream source for the abi compliance checker is here:
> http://ispras.linuxbase.org/index.php/ABI_compliance_checker
> 
> It generates a report for each DSO built from the requested tags that 
> developers
> can review to find ABI compliance issues.
> 
> Signed-off-by: Neil Horman 
> ---
> 
> Change Notes:
> 
> v2) Fixed some typos as requested by Thomas
> 
> v3) Fixed some additional typos Thomas requested
> Improved script to work from detached state
> Added some documentation to the changelog
> Added some comments to the scripts
> 
> v4) Remove duplicate exports.
> Move restoration of starting branch/comit to cleanup_and_exit
> 
> v5) Fixed exit cleanup
> Added MAINTAINERS entry

Acked-by: Thomas Monjalon 

Applied, thanks


[dpdk-dev] [PATCH] rte_mbuf: mbuf bulk alloc/free functions added + unittest

2015-03-17 Thread vadim.sur...@gmail.com
From: "vadim.suraev at gmail.com" 

- an API function to allocate a bulk of rte_mbufs
- an API function to free a bulk of rte_mbufs
- an API function to free a chained rte_mbuf
- unittest for above

Signed-off-by: vadim.suraev at gmail.com 
---
 app/test/test_mbuf.c   |   94 +++-
 lib/librte_mbuf/rte_mbuf.h |   89 +
 2 files changed, 182 insertions(+), 1 deletion(-)

diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index 1ff66cb..b20c6a4 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -77,6 +77,7 @@
 #define REFCNT_RING_SIZE(REFCNT_MBUF_NUM * REFCNT_MAX_REF)

 #define MAKE_STRING(x)  # x
+#define MBUF_POOL_LOCAL_CACHE_SIZE 32

 static struct rte_mempool *pktmbuf_pool = NULL;

@@ -405,6 +406,84 @@ test_pktmbuf_pool(void)
return ret;
 }

+/* test pktmbuf bulk allocation and freeing
+*/
+static int
+test_pktmbuf_pool_bulk(void)
+{
+   unsigned i;
+   /* size of mempool - size of local cache, otherwise may fail */
+   unsigned mbufs_to_allocate = NB_MBUF - MBUF_POOL_LOCAL_CACHE_SIZE;
+   struct rte_mbuf *m[mbufs_to_allocate];
+   int ret = 0;
+   unsigned mbuf_count_before_allocation = rte_mempool_count(pktmbuf_pool);
+
+   for (i = 0; i < mbufs_to_allocate; i++)
+   m[i] = NULL;
+   /* alloc NB_MBUF-MBUF_POOL_LOCAL_CACHE_SIZE mbufs */
+   ret = rte_pktmbuf_alloc_bulk(pktmbuf_pool, m, mbufs_to_allocate);
+   if (ret) {
+   printf("cannot allocate %d mbufs bulk mempool_cnt=%d ret=%d\n",
+   mbufs_to_allocate,
+   rte_mempool_count(pktmbuf_pool),
+   ret);
+   return -1;
+   }
+   if ((rte_mempool_count(pktmbuf_pool) + mbufs_to_allocate) !=
+   mbuf_count_before_allocation) {
+   printf("mempool count %d + allocated %d != initial %d\n",
+   rte_mempool_count(pktmbuf_pool),
+   mbufs_to_allocate,
+   mbuf_count_before_allocation);
+   return -1;
+   }
+   /* free them */
+   rte_pktmbuf_bulk_free(m, mbufs_to_allocate);
+
+   if (rte_mempool_count(pktmbuf_pool)  != mbuf_count_before_allocation) {
+   printf("mempool count %d != initial %d\n",
+   rte_mempool_count(pktmbuf_pool),
+   mbuf_count_before_allocation);
+   return -1;
+   }
+   for (i = 0; i < mbufs_to_allocate; i++)
+   m[i] = NULL;
+
+   /* alloc NB_MBUF-MBUF_POOL_LOCAL_CACHE_SIZE mbufs */
+   ret = rte_pktmbuf_alloc_bulk(pktmbuf_pool, m, mbufs_to_allocate);
+   if (ret) {
+   printf("cannot allocate %d mbufs bulk mempool_cnt=%d ret=%d\n",
+   mbufs_to_allocate,
+   rte_mempool_count(pktmbuf_pool),
+   ret);
+   return -1;
+   }
+   if ((rte_mempool_count(pktmbuf_pool) + mbufs_to_allocate) !=
+   mbuf_count_before_allocation) {
+   printf("mempool count %d + allocated %d != initial %d\n",
+   rte_mempool_count(pktmbuf_pool),
+ mbufs_to_allocate,
+ mbuf_count_before_allocation);
+   return -1;
+   }
+
+   /* chain it */
+   for (i = 0; i < mbufs_to_allocate - 1; i++) {
+   m[i]->next = m[i + 1];
+   m[0]->nb_segs++;
+   }
+   /* free them */
+   rte_pktmbuf_free_chain(m[0]);
+
+   if (rte_mempool_count(pktmbuf_pool)  != mbuf_count_before_allocation) {
+   printf("mempool count %d != initial %d\n",
+   rte_mempool_count(pktmbuf_pool),
+ mbuf_count_before_allocation);
+   return -1;
+   }
+   return ret;
+}
+
 /*
  * test that the pointer to the data on a packet mbuf is set properly
  */
@@ -766,7 +845,8 @@ test_mbuf(void)
if (pktmbuf_pool == NULL) {
pktmbuf_pool =
rte_mempool_create("test_pktmbuf_pool", NB_MBUF,
-  MBUF_SIZE, 32,
+  MBUF_SIZE,
+  MBUF_POOL_LOCAL_CACHE_SIZE,
   sizeof(struct 
rte_pktmbuf_pool_private),
   rte_pktmbuf_pool_init, NULL,
   rte_pktmbuf_init, NULL,
@@ -790,6 +870,18 @@ test_mbuf(void)
return -1;
}

+   /* test bulk allocation and freeing */
+   if (test_pktmbuf_pool_bulk() < 0) {
+   printf("test_pktmbuf_pool_bulk() failed\n");
+   return -1;
+   }
+
+   /* once again to ensure all mbufs were freed */
+   if 

[dpdk-dev] [PATCH v2 0/2] doc: update doc for fm10k driver

2015-03-17 Thread Thomas Monjalon
> Update programming guide and release notes for fm10k driver.
> 
> Changes in v2:
> - Remove a punctuation.
> 
> 
> Chen Jing D(Mark) (2):
>   doc: update programmers guide for fm10k pmd driver
>   doc: update release note for fm10k pmd driver
> 
> Acked-by Siobhan Butler 

Applied, thanks


[dpdk-dev] [PATCH] doc: add l2fwd-jobstats user guide

2015-03-17 Thread Thomas Monjalon
Hi Pawel,

2015-03-11 10:41, Pawel Wodkowski:
>  doc/guides/sample_app_ug/index.rst|   1 +
>  doc/guides/sample_app_ug/l2_forward_job_stats.rst | 637 
> ++
>  2 files changed, 638 insertions(+)

My checkpatch has detected 25 trailing whitespaces and 2 typos:

WARNING:TYPO_SPELLING: 'avalable' may be misspelled - perhaps 'available'?
#541: FILE: doc/guides/sample_app_ug/l2_forward_job_stats.rst:470:
+for this lcore. Statistics from this part of code is considered as the 
headroom avalable fo additional processing.

WARNING:TYPO_SPELLING: 'procesed' may be misspelled - perhaps 'processed'?
#582: FILE: doc/guides/sample_app_ug/l2_forward_job_stats.rst:511:
+This second read is important to give job stats library a feedback how many 
packets was procesed.

Please send a v2. Thanks


[dpdk-dev] [PATCH] rte_mbuf: mbuf bulk alloc/free functions added + unittest

2015-03-17 Thread Thomas Monjalon
Hi Vadim,

It would be easier to track your changes if you were adding v2 and changelog.
Thanks

2015-03-17 22:16, vadim.suraev at gmail.com:
> From: "vadim.suraev at gmail.com" 
> 
> - an API function to allocate a bulk of rte_mbufs
> - an API function to free a bulk of rte_mbufs
> - an API function to free a chained rte_mbuf
> - unittest for above
> 
> Signed-off-by: vadim.suraev at gmail.com 

You should put your name before the email address.

> ---
>  app/test/test_mbuf.c   |   94 
> +++-
>  lib/librte_mbuf/rte_mbuf.h |   89 +
>  2 files changed, 182 insertions(+), 1 deletion(-)



[dpdk-dev] [PATCH 6/6] eal: Fix interface of pci_map_resource()

2015-03-17 Thread Tetsuya Mukawa
The function is implemented in both linuxapp and bsdapp, but interface
is different. The patch fixes the function of bsdapp to do same as
linuxapp. After applying it, file descriptor should be opened and
closed out of pci_map_resource().
Also, remove redundant error messages from linuxapp.

Signed-off-by: Tetsuya Mukawa 
---
 lib/librte_eal/bsdapp/eal/eal_pci.c   | 109 ++
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c |  21 +++---
 2 files changed, 75 insertions(+), 55 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c 
b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 08b91b4..21a3d79 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -100,7 +100,7 @@ struct mapped_pci_resource {

struct rte_pci_addr pci_addr;
char path[PATH_MAX];
-   size_t nb_maps;
+   int nb_maps;
struct pci_map maps[PCI_MAX_RESOURCE];
 };

@@ -122,47 +122,30 @@ pci_unbind_kernel_driver(struct rte_pci_device *dev 
__rte_unused)

 /* map a particular resource from a file */
 static void *
-pci_map_resource(void *requested_addr, const char *devname, off_t offset,
-size_t size)
+pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
+int additional_flags)
 {
-   int fd;
void *mapaddr;

-   /*
-* open devname, to mmap it
-*/
-   fd = open(devname, O_RDWR);
-   if (fd < 0) {
-   RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-   devname, strerror(errno));
-   goto fail;
-   }
-
/* Map the PCI memory resource of device */
mapaddr = mmap(requested_addr, size, PROT_READ | PROT_WRITE,
-   MAP_SHARED, fd, offset);
-   close(fd);
-   if (mapaddr == MAP_FAILED ||
-   (requested_addr != NULL && mapaddr != requested_addr)) {
-   RTE_LOG(ERR, EAL, "%s(): cannot mmap(%s(%d), %p, 0x%lx, 0x%lx):"
-   " %s (%p)\n", __func__, devname, fd, requested_addr,
+   MAP_SHARED | additional_flags, fd, offset);
+   if (mapaddr == MAP_FAILED) {
+   RTE_LOG(ERR, EAL,
+   "%s(): cannot mmap(%d, %p, 0x%lx, 0x%lx): %s (%p)\n",
+   __func__, fd, requested_addr,
(unsigned long)size, (unsigned long)offset,
strerror(errno), mapaddr);
-   goto fail;
-   }
-
-   RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
+   } else
+   RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);

return mapaddr;
-
-fail:
-   return NULL;
 }

 static int
 pci_uio_map_secondary(struct rte_pci_device *dev)
 {
-   size_t i;
+   int i, fd;
struct mapped_pci_resource *uio_res;
struct mapped_pci_res_list *uio_res_list =
RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list);
@@ -170,19 +153,34 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
TAILQ_FOREACH(uio_res, uio_res_list, next) {

/* skip this element if it doesn't match our PCI address */
-   if (memcmp(_res->pci_addr, >addr, sizeof(dev->addr)))
+   if (rte_eal_compare_pci_addr(_res->pci_addr, >addr))
continue;

for (i = 0; i != uio_res->nb_maps; i++) {
-   if (pci_map_resource(uio_res->maps[i].addr,
-uio_res->path,
-(off_t)uio_res->maps[i].offset,
-(size_t)uio_res->maps[i].size)
-   != uio_res->maps[i].addr) {
+   /*
+* open devname, to mmap it
+*/
+   fd = open(uio_res->maps[i].path, O_RDWR);
+   if (fd < 0) {
+   RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
+   uio_res->maps[i].path, strerror(errno));
+   return -1;
+   }
+
+   void *mapaddr = pci_map_resource(uio_res->maps[i].addr,
+   fd, (off_t)uio_res->maps[i].offset,
+   (size_t)uio_res->maps[i].size, 0);
+   if (mapaddr != uio_res->maps[i].addr) {
RTE_LOG(ERR, EAL,
-   "Cannot mmap device resource\n");
+   "Cannot mmap device resource "
+   "file %s to address: %p\n",
+   uio_res->maps[i].path,
+   uio_res->maps[i].addr);
+   close(fd);

[dpdk-dev] [PATCH 5/6] eal: Use map_idx in pci_uio_map_resource() of bsdapp to work same as linuxapp

2015-03-17 Thread Tetsuya Mukawa
This patch changes code that maps pci resources in bsdapp.
Linuxapp has almost same code. To consolidate both, fix implementation
of bsdapp to work same as linuxapp.

Signed-off-by: Tetsuya Mukawa 
---
 lib/librte_eal/bsdapp/eal/eal_pci.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c 
b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 85f8671..08b91b4 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -195,7 +195,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 static int
 pci_uio_map_resource(struct rte_pci_device *dev)
 {
-   int i, j;
+   int i, map_idx;
char devname[PATH_MAX]; /* contains the /dev/uioX */
void *mapaddr;
uint64_t phaddr;
@@ -247,31 +247,31 @@ pci_uio_map_resource(struct rte_pci_device *dev)
pagesz = sysconf(_SC_PAGESIZE);

maps = uio_res->maps;
-   for (i = uio_res->nb_maps = 0; i != PCI_MAX_RESOURCE; i++) {
+   for (i = 0, map_idx = 0; i != PCI_MAX_RESOURCE; i++) {

-   j = uio_res->nb_maps;
/* skip empty BAR */
if ((phaddr = dev->mem_resource[i].phys_addr) == 0)
continue;

/* if matching map is found, then use it */
offset = i * pagesz;
-   maps[j].offset = offset;
-   maps[j].phaddr = dev->mem_resource[i].phys_addr;
-   maps[j].size = dev->mem_resource[i].len;
-   if (maps[j].addr != NULL ||
-   (mapaddr = pci_map_resource(NULL, devname, (off_t)offset,
-   (size_t)maps[j].size)
-   ) == NULL) {
+   maps[map_idx].offset = offset;
+   maps[map_idx].phaddr = dev->mem_resource[i].phys_addr;
+   maps[map_idx].size = dev->mem_resource[i].len;
+   mapaddr = pci_map_resource(NULL, devname, (off_t)offset,
+   (size_t)maps[map_idx].size);
+   if ((maps[map_idx].addr != NULL) || (mapaddr == NULL)) {
rte_free(uio_res);
return -1;
}

-   maps[j].addr = mapaddr;
-   uio_res->nb_maps++;
+   maps[map_idx].addr = mapaddr;
+   map_idx++;
dev->mem_resource[i].addr = mapaddr;
}

+   uio_res->nb_maps = map_idx;
+
TAILQ_INSERT_TAIL(uio_res_list, uio_res, next);

return 0;
-- 
1.9.1



[dpdk-dev] [PATCH 4/6] eal/bsdapp: Change names of pci related data structure

2015-03-17 Thread Tetsuya Mukawa
To merge pci code of linuxapp and bsdapp, this patch changes names
like below.
 - uio_map to pci_map
 - uio_resource to mapped_pci_resource
 - uio_res_list to mapped_pci_res_list
Also, add 'path' variable to pci_map of bsdapp.

Signed-off-by: Tetsuya Mukawa 
---
 lib/librte_eal/bsdapp/eal/eal_pci.c | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c 
b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 3a22b49..85f8671 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -83,8 +83,9 @@
  * enabling bus master.
  */

-struct uio_map {
+struct pci_map {
void *addr;
+   char *path;
uint64_t offset;
uint64_t size;
uint64_t phaddr;
@@ -94,16 +95,16 @@ struct uio_map {
  * For multi-process we need to reproduce all PCI mappings in secondary
  * processes, so save them in a tailq.
  */
-struct uio_resource {
-   TAILQ_ENTRY(uio_resource) next;
+struct mapped_pci_resource {
+   TAILQ_ENTRY(mapped_pci_resource) next;

struct rte_pci_addr pci_addr;
char path[PATH_MAX];
size_t nb_maps;
-   struct uio_map maps[PCI_MAX_RESOURCE];
+   struct pci_map maps[PCI_MAX_RESOURCE];
 };

-TAILQ_HEAD(uio_res_list, uio_resource);
+TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);

 static struct rte_tailq_elem rte_uio_tailq = {
.name = "UIO_RESOURCE_LIST",
@@ -162,9 +163,9 @@ static int
 pci_uio_map_secondary(struct rte_pci_device *dev)
 {
size_t i;
-   struct uio_resource *uio_res;
-   struct uio_res_list *uio_res_list =
-   RTE_TAILQ_CAST(rte_uio_tailq.head, uio_res_list);
+   struct mapped_pci_resource *uio_res;
+   struct mapped_pci_res_list *uio_res_list =
+   RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list);

TAILQ_FOREACH(uio_res, uio_res_list, next) {

@@ -201,10 +202,10 @@ pci_uio_map_resource(struct rte_pci_device *dev)
uint64_t offset;
uint64_t pagesz;
struct rte_pci_addr *loc = >addr;
-   struct uio_resource *uio_res;
-   struct uio_res_list *uio_res_list =
-   RTE_TAILQ_CAST(rte_uio_tailq.head, uio_res_list);
-   struct uio_map *maps;
+   struct mapped_pci_resource *uio_res;
+   struct mapped_pci_res_list *uio_res_list =
+   RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list);
+   struct pci_map *maps;

dev->intr_handle.fd = -1;
dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN;
-- 
1.9.1



[dpdk-dev] [PATCH 3/6] eal: Fix memory leaks and needless incrementation of pci uio implementation

2015-03-17 Thread Tetsuya Mukawa
When pci_map_resource() is failed but path is allocated correctly,
path won't be freed. Also, when open() is failed, uio_res won't be freed.
This patch fixes these memory leaks.
When pci_map_resource() is failed, mapaddr will be MAP_FAILED.
In this case, pci_map_addr should not be incremented.

Also, the patch fixes belows.
 - To shrink code, move close().
 - Remove fail variable.

Signed-off-by: Tetsuya Mukawa 
---
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c 
b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
index b971ec9..5044884 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
@@ -333,7 +333,6 @@ pci_uio_map_resource(struct rte_pci_device *dev)
maps = uio_res->maps;
for (i = 0, map_idx = 0; i != PCI_MAX_RESOURCE; i++) {
int fd;
-   int fail = 0;

/* skip empty BAR */
phaddr = dev->mem_resource[i].phys_addr;
@@ -347,6 +346,11 @@ pci_uio_map_resource(struct rte_pci_device *dev)
loc->domain, loc->bus, loc->devid, 
loc->function,
i);

+   /* allocate memory to keep path */
+   maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0);
+   if (maps[map_idx].path == NULL)
+   goto fail0;
+
/*
 * open resource file, to mmap it
 */
@@ -354,7 +358,7 @@ pci_uio_map_resource(struct rte_pci_device *dev)
if (fd < 0) {
RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
devname, strerror(errno));
-   return -1;
+   goto fail1;
}

/* try mapping somewhere close to the end of hugepages */
@@ -363,23 +367,13 @@ pci_uio_map_resource(struct rte_pci_device *dev)

mapaddr = pci_map_resource(pci_map_addr, fd, 0,
(size_t)dev->mem_resource[i].len, 0);
+   close(fd);
if (mapaddr == MAP_FAILED)
-   fail = 1;
+   goto fail1;

pci_map_addr = RTE_PTR_ADD(mapaddr,
(size_t)dev->mem_resource[i].len);

-   maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0);
-   if (maps[map_idx].path == NULL)
-   fail = 1;
-
-   if (fail) {
-   rte_free(uio_res);
-   close(fd);
-   return -1;
-   }
-   close(fd);
-
maps[map_idx].phaddr = dev->mem_resource[i].phys_addr;
maps[map_idx].size = dev->mem_resource[i].len;
maps[map_idx].addr = mapaddr;
@@ -394,6 +388,12 @@ pci_uio_map_resource(struct rte_pci_device *dev)
TAILQ_INSERT_TAIL(uio_res_list, uio_res, next);

return 0;
+
+fail1:
+   rte_free(maps[map_idx].path);
+fail0:
+   rte_free(uio_res);
+   return -1;
 }

 #ifdef RTE_LIBRTE_EAL_HOTPLUG
-- 
1.9.1



[dpdk-dev] [PATCH 2/6] eal: Close file descriptor of uio configuration

2015-03-17 Thread Tetsuya Mukawa
When pci_uio_unmap_resource() is called, a file descriptor that is used
for uio configuration should be closed.

Signed-off-by: Tetsuya Mukawa 
---
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c 
b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
index 9cdf24f..b971ec9 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
@@ -459,8 +459,14 @@ pci_uio_unmap_resource(struct rte_pci_device *dev)

/* close fd if in primary process */
close(dev->intr_handle.fd);
-
dev->intr_handle.fd = -1;
+
+   /* close cfg_fd if in primary process */
+   if (dev->intr_handle.uio_cfg_fd >= 0) {
+   close(dev->intr_handle.uio_cfg_fd);
+   dev->intr_handle.uio_cfg_fd = -1;
+   }
+
dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN;
 }
 #endif /* RTE_LIBRTE_EAL_HOTPLUG */
-- 
1.9.1



[dpdk-dev] [PATCH 1/6] eal: Fix cording style of eal_pci.c and eal_pci_uio.c

2015-03-17 Thread Tetsuya Mukawa
This patch fixes cording style of below files in linuxapp and bsdapp.
 - eal_pci.c
 - eal_pci_uio.c

Signed-off-by: Tetsuya Mukawa 
---
 lib/librte_eal/bsdapp/eal/eal_pci.c   | 24 +---
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 12 
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c 
b/lib/librte_eal/bsdapp/eal/eal_pci.c
index fe3ef86..3a22b49 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -161,9 +161,10 @@ fail:
 static int
 pci_uio_map_secondary(struct rte_pci_device *dev)
 {
-size_t i;
-struct uio_resource *uio_res;
-   struct uio_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, 
uio_res_list);
+   size_t i;
+   struct uio_resource *uio_res;
+   struct uio_res_list *uio_res_list =
+   RTE_TAILQ_CAST(rte_uio_tailq.head, uio_res_list);

TAILQ_FOREACH(uio_res, uio_res_list, next) {

@@ -179,10 +180,10 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
!= uio_res->maps[i].addr) {
RTE_LOG(ERR, EAL,
"Cannot mmap device resource\n");
-   return (-1);
+   return -1;
}
}
-   return (0);
+   return 0;
}

RTE_LOG(ERR, EAL, "Cannot find resource for device\n");
@@ -201,7 +202,8 @@ pci_uio_map_resource(struct rte_pci_device *dev)
uint64_t pagesz;
struct rte_pci_addr *loc = >addr;
struct uio_resource *uio_res;
-   struct uio_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, 
uio_res_list);
+   struct uio_res_list *uio_res_list =
+   RTE_TAILQ_CAST(rte_uio_tailq.head, uio_res_list);
struct uio_map *maps;

dev->intr_handle.fd = -1;
@@ -209,7 +211,7 @@ pci_uio_map_resource(struct rte_pci_device *dev)

/* secondary processes - use already recorded details */
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-   return (pci_uio_map_secondary(dev));
+   return pci_uio_map_secondary(dev);

snprintf(devname, sizeof(devname), "/dev/uio at pci:%u:%u:%u",
dev->addr.bus, dev->addr.devid, dev->addr.function);
@@ -233,7 +235,7 @@ pci_uio_map_resource(struct rte_pci_device *dev)
if ((uio_res = rte_zmalloc("UIO_RES", sizeof (*uio_res), 0)) == NULL) {
RTE_LOG(ERR, EAL,
"%s(): cannot store uio mmap details\n", __func__);
-   return (-1);
+   return -1;
}

snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname);
@@ -261,7 +263,7 @@ pci_uio_map_resource(struct rte_pci_device *dev)
(size_t)maps[j].size)
) == NULL) {
rte_free(uio_res);
-   return (-1);
+   return -1;
}

maps[j].addr = mapaddr;
@@ -271,7 +273,7 @@ pci_uio_map_resource(struct rte_pci_device *dev)

TAILQ_INSERT_TAIL(uio_res_list, uio_res, next);

-   return (0);
+   return 0;
 }

 /* Scan one pci sysfs entry, and fill the devices list from it. */
@@ -311,7 +313,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
/* FreeBSD has no NUMA support (yet) */
dev->numa_node = 0;

-/* parse resources */
+   /* parse resources */
switch (conf->pc_hdr & PCIM_HDRTYPE) {
case PCIM_HDRTYPE_NORMAL:
max = PCIR_MAX_BAR_0;
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c 
b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
index 2d1c69b..9cdf24f 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
@@ -92,7 +92,8 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 {
int fd, i;
struct mapped_pci_resource *uio_res;
-   struct mapped_pci_res_list *uio_res_list = 
RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list);
+   struct mapped_pci_res_list *uio_res_list =
+   RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list);

TAILQ_FOREACH(uio_res, uio_res_list, next) {

@@ -272,7 +273,8 @@ pci_uio_map_resource(struct rte_pci_device *dev)
uint64_t phaddr;
struct rte_pci_addr *loc = >addr;
struct mapped_pci_resource *uio_res;
-   struct mapped_pci_res_list *uio_res_list = 
RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list);
+   struct mapped_pci_res_list *uio_res_list =
+   RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list);
struct pci_map *maps;

dev->intr_handle.fd = -1;
@@ -412,7 +414,8 @@ static struct mapped_pci_resource *
 pci_uio_find_resource(struct rte_pci_device *dev)
 {
struct mapped_pci_resource 

[dpdk-dev] [PATCH 0/6] Clean up pci uio implementations

2015-03-17 Thread Tetsuya Mukawa
This patch set cleans up pci uio implementation. These clean up are
for consolidating pci uio implementation of linuxapp and bsdapp, and
moving consolidated functions in eal common.
Because of above, this patch set tries to implement linuxapp and bsdapp
almost same.
Actual consolidations will be done later patch set.

Changes:
 - This patch set is derived from below.
   "[PATCH v2] eal: Port Hotplug support for BSD"
 - Set cfg_fd as -1, when cfg_fd is closed.
   (Thanks to Iremonger, Bernard)
 - Remove needless cording style fixings.
 - Fix cording style of if-else condition.
   (Thanks to Richardson, Bruce)

Tetsuya Mukawa (6):
  eal: Fix cording style of eal_pci.c and eal_pci_uio.c
  eal: Close file descriptor of uio configuration
  eal: Fix memory leaks and needless incrementation of pci uio
implementation
  eal/bsdapp: Change names of pci related data structure
  eal: Use map_idx in pci_uio_map_resource() of bsdapp to work same as
linuxapp
  eal: Fix interface of pci_map_resource()

 lib/librte_eal/bsdapp/eal/eal_pci.c   | 160 +-
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c |  67 +++--
 2 files changed, 130 insertions(+), 97 deletions(-)

-- 
1.9.1



[dpdk-dev] [PATCH] doc: correct the format of quota

2015-03-17 Thread Thomas Monjalon
> remove the coma character by using ' character
> 
> Signed-off-by: Jingjing Wu 

Applied, thanks


[dpdk-dev] [PATCH v2] doc: Update prog guide for virtio

2015-03-17 Thread Thomas Monjalon
> > This patch add contents for major change in single virtio implementation, 
> > also
> > add back something for merge-able feature and promiscuous mode in virtio.
> > 
> > Signed-off-by: Changchun Ouyang 
> 
> Acked-by: Siobhan Butler 

Applied, thanks


[dpdk-dev] [PATCH 0/3] additional sample app guides

2015-03-17 Thread Thomas Monjalon
> > This patchset includes two new sample app guides.
> > 
> > The first is for the existing basic forwarding/skeleton application.
> > 
> > The second is for the recently added rxtx_callbacks sample application.
> > 
> > John McNamara (3):
> >   examples/skeleton: minor refactoring to help documentation
> >   doc: add docs for basic forwarding skeleton app
> >   doc: add docs for the rxtx_callbacks sample app
> 
> Acked-by: Pablo de Lara 

Applied, thanks


[dpdk-dev] [PATCH v4] ABI: Add abi checking utility

2015-03-17 Thread Thomas Monjalon
More comments:
Please rename to validate-abi.sh (with an hyphen) to be more consistent with
other scripts.
Please add it in the MAINTAINERS file.

Thanks

2015-03-17 16:42, Thomas Monjalon:
> Hi Neil,
> 
> I tested this tool and I see few small improvements possible.
> 
> 2015-03-13 10:09, Neil Horman:
> > There was a request for an abi validation utilty for the ongoing ABI 
> > stability
> utility
> > work.  As it turns out there is a abi compliance checker in development that
> > seems to be under active development and provides fairly detailed ABI 
> > compliance
> > reports.  Its not yet intellegent enough to understand symbol versioning, 
> > but it
> intelligent
> > does provide the ability to identify symbols which have changed between
> > releases, along with details of the change, and offers developers the
> > opportunity to identify which symbols then need versioning and validation 
> > for a
> > given update via manual testing.
> > 
> > This script automates the use of the compliance checker between two 
> > arbitrarily
> > specified tags within the dpdk tree.  To execute enter the $RTE_SDK 
> > directory
> > and run:
> > 
> > ./scripts/validate_abi.sh $GIT_TAG1 $GIT_TAG2 $CONFIG
> > 
> > where $GIT_TAG1 and 2 are git tags and $CONFIG is a config specification
> > suitable for passing as the T= variable in the make config command.
> > 
> > Note the upstream source for the abi compliance checker is here:
> > http://ispras.linuxbase.org/index.php/ABI_compliance_checker
> > 
> > It generates a report for each DSO built from the requested tags that 
> > developers
> > can review to find ABI compliance issues.
> > 
> > Signed-off-by: Neil Horman 
> > 
> > ---
> > 
> > Change Notes:
> > 
> > v2) Fixed some typos as requested by Thomas
> > 
> > v3) Fixed some additional typos Thomas requested
> > Improved script to work from detached state
> > Added some documentation to the changelog
> > Added some comments to the scripts
> > 
> > v4) Remove duplicate exports.
> > Move restoration of starting branch/comit to cleanup_and_exit
> > ---
> [...]
> > +TAG1=$1
> > +TAG2=$2
> > +TARGET=$3
> > +ABI_DIR=`mktemp -d -p /tmp ABI.XX`
> 
> +JOBS=$(grep -c '^processor' /proc/cpuinfo)
> 
> [...]
> > +cleanup_and_exit() {
> > +   rm -rf $ABI_DIR
> > +   exit $1
> > +   git checkout $CURRENT_BRANCH
> 
> Checkout is never done because of previous exit.
> 
> > +}
> [...]
> > +log "INFO" "Checking out version $TAG1 of the dpdk"
> > +# Move to the old version of the tree
> > +git checkout $TAG1
> 
> What about -q for quiet mode?
> 
> [...]
> > +log "INFO" "Building DPDK $TAG1. This might take a moment"
> > +make O=$TARGET > $VERBOSE 2>&1
> 
> -j$JOBS would improve building time
> 
> [...]
> > +# Move to the new version of the tree
> > +log "INFO" "Checking out version $TAG2 of the dpdk"
> > +git checkout $TAG2
> 
> -q ?
> 
> [...]
> > +log "INFO" "Building DPDK $TAG2. This might take a moment"
> > +make O=$TARGET > $VERBOSE 2>&1
> 
> -j ?
> 
> [...]
> > +# Start comparison of ABI dumps
> > +for i in `ls $ABI_DIR/*-1.dump`
> > +do
> > +   NEWNAME=`basename $i`
> > +   OLDNAME=`basename $i | sed -e"s/1.dump/0.dump/"`
> > +   LIBNAME=`basename $i | sed -e"s/-ABI-1.dump//"`
> > +
> > +   if [ ! -f $ABI_DIR/$OLDNAME ]
> > +   then
> > +   log "INFO" "$OLDNAME DOES NOT EXIST IN $TAG1. SKIPPING..."
> > +   fi
> > +
> > +   #compare the abi dumps
> > +   $ABICHECK -l $LIBNAME -old $ABI_DIR/$OLDNAME -new $ABI_DIR/$NEWNAME
> > +done
> 
> It would be more convenient to generate an HTML index giving access to every
> reports for every DSOs.
> 
> > +
> > +git reset --hard
> > +log "INFO" "ABI CHECK COMPLETE.  REPORTS ARE IN compat_report directory"
> > +cleanup_and_exit 0
> 
> After reading the report, it's not clear what would be tolerated or not.
> Should we forbid every defects?
> 




[dpdk-dev] [PATCH] doc: remove copyright from base of page

2015-03-17 Thread Thomas Monjalon
> > Removing Intel copyright from base of page for each document.
> > 
> > Signed-off-by: Siobhan Butler 
> 
> Acked-by: Pablo de Lara 

Applied, thanks


[dpdk-dev] [PATCH v2 15/15] eal: Enable Port Hotplug as default in Linux and BSD

2015-03-17 Thread Tetsuya Mukawa
On 2015/03/14 0:47, Iremonger, Bernard wrote:
>
>> -Original Message-
>> From: Tetsuya Mukawa [mailto:mukawa at igel.co.jp]
>> Sent: Thursday, March 12, 2015 10:18 AM
>> To: dev at dpdk.org
>> Cc: Iremonger, Bernard; Richardson, Bruce; Tetsuya Mukawa
>> Subject: [PATCH v2 15/15] eal: Enable Port Hotplug as default in Linux and 
>> BSD
>>
>> This patch removes CONFIG_RTE_LIBRTE_EAL_HOTPLUG option, and enables it as 
>> default in both
>> Linux and BSD.
> Hi Tetsuya,
>
> This patch should probably be split with the config changes as the first 
> patch of this patch set.
> The #ifdef RTE_LIBRTE_EAL_HOTPLUG changes should be no longer necessary as 
> they will have been taken care of in the earlier patches (v2-11, v2-12, 
> v2-13).
> Maybe the  /lib/librte_eal/bsdapp/eal/rte_eal_version.map changes could be 
> moved to one of the earlier bsd patches?

Hi Bernard,

Could I make it sure your suggestion?
Did you mean that hotplug support for linuxapp and bsdapp should be
enabled at first of consolidation patches?

It seems I can remove "#ifdef RTE_LIBRTE_EAL_HOTPLUG" together with
below patches.
 - v2-11
 - v2-12
 - v2-13
(Probably this will clean up the last patch a bit.)

But I cannot enable hotplug support at the first of consolidation
patches, because bsdapp doesn't have some hotplug implementation at the
first.
(Actually, functions related with detach() are only exist in linuxapp at
the first.)
All related functions are moved to common while patch set, then bsdapp
can support hotplug.

I will clean up the last patch as much as possible, then submit again.
Is it okay for this patch?

Regards,
Tetsuya

> Regards,
>
> Bernard.
>
>
>> Also, to support port hotplug, rte_eal_pci_scan() and below missing symbols 
>> should be exported to
>> ethdev library.
>>  - rte_eal_parse_devargs_str()
>>  - rte_eal_pci_close_one()
>>  - rte_eal_pci_probe_one()
>>  - rte_eal_pci_scan()
>>  - rte_eal_vdev_init()
>>  - rte_eal_vdev_uninit()
>>
>> Signed-off-by: Tetsuya Mukawa 
>> ---
>>  config/common_bsdapp  |  6 --
>>  config/common_linuxapp|  5 -
>>  lib/librte_eal/bsdapp/eal/eal_pci.c   |  6 +++---
>>  lib/librte_eal/bsdapp/eal/rte_eal_version.map |  6 ++
>>  lib/librte_eal/common/eal_common_dev.c|  2 --
>>  lib/librte_eal/common/eal_common_pci.c|  8 
>>  lib/librte_eal/common/eal_common_pci_uio.c|  2 --
>>  lib/librte_eal/common/include/rte_pci.h   |  2 --
>>  lib/librte_ether/rte_ethdev.c | 21 -
>>  9 files changed, 9 insertions(+), 49 deletions(-)
>>
>> diff --git a/config/common_bsdapp b/config/common_bsdapp index 
>> 8ff4dc2..88b44e9 100644
>> --- a/config/common_bsdapp
>> +++ b/config/common_bsdapp
>> @@ -116,12 +116,6 @@ CONFIG_RTE_LIBRTE_EAL_BSDAPP=y
>> CONFIG_RTE_LIBRTE_EAL_LINUXAPP=n
>>
>>  #
>> -# Compile Environment Abstraction Layer to support hotplug -# So far, 
>> Hotplug functions only support
>> linux -# -CONFIG_RTE_LIBRTE_EAL_HOTPLUG=n
>> -
>> -#
>>  # Compile Environment Abstraction Layer to support Vmware TSC map  #
>> CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=y
>> diff --git a/config/common_linuxapp b/config/common_linuxapp index 
>> 97f1c9e..f9c9780 100644
>> --- a/config/common_linuxapp
>> +++ b/config/common_linuxapp
>> @@ -114,11 +114,6 @@ CONFIG_RTE_PCI_MAX_READ_REQUEST_SIZE=0
>>  CONFIG_RTE_LIBRTE_EAL_LINUXAPP=y
>>
>>  #
>> -# Compile Environment Abstraction Layer to support hotplug -# -
>> CONFIG_RTE_LIBRTE_EAL_HOTPLUG=y
>> -
>> -#
>>  # Compile Environment Abstraction Layer to support Vmware TSC map  #
>> CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=y
>> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c 
>> b/lib/librte_eal/bsdapp/eal/eal_pci.c
>> index b6785d4..50c9544 100644
>> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
>> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
>> @@ -305,8 +305,8 @@ skipdev:
>>   * Scan the content of the PCI bus, and add the devices in the devices
>>   * list. Call pci_scan_one() for each pci entry found.
>>   */
>> -static int
>> -pci_scan(void)
>> +int
>> +rte_eal_pci_scan(void)
>>  {
>>  int fd;
>>  unsigned dev_count = 0;
>> @@ -362,7 +362,7 @@ rte_eal_pci_init(void)
>>  if (internal_config.no_pci)
>>  return 0;
>>
>> -if (pci_scan() < 0) {
>> +if (rte_eal_pci_scan() < 0) {
>>  RTE_LOG(ERR, EAL, "%s(): Cannot scan PCI bus\n", __func__);
>>  return -1;
>>  }
>> diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
>> b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
>> index 67b6a6c..7e850a9 100644
>> --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
>> +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
>> @@ -37,14 +37,20 @@ DPDK_2.0 {
>>  rte_eal_lcore_role;
>>  rte_eal_mp_remote_launch;
>>  rte_eal_mp_wait_lcore;
>> +rte_eal_parse_devargs_str;
>> +rte_eal_pci_close_one;
>>  rte_eal_pci_dump;
>>  rte_eal_pci_probe;
>> +

[dpdk-dev] [PATCH v4] ABI: Add abi checking utility

2015-03-17 Thread Thomas Monjalon
Hi Neil,

I tested this tool and I see few small improvements possible.

2015-03-13 10:09, Neil Horman:
> There was a request for an abi validation utilty for the ongoing ABI stability
utility
> work.  As it turns out there is a abi compliance checker in development that
> seems to be under active development and provides fairly detailed ABI 
> compliance
> reports.  Its not yet intellegent enough to understand symbol versioning, but 
> it
intelligent
> does provide the ability to identify symbols which have changed between
> releases, along with details of the change, and offers developers the
> opportunity to identify which symbols then need versioning and validation for 
> a
> given update via manual testing.
> 
> This script automates the use of the compliance checker between two 
> arbitrarily
> specified tags within the dpdk tree.  To execute enter the $RTE_SDK directory
> and run:
> 
> ./scripts/validate_abi.sh $GIT_TAG1 $GIT_TAG2 $CONFIG
> 
> where $GIT_TAG1 and 2 are git tags and $CONFIG is a config specification
> suitable for passing as the T= variable in the make config command.
> 
> Note the upstream source for the abi compliance checker is here:
> http://ispras.linuxbase.org/index.php/ABI_compliance_checker
> 
> It generates a report for each DSO built from the requested tags that 
> developers
> can review to find ABI compliance issues.
> 
> Signed-off-by: Neil Horman 
> 
> ---
> 
> Change Notes:
> 
> v2) Fixed some typos as requested by Thomas
> 
> v3) Fixed some additional typos Thomas requested
> Improved script to work from detached state
> Added some documentation to the changelog
> Added some comments to the scripts
> 
> v4) Remove duplicate exports.
> Move restoration of starting branch/comit to cleanup_and_exit
> ---
[...]
> +TAG1=$1
> +TAG2=$2
> +TARGET=$3
> +ABI_DIR=`mktemp -d -p /tmp ABI.XX`

+JOBS=$(grep -c '^processor' /proc/cpuinfo)

[...]
> +cleanup_and_exit() {
> + rm -rf $ABI_DIR
> + exit $1
> + git checkout $CURRENT_BRANCH

Checkout is never done because of previous exit.

> +}
[...]
> +log "INFO" "Checking out version $TAG1 of the dpdk"
> +# Move to the old version of the tree
> +git checkout $TAG1

What about -q for quiet mode?

[...]
> +log "INFO" "Building DPDK $TAG1. This might take a moment"
> +make O=$TARGET > $VERBOSE 2>&1

-j$JOBS would improve building time

[...]
> +# Move to the new version of the tree
> +log "INFO" "Checking out version $TAG2 of the dpdk"
> +git checkout $TAG2

-q ?

[...]
> +log "INFO" "Building DPDK $TAG2. This might take a moment"
> +make O=$TARGET > $VERBOSE 2>&1

-j ?

[...]
> +# Start comparison of ABI dumps
> +for i in `ls $ABI_DIR/*-1.dump`
> +do
> + NEWNAME=`basename $i`
> + OLDNAME=`basename $i | sed -e"s/1.dump/0.dump/"`
> + LIBNAME=`basename $i | sed -e"s/-ABI-1.dump//"`
> +
> + if [ ! -f $ABI_DIR/$OLDNAME ]
> + then
> + log "INFO" "$OLDNAME DOES NOT EXIST IN $TAG1. SKIPPING..."
> + fi
> +
> + #compare the abi dumps
> + $ABICHECK -l $LIBNAME -old $ABI_DIR/$OLDNAME -new $ABI_DIR/$NEWNAME
> +done

It would be more convenient to generate an HTML index giving access to every
reports for every DSOs.

> +
> +git reset --hard
> +log "INFO" "ABI CHECK COMPLETE.  REPORTS ARE IN compat_report directory"
> +cleanup_and_exit 0

After reading the report, it's not clear what would be tolerated or not.
Should we forbid every defects?



[dpdk-dev] Bug in rte_kni

2015-03-17 Thread Dey, Souvik
Hi All,
I was trying out handling of jumbo packets in DPDK, but I came 
across an issue where I see that the multiple segmented mbufs are not supported 
in the rte_kni and due to which the packets are not properly handled/converted 
to skb before giving it to the kernel. Is there any specific reason of not 
supporting multi-segment packet in kni ?

--
Regards,
Souvik


[dpdk-dev] DPDK 1.7 - rte_eth_dev_flow_ctrl_set API returns error code -95

2015-03-17 Thread Bhat, Sharat (Nokia - IN/Bangalore)
Hello ,

We have 30 VF's  and  first 15 VF's are handled by DPDK i.e. bound to igb_uio 
and PF is boud to ixgbe driver.

I am trying  to set Flow Control parameters for a VF/port using 
rte_eth_dev_flow_ctrl but it always returns error code -95.

Same error code is returned by tetspmd application as well.

"testpmd> set flow_ctrl rx off 0
cannot get current flow ctrl parameters, returncode = -95" .


If Any one of you are succeeded in setting  flow control parameters for a VF 
using DPDK 1.7 , please help me .

I was expecting  at least testpmd application should work  with flow control 
set API, but it is not the case.

I have tried to switch of Flow Control using  ethtool for PF  , no error 
message,  but its not reflecting the changes.


Thanks and Regards,
Sharat Bhat











[dpdk-dev] [PATCH] maintainers: claim EAL Intel x86

2015-03-17 Thread Thomas Monjalon
> Signed-off-by: Konstantin Ananyev 

>  Intel x86
> +M: Bruce Richardson 
> +M: Konstantin Ananyev 
>  F: lib/librte_eal/common/include/arch/x86/

Acked-by: Thomas Monjalon 

Applied, thanks


[dpdk-dev] [PATCH] maintainers: claim misc sample applications

2015-03-17 Thread Thomas Monjalon
> Claim the following sample applications:
> * dpdk_qat
> * helloworld
> * l2fwd
> * skeleton
> 
> Signed-off-by: Bruce Richardson 

Acked-by: Thomas Monjalon 

Applied, thanks


[dpdk-dev] [PATCH] MAINTAINERS: claim ring pmd library

2015-03-17 Thread Thomas Monjalon
> Signed-off-by: Bruce Richardson 

Acked-by: Thomas Monjalon 

Applied, thanks


[dpdk-dev] [PATCH v5] ABI: Add abi checking utility

2015-03-17 Thread Neil Horman
There was a request for an abi validation utilty for the ongoing ABI stability
work.  As it turns out there is a abi compliance checker in development that
seems to be under active development and provides fairly detailed ABI compliance
reports.  Its not yet intellegent enough to understand symbol versioning, but it
does provide the ability to identify symbols which have changed between
releases, along with details of the change, and offers developers the
opportunity to identify which symbols then need versioning and validation for a
given update via manual testing.

This script automates the use of the compliance checker between two arbitrarily
specified tags within the dpdk tree.  To execute enter the $RTE_SDK directory
and run:

./scripts/validate_abi.sh $GIT_TAG1 $GIT_TAG2 $CONFIG

where $GIT_TAG1 and 2 are git tags and $CONFIG is a config specification
suitable for passing as the T= variable in the make config command.

Note the upstream source for the abi compliance checker is here:
http://ispras.linuxbase.org/index.php/ABI_compliance_checker

It generates a report for each DSO built from the requested tags that developers
can review to find ABI compliance issues.

Signed-off-by: Neil Horman 

---

Change Notes:

v2) Fixed some typos as requested by Thomas

v3) Fixed some additional typos Thomas requested
Improved script to work from detached state
Added some documentation to the changelog
Added some comments to the scripts

v4) Remove duplicate exports.
Move restoration of starting branch/comit to cleanup_and_exit

v5) Fixed exit cleanup
Added MAINTAINERS entry
---
 MAINTAINERS |   1 +
 scripts/validate-abi.sh | 245 
 2 files changed, 246 insertions(+)
 create mode 100755 scripts/validate-abi.sh

diff --git a/MAINTAINERS b/MAINTAINERS
index 07fdf5e..fa309ff 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -59,6 +59,7 @@ ABI versioning
 M: Neil Horman 
 F: lib/librte_compat/
 F: doc/guides/rel_notes/abi.rst
+F: scripts/validate-abi.sh

 Environment Abstraction Layer
 -
diff --git a/scripts/validate-abi.sh b/scripts/validate-abi.sh
new file mode 100755
index 000..369ea8a
--- /dev/null
+++ b/scripts/validate-abi.sh
@@ -0,0 +1,245 @@
+#!/bin/sh
+#   BSD LICENSE
+#
+#   Copyright(c) 2015 Neil Horman. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+TAG1=$1
+TAG2=$2
+TARGET=$3
+ABI_DIR=`mktemp -d -p /tmp ABI.XX`
+
+usage() {
+   echo "$0   "
+}
+
+log() {
+   local level=$1
+   shift
+   echo "$*"
+}
+
+validate_tags() {
+   git tag -l | grep -q "$TAG1"
+   if [ $? -ne 0 ]
+   then
+   echo "$TAG1 is invalid"
+   return
+   fi
+   git tag -l | grep -q "$TAG2"
+   if [ $? -ne 0 ]
+   then
+   echo "$TAG2 is invalid"
+   return
+   fi
+}
+
+validate_args() {
+   if [ -z "$TAG1" ]
+   then
+   echo "Must Specify TAG1"
+   return
+   fi
+   if [ -z "$TAG2" ]
+   then
+   echo "Must Specify TAG2"
+   return
+   fi
+   if [ -z "$TARGET" ]
+   then
+   echo "Must Specify a build target"
+   fi
+}
+
+
+cleanup_and_exit() {
+   rm -rf $ABI_DIR
+   git checkout $CURRENT_BRANCH
+   exit $1
+}
+
+###
+#START
+
+
+#trap on ctrl-c to clean up
+trap cleanup_and_exit SIGINT
+
+#Save the current branch
+CURRENT_BRANCH=`git branch | grep \* | cut -d' ' -f2`
+
+if [ -z "$CURRENT_BRANCH" ]
+then
+ 

[dpdk-dev] [PATCH v4] ABI: Add abi checking utility

2015-03-17 Thread Neil Horman
On Tue, Mar 17, 2015 at 04:42:31PM +0100, Thomas Monjalon wrote:
> Hi Neil,
> 
> I tested this tool and I see few small improvements possible.
> 
I'll fix the bug you found, but I'm not going to go chasing every feature that
you happen to note.  Not saying they're not fine features, but I don't have time
to implement features that you happen to note might be nice to have, especially
not in time for 2.0. 

Regarding your question about report tolerance, Its not that kind of tool.  The
ABI checker simply calls a developers attention to symbols that have
inadvertently changed due to code or data structure modifications.  It is
incumbent on the developer to make a well informed decision about how to handle
those changes (via deprecation/versioning/etc), and to defend his/her reasoning.

Neil

> 2015-03-13 10:09, Neil Horman:
> > There was a request for an abi validation utilty for the ongoing ABI 
> > stability
> utility
> > work.  As it turns out there is a abi compliance checker in development that
> > seems to be under active development and provides fairly detailed ABI 
> > compliance
> > reports.  Its not yet intellegent enough to understand symbol versioning, 
> > but it
> intelligent
> > does provide the ability to identify symbols which have changed between
> > releases, along with details of the change, and offers developers the
> > opportunity to identify which symbols then need versioning and validation 
> > for a
> > given update via manual testing.
> > 
> > This script automates the use of the compliance checker between two 
> > arbitrarily
> > specified tags within the dpdk tree.  To execute enter the $RTE_SDK 
> > directory
> > and run:
> > 
> > ./scripts/validate_abi.sh $GIT_TAG1 $GIT_TAG2 $CONFIG
> > 
> > where $GIT_TAG1 and 2 are git tags and $CONFIG is a config specification
> > suitable for passing as the T= variable in the make config command.
> > 
> > Note the upstream source for the abi compliance checker is here:
> > http://ispras.linuxbase.org/index.php/ABI_compliance_checker
> > 
> > It generates a report for each DSO built from the requested tags that 
> > developers
> > can review to find ABI compliance issues.
> > 
> > Signed-off-by: Neil Horman 
> > 
> > ---
> > 
> > Change Notes:
> > 
> > v2) Fixed some typos as requested by Thomas
> > 
> > v3) Fixed some additional typos Thomas requested
> > Improved script to work from detached state
> > Added some documentation to the changelog
> > Added some comments to the scripts
> > 
> > v4) Remove duplicate exports.
> > Move restoration of starting branch/comit to cleanup_and_exit
> > ---
> [...]
> > +TAG1=$1
> > +TAG2=$2
> > +TARGET=$3
> > +ABI_DIR=`mktemp -d -p /tmp ABI.XX`
> 
> +JOBS=$(grep -c '^processor' /proc/cpuinfo)
> 
> [...]
> > +cleanup_and_exit() {
> > +   rm -rf $ABI_DIR
> > +   exit $1
> > +   git checkout $CURRENT_BRANCH
> 
> Checkout is never done because of previous exit.
> 
> > +}
> [...]
> > +log "INFO" "Checking out version $TAG1 of the dpdk"
> > +# Move to the old version of the tree
> > +git checkout $TAG1
> 
> What about -q for quiet mode?
> 
> [...]
> > +log "INFO" "Building DPDK $TAG1. This might take a moment"
> > +make O=$TARGET > $VERBOSE 2>&1
> 
> -j$JOBS would improve building time
> 
> [...]
> > +# Move to the new version of the tree
> > +log "INFO" "Checking out version $TAG2 of the dpdk"
> > +git checkout $TAG2
> 
> -q ?
> 
> [...]
> > +log "INFO" "Building DPDK $TAG2. This might take a moment"
> > +make O=$TARGET > $VERBOSE 2>&1
> 
> -j ?
> 
> [...]
> > +# Start comparison of ABI dumps
> > +for i in `ls $ABI_DIR/*-1.dump`
> > +do
> > +   NEWNAME=`basename $i`
> > +   OLDNAME=`basename $i | sed -e"s/1.dump/0.dump/"`
> > +   LIBNAME=`basename $i | sed -e"s/-ABI-1.dump//"`
> > +
> > +   if [ ! -f $ABI_DIR/$OLDNAME ]
> > +   then
> > +   log "INFO" "$OLDNAME DOES NOT EXIST IN $TAG1. SKIPPING..."
> > +   fi
> > +
> > +   #compare the abi dumps
> > +   $ABICHECK -l $LIBNAME -old $ABI_DIR/$OLDNAME -new $ABI_DIR/$NEWNAME
> > +done
> 
> It would be more convenient to generate an HTML index giving access to every
> reports for every DSOs.
> 
> > +
> > +git reset --hard
> > +log "INFO" "ABI CHECK COMPLETE.  REPORTS ARE IN compat_report directory"
> > +cleanup_and_exit 0
> 
> After reading the report, it's not clear what would be tolerated or not.
> Should we forbid every defects?
> 
> 


[dpdk-dev] [PATCH v2] pcap, null: Fix memory leaks of 'struct rte_kvargs'

2015-03-17 Thread Tetsuya Mukawa
'struct rte_kvargs' is allocated in rte_kvargs_parse(), and should be
freed with rte_kvargs_free().
This patch fixes memory leaks of 'struct rte_kvargs' in below PMDs.
 - pcap PMD
 - null PMD

Reported-by: Mcnamara, John 
Signed-off-by: Tetsuya Mukawa 
---
 lib/librte_pmd_null/rte_eth_null.c | 13 +
 lib/librte_pmd_pcap/rte_eth_pcap.c | 18 +++---
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/lib/librte_pmd_null/rte_eth_null.c 
b/lib/librte_pmd_null/rte_eth_null.c
index f49d686..8fe1a2d 100644
--- a/lib/librte_pmd_null/rte_eth_null.c
+++ b/lib/librte_pmd_null/rte_eth_null.c
@@ -506,7 +506,7 @@ rte_pmd_null_devinit(const char *name, const char *params)
unsigned numa_node;
unsigned packet_size = default_packet_size;
unsigned packet_copy = default_packet_copy;
-   struct rte_kvargs *kvlist;
+   struct rte_kvargs *kvlist = NULL;
int ret;

if (name == NULL)
@@ -527,7 +527,7 @@ rte_pmd_null_devinit(const char *name, const char *params)
ETH_NULL_PACKET_SIZE_ARG,
_packet_size_arg, _size);
if (ret < 0)
-   return -1;
+   goto free_kvlist;
}

if (rte_kvargs_count(kvlist, ETH_NULL_PACKET_COPY_ARG) == 1) {
@@ -536,7 +536,7 @@ rte_pmd_null_devinit(const char *name, const char *params)
ETH_NULL_PACKET_COPY_ARG,
_packet_copy_arg, _copy);
if (ret < 0)
-   return -1;
+   goto free_kvlist;
}
}

@@ -544,7 +544,12 @@ rte_pmd_null_devinit(const char *name, const char *params)
"packet copy is %s\n", packet_size,
packet_copy ? "enabled" : "disabled");

-   return eth_dev_null_create(name, numa_node, packet_size, packet_copy);
+   ret = eth_dev_null_create(name, numa_node, packet_size, packet_copy);
+
+free_kvlist:
+   if (kvlist)
+   rte_kvargs_free(kvlist);
+   return ret;
 }

 static int
diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c 
b/lib/librte_pmd_pcap/rte_eth_pcap.c
index 5e94930..204ae68 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -888,12 +888,13 @@ rte_pmd_pcap_devinit(const char *name, const char *params)
ret = rte_kvargs_process(kvlist, ETH_PCAP_IFACE_ARG,
_rx_tx_iface, );
if (ret < 0)
-   return -1;
+   goto free_kvlist;
dumpers.pcaps[0] = pcaps.pcaps[0];
dumpers.names[0] = pcaps.names[0];
dumpers.types[0] = pcaps.types[0];
-   return rte_eth_from_pcaps(name, , 1, , 1,
+   ret = rte_eth_from_pcaps(name, , 1, , 1,
numa_node, kvlist, 1);
+   goto free_kvlist;
}

/*
@@ -911,7 +912,7 @@ rte_pmd_pcap_devinit(const char *name, const char *params)
}

if (ret < 0)
-   return -1;
+   goto free_kvlist;

/*
 * We check whether we want to open a TX stream to a real NIC or a
@@ -930,15 +931,18 @@ rte_pmd_pcap_devinit(const char *name, const char *params)
}

if (ret < 0)
-   return -1;
+   goto free_kvlist;

if (using_dumpers)
-   return rte_eth_from_pcaps_n_dumpers(name, , 
pcaps.num_of_rx,
+   ret = rte_eth_from_pcaps_n_dumpers(name, , 
pcaps.num_of_rx,
, dumpers.num_of_tx, numa_node, kvlist);
-
-   return rte_eth_from_pcaps(name, , pcaps.num_of_rx, ,
+   else
+   ret = rte_eth_from_pcaps(name, , pcaps.num_of_rx, 
,
dumpers.num_of_tx, numa_node, kvlist, 0);

+free_kvlist:
+   rte_kvargs_free(kvlist);
+   return ret;
 }

 static int
-- 
1.9.1



[dpdk-dev] ["Potential Spoofed"] Re: PMD architecture related to code

2015-03-17 Thread kuldeep.sam...@wipro.com
HI ,

On PMD any logical flow and code flow for DPDK-1.7.1 .
Suggestions are welcome .



Regards
Kuldeep


-Original Message-
From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of kuldeep.sam...@wipro.com
Sent: Saturday, March 14, 2015 1:22 PM
To: bruce.richardson at intel.com
Cc: dev at dpdk.org; dev-bounces at dpdk.org
Subject: ["Potential Spoofed"] Re: [dpdk-dev] PMD architecture related to code

Thank for replay Bruce ,

I am looking code related to NIC to DMA mapping and DMA to user space .


Suggestions are welcome .

Regards,
Kuldeep

-Original Message-
From: Bruce Richardson [mailto:bruce.richard...@intel.com]
Sent: Friday, March 13, 2015 8:22 PM
To: Kuldeep Samasi (WT01 - Global Media & Telecom)
Cc: dev at dpdk.org; dev-bounces at dpdk.org
Subject: Re: [dpdk-dev] PMD architecture related to code

On Fri, Mar 13, 2015 at 04:45:47AM +, kuldeep.samasi at wipro.com wrote:
> Hi Developer Team ,
>
>
> I am trying add new functionality on Poll Mode driver .
> But I don't have idea how packets are coming to kernel mode and going to user 
> space and doing packet processing DPDK .

The packets never go into the kernel when DPDK is in use. Instead the DPDK PMD 
configures the NIC to DMA the packets directly into userspace buffers. Hence 
the high performance.

/Bruce

>
> I need suggestion on which file the PMD architecture defined .
>
>
>
> Regards ,
> Kuldeep
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> addressee(s) and may contain proprietary, confidential or privileged
> information. If you are not the intended recipient, you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately and destroy all copies of this message and any
> attachments. WARNING: Computer viruses can be transmitted via email.
> The recipient should check this email and any attachments for the
> presence of viruses. The company accepts no liability for any damage
> caused by any virus transmitted by this email. www.wipro.com
The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. WARNING: Computer viruses can be transmitted via email. The 
recipient should check this email and any attachments for the presence of 
viruses. The company accepts no liability for any damage caused by any virus 
transmitted by this email. www.wipro.com
The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. WARNING: Computer viruses can be transmitted via email. The 
recipient should check this email and any attachments for the presence of 
viruses. The company accepts no liability for any damage caused by any virus 
transmitted by this email. www.wipro.com


[dpdk-dev] [PATCH] pcap, af_packet, null: Fix memory leaks of 'struct rte_kvargs'

2015-03-17 Thread Tetsuya Mukawa
On 2015/03/16 20:07, Mcnamara, John wrote:
>> -Original Message-
>> From: Tetsuya Mukawa [mailto:mukawa at igel.co.jp]
>> Sent: Monday, March 16, 2015 3:43 AM
>> To: dev at dpdk.org
>> Cc: Mcnamara, John; Tetsuya Mukawa
>> Subject: [PATCH] pcap,af_packet,null: Fix memory leaks of 'struct
>> rte_kvargs'
>>
>>  lib/librte_pmd_af_packet/rte_eth_af_packet.c |  5 -
>>  lib/librte_pmd_null/rte_eth_null.c   | 13 +
>>  lib/librte_pmd_pcap/rte_eth_pcap.c   | 18 +++---
>>  3 files changed, 24 insertions(+), 12 deletions(-)
> Hi,
>
> There is already a patch for the af_packet kvlist leak in review:
>
> http://dpdk.org/ml/archives/dev/2015-March/015049.html
>
> The eth_null and pcap issues haven't been addressed yet though.
>
> John
>
>

Hi John,

Thanks, I will remove af_packet fixinig, and submit it again.

Tetsuya


[dpdk-dev] [PATCH] pcap, af_packet, null: Fix memory leaks of 'struct rte_kvargs'

2015-03-17 Thread Tetsuya Mukawa
On 2015/03/16 19:47, Neil Horman wrote:
> On Mon, Mar 16, 2015 at 12:42:56PM +0900, Tetsuya Mukawa wrote:
>> 'struct rte_kvargs' is allocated in rte_kvargs_parse(), and should be
>> freed with rte_kvargs_free().
>> This patch fixes memory leaks of 'struct rte_kvargs' in below PMDs.
>>  - pcap PMD
>>  - af_packet PMD
>>  - null PMD
>>
>> Reported-by: Mcnamara, John 
>> Signed-off-by: Tetsuya Mukawa 
> Typically, you should limit your goto tags to something more minimalist that
> describes the one thing you want to unwind at the label.  As it stands here,  
> if
> somone wants to add some code after this label, the label either becomes
> incorrect, or you need to fix up the label name to match.  But I suppose that
> can be corrected later.

Hi Neil,

I appreciate for your suggestion.
I will need to remove af_packet fixing and submit the patch again.
So I will follow your suggestion in the next patch.

Thanks,
Tetsuya

> Acked-by: Neil Horman 
>
>
>> ---
>>  lib/librte_pmd_af_packet/rte_eth_af_packet.c |  5 -
>>  lib/librte_pmd_null/rte_eth_null.c   | 13 +
>>  lib/librte_pmd_pcap/rte_eth_pcap.c   | 18 +++---
>>  3 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c 
>> b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
>> index 80e9bdf..7c3c6a9 100644
>> --- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c
>> +++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
>> @@ -823,12 +823,15 @@ rte_pmd_af_packet_devinit(const char *name, const char 
>> *params)
>>  ret = rte_kvargs_process(kvlist, ETH_AF_PACKET_IFACE_ARG,
>>   _packet_iface, );
>>  if (ret < 0)
>> -return -1;
>> +goto free_kvlist_then_return;
>>  }
>>  
>>  ret = rte_eth_from_packet(name, , numa_node, kvlist);
>>  close(sockfd); /* no longer needed */
>>  
>> +free_kvlist_then_return:
>> +rte_kvargs_free(kvlist);
>> +
>>  if (ret < 0)
>>  return -1;
>>  
>> diff --git a/lib/librte_pmd_null/rte_eth_null.c 
>> b/lib/librte_pmd_null/rte_eth_null.c
>> index f49d686..86307eb 100644
>> --- a/lib/librte_pmd_null/rte_eth_null.c
>> +++ b/lib/librte_pmd_null/rte_eth_null.c
>> @@ -506,7 +506,7 @@ rte_pmd_null_devinit(const char *name, const char 
>> *params)
>>  unsigned numa_node;
>>  unsigned packet_size = default_packet_size;
>>  unsigned packet_copy = default_packet_copy;
>> -struct rte_kvargs *kvlist;
>> +struct rte_kvargs *kvlist = NULL;
>>  int ret;
>>  
>>  if (name == NULL)
>> @@ -527,7 +527,7 @@ rte_pmd_null_devinit(const char *name, const char 
>> *params)
>>  ETH_NULL_PACKET_SIZE_ARG,
>>  _packet_size_arg, _size);
>>  if (ret < 0)
>> -return -1;
>> +goto free_kvlist_then_return;
>>  }
>>  
>>  if (rte_kvargs_count(kvlist, ETH_NULL_PACKET_COPY_ARG) == 1) {
>> @@ -536,7 +536,7 @@ rte_pmd_null_devinit(const char *name, const char 
>> *params)
>>  ETH_NULL_PACKET_COPY_ARG,
>>  _packet_copy_arg, _copy);
>>  if (ret < 0)
>> -return -1;
>> +goto free_kvlist_then_return;
>>  }
>>  }
>>  
>> @@ -544,7 +544,12 @@ rte_pmd_null_devinit(const char *name, const char 
>> *params)
>>  "packet copy is %s\n", packet_size,
>>  packet_copy ? "enabled" : "disabled");
>>  
>> -return eth_dev_null_create(name, numa_node, packet_size, packet_copy);
>> +ret = eth_dev_null_create(name, numa_node, packet_size, packet_copy);
>> +
>> +free_kvlist_then_return:
>> +if (kvlist)
>> +rte_kvargs_free(kvlist);
>> +return ret;
>>  }
>>  
>>  static int
>> diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c 
>> b/lib/librte_pmd_pcap/rte_eth_pcap.c
>> index 5e94930..de15fb3 100644
>> --- a/lib/librte_pmd_pcap/rte_eth_pcap.c
>> +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
>> @@ -888,12 +888,13 @@ rte_pmd_pcap_devinit(const char *name, const char 
>> *params)
>>  ret = rte_kvargs_process(kvlist, ETH_PCAP_IFACE_ARG,
>>  _rx_tx_iface, );
>>  if (ret < 0)
>> -return -1;
>> +goto free_kvlist_then_return;
>>  dumpers.pcaps[0] = pcaps.pcaps[0];
>>  dumpers.names[0] = pcaps.names[0];
>>  dumpers.types[0] = pcaps.types[0];
>> -return rte_eth_from_pcaps(name, , 1, , 1,
>> +ret = rte_eth_from_pcaps(name, , 1, , 1,
>>  numa_node, kvlist, 1);
>> +goto free_kvlist_then_return;
>>  }
>>  
>>  /*
>> @@ -911,7 +912,7 @@ rte_pmd_pcap_devinit(const char *name, const char 

[dpdk-dev] [RFC] af_packet: support port hotplug

2015-03-17 Thread Tetsuya Mukawa
On 2015/03/16 23:47, Iremonger, Bernard wrote:
>
>> -Original Message-
>> From: Tetsuya Mukawa [mailto:mukawa at igel.co.jp]
>> Sent: Monday, March 16, 2015 8:57 AM
>> To: Iremonger, Bernard
>> Cc: John W. Linville; dev at dpdk.org
>> Subject: Re: [dpdk-dev] [RFC] af_packet: support port hotplug
>>
>>> @@ -835,10 +848,53 @@ rte_pmd_af_packet_devinit(const char *name, const 
>>> char *params)
>>>   return 0;
>>>  }
>>>
>>> +static int
>>> +rte_pmd_af_packet_devuninit(const char *name) {
>>> + struct rte_eth_dev *eth_dev = NULL;
>>> + struct pmd_internals *internals;
>>> + struct tpacket_req req;
>>> +
>>> + unsigned q;
>>> +
>>> + RTE_LOG(INFO, PMD, "Closing AF_PACKET ethdev on numa socket %u\n",
>>> + rte_socket_id());
>>> +
>>> + if (name == NULL)
>>> + return -1;
>> Hi  Tetsuya, John,
>>
>> Before detaching a port, the port must be stopped and closed.
>> The stop and close are only allowed for RTE_PROC_PRIMARY.
>> Should there be a check for process_type here?
>>
>> if (rte_eal_process_type() != RTE_PROC_PRIMARY)
>> return -EPERM;
>>
>> Regards,
>>
>> Bernard
>>
> Hi Bernard,
>
> I agree with stop() and close() are only called by primary process,
> but it may not need to add like above.
> Could you please check rte_ethdev.c?
>
> - struct rte_eth_dev_data *rte_eth_dev_data; This array is shared between 
> processes.
> So we need to initialize of finalize carefully like you said.
>
> - struct rte_eth_dev rte_eth_devices[] This array is per process.
> And 'data' variable of this structure indicates a pointer of 
> rte_eth_dev_data.
>
> All PMDs for physical NIC allocates like above when PMDs are initialized.
> (Even when a process is secondary, initialization function of PMDs
> will be called) But virtual device PMDs allocate rte_eth_dev_data and 
> overwrite 'data'
> variable of rte_eth_devices while initialization.
>
> As a result, primary and secondary process has their own 
> 'rte_eth_dev_data' for a virtual device.
> So I guess all processes need to free it not to leak memory.
>
> Thanks,
> Tetsuya
>
 Hi Tetsuya,

 In rte_ethdev.c   both rte_eth_dev_stop() and rte_eth_dev_close()  use the 
 macro
>> PROC_PRIMARY_OR_RET().
 So for secondary processes  both functions return without doing anything.
 Maybe this check should be added to rte_eth_dev_attach() and 
 rte_eth_dev_detach() ?

 For the Physical/Virtual  Functions of the NIC  a lot of the
 finalization is done in the  dev->dev_ops->dev_stop() and
 dev->dev_ops->dev_close() functions. To complete the finalization the 
 dev_uninit() function is
>> called, this should probably do nothing for secondary processes  as the 
>> dev_stop() and dev_close()
>> functions will not have been executed.
>>> Hi Bernard,
>>>
>>> Sorry for my English.
>>> I meant 'virtual device PMD' as PMDs like pcap or af_packet PMDs.
>>> Not a PMDs for virtual functions on NIC.
>>>
>>> For PMDs like a pcap and af_packet PMDs, all data structures are
>>> allocated per processes.
>>> (Actually I guess nothing is shared between primary and secondary
>>> processes, because rte_eth_dev_data is overwritten by each processes.)
>>> So we need to free per process data when detach() is called.
>>>
 For the Physical/Virtual  Functions of the NIC  the dev_init() is called 
 for both primary and
>> secondary processes, however a subset of the function only is executed for 
>> secondary processes.
>>> Because of above, we probably not be able to add PROC_PRIMARY_OR_RET()
>>> to rte_eth_dev_detach().
>>> But I agree we should not call rte_eth_dev_detach() for secondary
>>> process, if PMDs are like e1000 or ixgbe PMD.
>> Correction:
>> We should not process rte_eth_dev_detach() for secondary process, if PMDs 
>> are like e1000 or ixgbe
>> PMD and if primary process hasn't called
>> stop() and close() yet.
>>
>> Tetsuya
>>
>>> To work like above, how about changing drv_flags dynamically in
>>> close() callback?
>>> For example, when primary process calls rte_eth_dev_close(), a
>>> callback of PMD will be called.
>>> (In the case of e1000 PMD, eth_em_close() is the callback.)
>>>
>>> At that time, specify RTE_PCI_DRV_DETACHABLE flag to drv_flag in the
>>> callback.
>>> It means if primary process hasn't called close() yet,
>>> rte_eth_dev_detach() will do nothing and return error.
>>> How about doing like above?
>>>
>>> Regards,
>>> Tetsuya
> Hi Tetsuya,
> For the e1000, igb and ixgbe PMD's it is probably  simpler to just check for 
> the primary process in the uninit functions and just return without doing 
> anything for secondary processes.

Thanks for clarifying.
In the case, is it okay for you to add PROC_PRIMARY_OR_RET() in e1000,

[dpdk-dev] [PATCH] vhost: Add a hint on how to add or remove the device to a data core

2015-03-17 Thread Thomas Monjalon
> > Let's make sure people will not forget to set and unset VIRTIO_DEV_RUNNING.
> >
> > Signed-off-by: Beno?t Canet 
> 
> Acked-by Huawei Xie 

Applied, thanks


[dpdk-dev] [RFC PATCH] eal: rte_rand yields only 62 random bits

2015-03-17 Thread Robert Sanford
The implementation of rte_rand() returns only 62 bits of 
pseudo-randomness, because the underlying calls to lrand48()
"return non-negative long integers uniformly distributed
between 0 and 2^31."

We have written a potential fix, but before we spend more
time testing and refining it, I wanted to check with you
guys.

We switched to using the reentrant versions of [ls]rand48,
and maintain per-lcore state. We need ~2.06 calls to
lrand48_r(), per call to rte_rand().

Do you agree with the approach we've taken in this patch?


Thanks,
Robert

---
 lib/librte_eal/common/include/rte_random.h |   33 +--
 lib/librte_eal/linuxapp/eal/eal_thread.c   |7 ++
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_random.h 
b/lib/librte_eal/common/include/rte_random.h
index 24ae836..b9248cd 100644
--- a/lib/librte_eal/common/include/rte_random.h
+++ b/lib/librte_eal/common/include/rte_random.h
@@ -46,6 +46,17 @@ extern "C" {

 #include 
 #include 
+#include 
+#include 
+
+struct rte_rand_data {
+   struct drand48_data _dr48;
+   uint32_t _hi_bits;
+   uint8_t _bits_left;
+};
+
+RTE_DECLARE_PER_LCORE(struct rte_rand_data, _rand_data);
+

 /**
  * Seed the pseudo-random generator.
@@ -60,7 +71,7 @@ extern "C" {
 static inline void
 rte_srand(uint64_t seedval)
 {
-   srand48((long unsigned int)seedval);
+   srand48_r((long unsigned int)seedval, _PER_LCORE(_rand_data)._dr48);
 }

 /**
@@ -76,10 +87,26 @@ rte_srand(uint64_t seedval)
 static inline uint64_t
 rte_rand(void)
 {
+   struct rte_rand_data *rd = _PER_LCORE(_rand_data);
uint64_t val;
-   val = lrand48();
+   uint32_t hi_bits;
+   long int result;
+
+   if (unlikely(rd->_bits_left < 2)) {
+   lrand48_r(>_dr48, );
+   rd->_hi_bits |= (uint32_t)result << (1 - rd->_bits_left);
+   rd->_bits_left += 31;
+   }
+
+   hi_bits = rd->_hi_bits;
+   lrand48_r(>_dr48, );
+   val = (uint32_t)result | (hi_bits & 0x800);
val <<= 32;
-   val += lrand48();
+   hi_bits <<= 1;
+   lrand48_r(>_dr48, );
+   val |= (uint32_t)result | (hi_bits & 0x800);
+   rd->_hi_bits = hi_bits << 1;
+   rd->_bits_left -= 2;
return val;
 }

diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c 
b/lib/librte_eal/linuxapp/eal/eal_thread.c
index 5635c7d..08e7f72 100644
--- a/lib/librte_eal/linuxapp/eal/eal_thread.c
+++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
@@ -52,6 +52,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 

 #include "eal_private.h"
 #include "eal_thread.h"
@@ -59,6 +61,8 @@
 RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
 RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
 RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
+RTE_DEFINE_PER_LCORE(struct rte_rand_data, _rand_data);
+

 /*
  * Send a message to a slave lcore identified by slave_id to call a
@@ -147,6 +151,9 @@ eal_thread_loop(__attribute__((unused)) void *arg)
/* set the lcore ID in per-lcore memory area */
RTE_PER_LCORE(_lcore_id) = lcore_id;

+   /* seed per-lcore PRNG */
+   rte_srand(rte_rdtsc());
+
/* set CPU affinity */
if (eal_thread_set_affinity() < 0)
rte_panic("cannot set affinity\n");
-- 
1.7.1



[dpdk-dev] DPDK 1.7 - rte_eth_dev_flow_ctrl_set API returns error code -95

2015-03-17 Thread Neil Horman
On Tue, Mar 17, 2015 at 02:51:26PM +, Bhat, Sharat (Nokia - IN/Bangalore) 
wrote:
> Hello ,
> 
> We have 30 VF's  and  first 15 VF's are handled by DPDK i.e. bound to igb_uio 
> and PF is boud to ixgbe driver.
> 
> I am trying  to set Flow Control parameters for a VF/port using 
> rte_eth_dev_flow_ctrl but it always returns error code -95.
> 
> Same error code is returned by tetspmd application as well.
> 
> "testpmd> set flow_ctrl rx off 0
> cannot get current flow ctrl parameters, returncode = -95" .
> 
> 
> If Any one of you are succeeded in setting  flow control parameters for a VF 
> using DPDK 1.7 , please help me .
> 
> I was expecting  at least testpmd application should work  with flow control 
> set API, but it is not the case.
> 
> I have tried to switch of Flow Control using  ethtool for PF  , no error 
> message,  but its not reflecting the changes.
> 
> 
> Thanks and Regards,
> Sharat Bhat
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
There is no VF pmd in dpdk with a flow_ctrl_set method registered.  As such,
every attempt to set flow control will return -EOPNOTSUPP (-95)
Neil



[dpdk-dev] [PATCH] common/rte_memcpy: Fix x86intrin.h missed

2015-03-17 Thread Thomas Monjalon
2015-03-16 17:39, Ananyev, Konstantin:
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > I think that rte_common_vec.h should be moved into
> > lib/librte_eal/common/include/arch/x86/rte_vec.h as it's x86-specific.
> 
> Seems like a good thing to do.
> Do you want me to submit a patch for 2.0 for that?

It would be nice yes.
Thanks


[dpdk-dev] DPDK on EC2?

2015-03-17 Thread Jeff Wang
Thanks Andre and Rashmin!

I'm trying to deploy this dpdk-ovs on EC2.

https://github.com/01org/dpdk-ovs

But the way it works on my own machine seems quite different with it does
on the cloud. I'm still confused about the hardware virtualization on EC2.

On Mon, Mar 16, 2015 at 5:03 PM, Patel, Rashmin N  wrote:

> Just curious - I didn't understand the usage model here. In the Amazon EC2
> instance (a VM,) do you want to run a DPDK application? Where do you intend
> to run OVS?
>
> As far I remember, OVS has a datapath in Host kernel and you won't be
> given Host access by AWS. And I'm not sure if Amazon provides an OVS
> instance, but in case if they don't have an offering, you have to put your
> OVS installation in another VM (virtualizing network function) and bounce
> the traffic back to your VM(s.)
>
> As far as Amazon Advanced Networking is concerned, you get a dedicated
> slice (an SRIOV Virtual Function) of a NIC in your VM, where a Physical
> Function Driver running in the Host (Amazon VMM-Xen I think) controls all
> the filtering configuration privileges.
>
> Thanks,
> Rashmin
>
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Andre Richter
> Sent: Monday, March 16, 2015 2:27 PM
> To: Jeff Wang; dev at dpdk.org
> Subject: Re: [dpdk-dev] DPDK on EC2?
>
> Be sure to get an instance with SR-IOV, which is "enhanced networking" in
> Amazon speak.
>
> http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking.html
>
> Cheers Andre
> Jeff Wang  schrieb am Mo., 16. M?rz 2015 um 21:08:
>
> > Hi,
> >
> > I'm trying to deploy DPDK and ovs on an AWS EC2 instance which is
> > running CentOS 7.
> >
> > Has anybody had tried to do this? How to bind a NIC to dpdk while it
> > shows no NICs when I do lspci?
> >
> > Thanks!
> >
>


[dpdk-dev] [PATCH] vhost: Add a hint on how to add or remove the device to a data core

2015-03-17 Thread Xie, Huawei
Acked-by Huawei Xie 


On 2/27/2015 6:22 PM, Beno?t Canet wrote:
> Let's make sure people will not forget to set and unset VIRTIO_DEV_RUNNING.
>
> Signed-off-by: Beno?t Canet 
> ---
>  doc/guides/prog_guide/vhost_lib.rst | 3 ++-
>  lib/librte_vhost/rte_virtio_net.h   | 4 
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/doc/guides/prog_guide/vhost_lib.rst 
> b/doc/guides/prog_guide/vhost_lib.rst
> index 0b6eda7..ba6065d 100644
> --- a/doc/guides/prog_guide/vhost_lib.rst
> +++ b/doc/guides/prog_guide/vhost_lib.rst
> @@ -58,7 +58,8 @@ Vhost API Overview
>register two callbacks, new_destory and destroy_device.
>When virtio device is activated or deactivated by guest virtual 
> machine,
>the callback will be called, then vSwitch could put the device onto 
> data
> -  core or remove the device from data core.
> +  core or remove the device from data core by setting or unsetting
> +  VIRTIO_DEV_RUNNING on the device flags.
>  
>  *   Read/write packets from/to guest virtual machine
>  
> diff --git a/lib/librte_vhost/rte_virtio_net.h 
> b/lib/librte_vhost/rte_virtio_net.h
> index 611a3d4..b9d34c7 100644
> --- a/lib/librte_vhost/rte_virtio_net.h
> +++ b/lib/librte_vhost/rte_virtio_net.h
> @@ -130,6 +130,10 @@ struct virtio_memory {
>  
>  /**
>   * Device operations to add/remove device.
> + *
> + * Make sure to set VIRTIO_DEV_RUNNING to the device flags in new_device and
> + * remove it in destroy_device.
> + *
>   */
>  struct virtio_net_device_ops {
>   int (*new_device)(struct virtio_net *); /**< Add device. */



[dpdk-dev] Support for MS Hyper-v hypervisor

2015-03-17 Thread Vithal S Mohare
Hi,

Would like to know whether present released versions of DPDK (1.7.x) supports 
MS hyper-v hypervisor.  DPDK roadmap document has it in the list for Version 
2.1.  Please confirm if we need to wait for the support till the release of 
DPDK 2.1.

Thanks,
-Vithal


[dpdk-dev] [PATCH] Fix `eventfd_link' module leakages and races

2015-03-17 Thread Ouyang, Changchun


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Pavel Boldin
> Sent: Tuesday, March 17, 2015 12:41 AM
> To: dev at dpdk.org
> Cc: Pavel Boldin
> Subject: [dpdk-dev] [PATCH] Fix `eventfd_link' module leakages and races
> 
> From: Pavel Boldin 
> 
> The `eventfd_link' module provides an API to "steal" fd from another process
> had been written with a bug that leaks `struct file' because of the extra
> reference counter increment and missing `fput' call.
> 
> The other bug is using another process' `task_struct' without incrementing a
> reference counter.
> 
> Fix these bugs and refactor the module.
> ---
>  examples/vhost/eventfd_link/eventfd_link.c | 236 -
> 
>  1 file changed, 130 insertions(+), 106 deletions(-)
> 
> diff --git a/examples/vhost/eventfd_link/eventfd_link.c
> b/examples/vhost/eventfd_link/eventfd_link.c
> index 69470ba..9f1f8fb 100644
> --- a/examples/vhost/eventfd_link/eventfd_link.c
> +++ b/examples/vhost/eventfd_link/eventfd_link.c
> @@ -42,15 +42,15 @@
>   * get_files_struct is copied from fs/file.c
>   */
>  struct files_struct *
> -get_files_struct (struct task_struct *task)
> +get_files_struct(struct task_struct *task)
>  {
>   struct files_struct *files;
> 
> - task_lock (task);
> + task_lock(task);
>   files = task->files;
>   if (files)
> - atomic_inc (>count);
> - task_unlock (task);
> + atomic_inc(>count);
> + task_unlock(task);

I don't find any actual code change for above. 
If they are tab, space, indent refine,
I suggest it needs a separate patch named code cleanup,
Then it is easy to review.

Same for other places.

Done.
Changchun


> 
>   return files;
>  }
> @@ -59,117 +59,142 @@ get_files_struct (struct task_struct *task)
>   * put_files_struct is extracted from fs/file.c
>   */
>  void
> -put_files_struct (struct files_struct *files)
> +put_files_struct(struct files_struct *files)
>  {
> - if (atomic_dec_and_test (>count))
> - {
> + if (atomic_dec_and_test(>count))
>   BUG ();
> +}
> +
> +static struct file *
> +fget_from_files(struct files_struct *files, unsigned fd) {
> + struct file *file;
> +
> + rcu_read_lock();
> + file = fcheck_files(files, fd);
> + if (file)
> + {
> + if (file->f_mode & FMODE_PATH
> + || !atomic_long_inc_not_zero(>f_count))
> + file = NULL;
>   }
> + rcu_read_unlock();
> +
> + return file;
> +}
> +
> +static int
> +close_fd(unsigned fd)
> +{
> + struct file *file;
> + struct files_struct *files = current->files;
> + struct fdtable *fdt;
> +
> + spin_lock(>file_lock);
> + fdt = files_fdtable(files);
> + if (fd >= fdt->max_fds)
> + goto out_unlock;
> + file = fdt->fd[fd];
> + if (!file)
> + goto out_unlock;
> + rcu_assign_pointer(fdt->fd[fd], NULL);
> + __clear_bit(fd, fdt->close_on_exec);
> + spin_unlock(>file_lock);
> + return filp_close(file, files);
> +
> +out_unlock:
> + spin_unlock(>file_lock);
> + return -EBADF;
>  }
> 
> 
>  static long
> -eventfd_link_ioctl (struct file *f, unsigned int ioctl, unsigned long arg)
> +eventfd_link_ioctl_copy(unsigned long arg)
>  {
> - void __user *argp = (void __user *) arg;
> + long ret = -EFAULT;
>   struct task_struct *task_target = NULL;
> - struct file *file;
> - struct files_struct *files;
> - struct fdtable *fdt;
> + struct file *target_file = NULL;
> + struct files_struct *target_files = NULL;
>   struct eventfd_copy eventfd_copy;
> + struct pid *pid;
> +
> + if (copy_from_user(_copy, (void __user*)arg,
> + sizeof(struct eventfd_copy)))
> + goto out;
> +
> + /*
> +  * Find the task struct for the target pid
> +  */
> + pid = find_vpid(eventfd_copy.target_pid);
> + if (pid == NULL) {
> + printk(KERN_INFO "Unable to find pid %d\n",
> + eventfd_copy.target_pid);
> + goto out;
> + }
> +
> + task_target = get_pid_task(pid, PIDTYPE_PID);
> + if (task_target == NULL) {
> + printk(KERN_INFO "Failed to get task for pid %d\n",
> + eventfd_copy.target_pid);
> + goto out;
> + }
> +
> + ret = close_fd(eventfd_copy.source_fd);
> + if (ret)
> + goto out_task;
> + ret = -EFAULT;
> +
> + /*
> +  * Find the file struct associated with the target fd.
> +  */
> +
> + target_files = get_files_struct(task_target);
> + if (target_files == NULL) {
> + printk (KERN_INFO "Failed to get target files struct\n");
> + goto out_task;
> + }
> +
> + target_file = fget_from_files(target_files, eventfd_copy.target_fd);
> +
> + if (target_file == NULL) {
> + printk (KERN_INFO "Failed to get file from target pid\n");
> + goto 

[dpdk-dev] [PATCH] app/testpmd: Fix not set need_reconfig flag when port id is RTE_PORT_ALL

2015-03-17 Thread Ouyang, Changchun


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Yong Liu
> Sent: Friday, March 13, 2015 10:38 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] app/testpmd: Fix not set need_reconfig flag
> when port id is RTE_PORT_ALL
> 
> When port id is RTE_PORT_ALL, port_id_is_invalid will also return zero.
> So this function will only set ports[255] need_reconfig flag, other ports 
> will be
> skipped.
> 
> Signed-off-by: Marvin liu 
> 

Acked-by: Changchun Ouyang 



[dpdk-dev] [PATCH] librte_pmd_fm10k: Set pointer to NULL after free

2015-03-17 Thread Thomas Monjalon
> > It could be a potential not safe issue.
> > 
> > Signed-off-by: Michael Qiu 
> 
> Acked-by: Jing Chen 

Applied, thanks


[dpdk-dev] [PATCH] vhost: Add a hint on how to add or remove the device to a data core

2015-03-17 Thread Thomas Monjalon
Huawei, any opinion about this patch?

2015-02-27 11:22, Beno?t Canet:
> Let's make sure people will not forget to set and unset VIRTIO_DEV_RUNNING.
> 
> Signed-off-by: Beno?t Canet 
> ---
>  doc/guides/prog_guide/vhost_lib.rst | 3 ++-
>  lib/librte_vhost/rte_virtio_net.h   | 4 
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guides/prog_guide/vhost_lib.rst 
> b/doc/guides/prog_guide/vhost_lib.rst
> index 0b6eda7..ba6065d 100644
> --- a/doc/guides/prog_guide/vhost_lib.rst
> +++ b/doc/guides/prog_guide/vhost_lib.rst
> @@ -58,7 +58,8 @@ Vhost API Overview
>register two callbacks, new_destory and destroy_device.
>When virtio device is activated or deactivated by guest virtual 
> machine,
>the callback will be called, then vSwitch could put the device onto 
> data
> -  core or remove the device from data core.
> +  core or remove the device from data core by setting or unsetting
> +  VIRTIO_DEV_RUNNING on the device flags.
>  
>  *   Read/write packets from/to guest virtual machine
>  
> diff --git a/lib/librte_vhost/rte_virtio_net.h 
> b/lib/librte_vhost/rte_virtio_net.h
> index 611a3d4..b9d34c7 100644
> --- a/lib/librte_vhost/rte_virtio_net.h
> +++ b/lib/librte_vhost/rte_virtio_net.h
> @@ -130,6 +130,10 @@ struct virtio_memory {
>  
>  /**
>   * Device operations to add/remove device.
> + *
> + * Make sure to set VIRTIO_DEV_RUNNING to the device flags in new_device and
> + * remove it in destroy_device.
> + *
>   */
>  struct virtio_net_device_ops {
>   int (*new_device)(struct virtio_net *); /**< Add device. */
> 




[dpdk-dev] [PATCH] lib/librte_vhost: add CONFIG_RTE_LIBRTE_VHOST_USER switch

2015-03-17 Thread Thomas Monjalon
2015-03-13 02:50, Ouyang, Changchun:
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Huawei Xie
> > Turn on CONFIG_RTE_LIBRTE_VHOST to enable vhost.
> > vhost-user is turned on by default. Turn off
> > CONFIG_RTE_LIBRTE_VHOST_USER to enable vhost-cuse implementation.
> > 
> > Signed-off-by: Huawei Xie 
> 
> Acked-by: Changchun Ouyang 

Applied, thanks

Later this option should be removed to allow using both implementations.


[dpdk-dev] [PATCH v2] eal: fix Wbad-function-cast warning

2015-03-17 Thread Thomas Monjalon
2015-03-16 13:52, Neil Horman:
> On Mon, Mar 16, 2015 at 05:05:06PM +, John McNamara wrote:
> > Fix a warning when the rte_common.h header is included in a compilation
> > using  -Wbad-function-cast, such as in Open vSwitch where the
> > following warning is emitted repeatedly:
> > 
> > ../rte_common.h: In function 'rte_is_aligned':
> > ../rte_common.h:184:9: warning: cast from function call of
> > type 'uintptr_t' to non-matching type 'void *' [-Wbad-function-cast]
> > 
> > This change fixes the issue in rte_common.h by using the RTE_ALIGN_FLOOR
> > macro to get the aligned floor value with generic type casting.
> > 
> > Also removed the rte_align_floor_int() function and replaced it with
> > the RTE_PTR_ALIGN_FLOOR() macro.
> > 
> > Signed-off-by: John McNamara 
> 
> Acked-by: Neil Horman 

Applied, thanks



[dpdk-dev] [PATCH v3 0/3]: bug fixes in the ixgbe PF PMD Rx flow

2015-03-17 Thread Thomas Monjalon
2015-03-13 11:07, Ananyev, Konstantin:
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Vlad Zolotarov
> > This series contains some bug fixes that were found during my work on the 
> > ixgbe LRO
> > patches. Sending this series separately on Thomas request so that it may be 
> > integrated
> > into the 2.0 release.
> > 
> > New in v3:
> >- Adjusted to the new structs naming in the master.
> >- Fixed rx_bulk_alloc_allowed and rx_vec_allowed initialization:
> >   - Don't set them to FALSE in rte_eth_dev_stop() flow - the following
> > rte_eth_dev_start() will need them.
> >   - Reset them to TRUE in rte_eth_dev_configure() and not in a probe() 
> > flow.
> > This will ensure the proper behaviour if port is re-configured.
> >- Rename:
> >   - ixgbe_rx_vec_condition_check() -> 
> > ixgbe_rx_vec_dev_conf_condition_check()
> >   - set_rx_function() -> ixgbe_set_rx_function()
> >- Clean up the logic in ixgbe_set_rx_function().
> >- Define stubs with __attribute__((weak)) instead of using #ifdef's.
> >- Styling: beautify ixgbe_rxtx.h a bit.
> > 
> > New in v2:
> >- Fixed a compilation failure.
> > 
> > 
> > Vlad Zolotarov (3):
> >   ixgbe: Use the rte_le_to_cpu_xx()/rte_cpu_to_le_xx() when
> > reading/setting HW ring descriptor fields
> >   ixgbe: Bug fix: Properly configure Rx CRC stripping for x540 devices
> >   ixgbe: Unify the rx_pkt_bulk callback initialization
> 
> Acked-by: Konstantin Ananyev 

Applied, thanks



[dpdk-dev] Support for MS Hyper-v hypervisor

2015-03-17 Thread Stephen Hemminger
No DPDK 1.7.x does not support hyper-v virtual NICZ.

On Mon, Mar 16, 2015 at 9:57 PM, Vithal S Mohare 
wrote:

> Hi,
>
> Would like to know whether present released versions of DPDK (1.7.x)
> supports MS hyper-v hypervisor.  DPDK roadmap document has it in the list
> for Version 2.1.  Please confirm if we need to wait for the support till
> the release of DPDK 2.1.
>
> Thanks,
> -Vithal
>


[dpdk-dev] DPDK on EC2?

2015-03-17 Thread Patel, Rashmin N
Just curious - I didn't understand the usage model here. In the Amazon EC2 
instance (a VM,) do you want to run a DPDK application? Where do you intend to 
run OVS? 

As far I remember, OVS has a datapath in Host kernel and you won't be given 
Host access by AWS. And I'm not sure if Amazon provides an OVS instance, but in 
case if they don't have an offering, you have to put your OVS installation in 
another VM (virtualizing network function) and bounce the traffic back to your 
VM(s.)

As far as Amazon Advanced Networking is concerned, you get a dedicated slice 
(an SRIOV Virtual Function) of a NIC in your VM, where a Physical Function 
Driver running in the Host (Amazon VMM-Xen I think) controls all the filtering 
configuration privileges.

Thanks,
Rashmin

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Andre Richter
Sent: Monday, March 16, 2015 2:27 PM
To: Jeff Wang; dev at dpdk.org
Subject: Re: [dpdk-dev] DPDK on EC2?

Be sure to get an instance with SR-IOV, which is "enhanced networking" in 
Amazon speak.

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking.html

Cheers Andre
Jeff Wang  schrieb am Mo., 16. M?rz 2015 um 21:08:

> Hi,
>
> I'm trying to deploy DPDK and ovs on an AWS EC2 instance which is 
> running CentOS 7.
>
> Has anybody had tried to do this? How to bind a NIC to dpdk while it 
> shows no NICs when I do lspci?
>
> Thanks!
>