Re: [dpdk-dev] [dpdk-stable] [PATCH] EAL: Called remove() of drivers for vdev and pci buses

2020-10-25 Thread Muhammad Bilal
On Tue, Oct 20, 2020 at 6:43 PM David Marchand
 wrote:
>
> Hello,
Hi
>
> On Sat, Sep 12, 2020 at 9:53 PM Gaƫtan Rivet  wrote:
> >
> > On 08/07/20 17:03 +0500, Muhammad Bilal wrote:
> > > while using memif with app, the resources are not cleaned on exit,
> > > So an error occurred on running it second time. The cause of this problem
> > > is that remove() of memif driver is not called by rte_eal_cleanup() which
> > > is counterpart of probe() called from rte_eal_init(). This is a case for
> > > all other divers e.g pci, so to solve this problem I have added the
> > > functionality of calling remove() function of all the driver attached to
> > > devices on vdev and pci buses.
> > >
> >
> > Hi Muhammad,
> >
> > review inline.
>
> There were comments from Gaetan, waiting for a v2.
I am working on required changes, and will update it soon.
Thanks
> Thanks.
>
>
> --
> David Marchand
>


[dpdk-dev] [PATCH] EAL: Called remove() of drivers for vdev and pci buses

2020-07-08 Thread Muhammad Bilal
while using memif with app, the resources are not cleaned on exit,
So an error occurred on running it second time. The cause of this problem
is that remove() of memif driver is not called by rte_eal_cleanup() which
is counterpart of probe() called from rte_eal_init(). This is a case for
all other divers e.g pci, so to solve this problem I have added the
functionality of calling remove() function of all the driver attached to
devices on vdev and pci buses.

Bugzilla ID: 353
Signed-off-by: Muhammad Bilal 
---
 drivers/bus/pci/pci_common.c   | 23 +++
 drivers/bus/vdev/vdev.c| 19 ++-
 lib/librte_eal/common/eal_common_bus.c | 18 ++
 lib/librte_eal/include/rte_bus.h   | 23 +++
 lib/librte_eal/linux/eal.c |  2 ++
 5 files changed, 84 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 245d94f59..203b32a23 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -320,6 +320,28 @@ pci_probe(void)
return (probed && probed == failed) ? -1 : 0;
 }
 
+/*
+ * Scan the content of the PCI bus, and call the remove() function for
+ * all registered drivers of devices that have already been probed.
+ */
+static int
+pci_remove(void)
+{
+   struct rte_pci_device *dev = NULL;
+   int ret = 0;
+
+   FOREACH_DEVICE_ON_PCIBUS(dev) {
+   if (rte_dev_is_probed(&dev->device))
+   if (rte_pci_detach_dev(dev) != 0) {
+   RTE_LOG(INFO, EAL,
+   "failed to detach driver form %s\n",
+   dev->device.name);
+   ret = -1;
+   }
+   }
+   return ret;
+}
+
 /* dump one device */
 static int
 pci_dump_one_device(FILE *f, struct rte_pci_device *dev)
@@ -669,6 +691,7 @@ struct rte_pci_bus rte_pci_bus = {
.bus = {
.scan = rte_pci_scan,
.probe = pci_probe,
+   .remove = pci_remove,
.find_device = pci_find_device,
.plug = pci_plug,
.unplug = pci_unplug,
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index a89ea2353..692c936b9 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -546,6 +546,22 @@ vdev_unplug(struct rte_device *dev)
return rte_vdev_uninit(dev->name);
 }
 
+static int
+vdev_remove(void)
+{
+   struct rte_vdev_device *dev;
+   int ret = 0;
+
+   TAILQ_FOREACH(dev, &vdev_device_list, next) {
+   if (vdev_remove_driver(dev) != 0) {
+   VDEV_LOG(INFO, "driver of %s is not removed\n",
+   dev->device.name);
+   ret = -1;
+   }
+   }
+   return ret;
+}
+
 static struct rte_bus rte_vdev_bus = {
.scan = vdev_scan,
.probe = vdev_probe,
@@ -554,7 +570,8 @@ static struct rte_bus rte_vdev_bus = {
.unplug = vdev_unplug,
.parse = vdev_parse,
.dev_iterate = rte_vdev_dev_iterate,
-};
+   .remove = vdev_remove,
+   };
 
 RTE_REGISTER_BUS(vdev, rte_vdev_bus);
 
diff --git a/lib/librte_eal/common/eal_common_bus.c 
b/lib/librte_eal/common/eal_common_bus.c
index baa5b532a..bff95a0ae 100644
--- a/lib/librte_eal/common/eal_common_bus.c
+++ b/lib/librte_eal/common/eal_common_bus.c
@@ -85,6 +85,24 @@ rte_bus_probe(void)
return 0;
 }
 
+/* Remove all devices of all buses */
+int
+rte_bus_remove(void)
+{
+   int ret;
+   struct rte_bus *bus;
+
+   TAILQ_FOREACH(bus, &rte_bus_list, next) {
+   if (!strcmp(bus->name, "vdev") || !strcmp(bus->name, "pci")) {
+   ret = bus->remove();
+   if (ret)
+   RTE_LOG(INFO, EAL, "Bus (%s) remove failed.\n",
+   bus->name);
+   }
+   }
+   return 0;
+}
+
 /* Dump information of a single bus */
 static int
 bus_dump_one(FILE *f, struct rte_bus *bus)
diff --git a/lib/librte_eal/include/rte_bus.h b/lib/librte_eal/include/rte_bus.h
index d3034d0ed..c3e7e62c9 100644
--- a/lib/librte_eal/include/rte_bus.h
+++ b/lib/librte_eal/include/rte_bus.h
@@ -67,6 +67,18 @@ typedef int (*rte_bus_scan_t)(void);
  */
 typedef int (*rte_bus_probe_t)(void);
 
+/**
+ * Implementation specific remove function which is responsible for unlinking
+ * devices on that bus from attached drivers.
+ *
+ * This is called while iterating over each registered bus.
+ *
+ * @return
+ * 0 for successful remove
+ * !0 for any error while removing
+ */
+typedef int (*rte_bus_remove_t)(void);
+
 /**
  * Device iterator to find a device on a bus.
  *
@@ -248,6 +260,7 @@ struct rte_bus {
const char *name;

Re: [dpdk-dev] [PATCH] EAL: Called remove() of drivers for vdev and pci buses

2020-07-08 Thread Muhammad Bilal
On Wed, Jul 8, 2020 at 5:04 PM Muhammad Bilal  wrote:
>
> while using memif with app, the resources are not cleaned on exit,
> So an error occurred on running it second time. The cause of this problem
> is that remove() of memif driver is not called by rte_eal_cleanup() which
> is counterpart of probe() called from rte_eal_init(). This is a case for
> all other divers e.g pci, so to solve this problem I have added the
> functionality of calling remove() function of all the driver attached to
> devices on vdev and pci buses.
>
Little correction
Bugzilla ID: 437
> Bugzilla ID: 353
> Signed-off-by: Muhammad Bilal 
> ---
>  drivers/bus/pci/pci_common.c   | 23 +++
>  drivers/bus/vdev/vdev.c| 19 ++-
>  lib/librte_eal/common/eal_common_bus.c | 18 ++
>  lib/librte_eal/include/rte_bus.h   | 23 +++
>  lib/librte_eal/linux/eal.c |  2 ++
>  5 files changed, 84 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
> index 245d94f59..203b32a23 100644
> --- a/drivers/bus/pci/pci_common.c
> +++ b/drivers/bus/pci/pci_common.c
> @@ -320,6 +320,28 @@ pci_probe(void)
> return (probed && probed == failed) ? -1 : 0;
>  }
>
> +/*
> + * Scan the content of the PCI bus, and call the remove() function for
> + * all registered drivers of devices that have already been probed.
> + */
> +static int
> +pci_remove(void)
> +{
> +   struct rte_pci_device *dev = NULL;
> +   int ret = 0;
> +
> +   FOREACH_DEVICE_ON_PCIBUS(dev) {
> +   if (rte_dev_is_probed(&dev->device))
> +   if (rte_pci_detach_dev(dev) != 0) {
> +   RTE_LOG(INFO, EAL,
> +   "failed to detach driver form %s\n",
> +   dev->device.name);
> +   ret = -1;
> +   }
> +   }
> +   return ret;
> +}
> +
>  /* dump one device */
>  static int
>  pci_dump_one_device(FILE *f, struct rte_pci_device *dev)
> @@ -669,6 +691,7 @@ struct rte_pci_bus rte_pci_bus = {
> .bus = {
> .scan = rte_pci_scan,
> .probe = pci_probe,
> +   .remove = pci_remove,
> .find_device = pci_find_device,
> .plug = pci_plug,
> .unplug = pci_unplug,
> diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
> index a89ea2353..692c936b9 100644
> --- a/drivers/bus/vdev/vdev.c
> +++ b/drivers/bus/vdev/vdev.c
> @@ -546,6 +546,22 @@ vdev_unplug(struct rte_device *dev)
> return rte_vdev_uninit(dev->name);
>  }
>
> +static int
> +vdev_remove(void)
> +{
> +   struct rte_vdev_device *dev;
> +   int ret = 0;
> +
> +   TAILQ_FOREACH(dev, &vdev_device_list, next) {
> +   if (vdev_remove_driver(dev) != 0) {
> +   VDEV_LOG(INFO, "driver of %s is not removed\n",
> +   dev->device.name);
> +   ret = -1;
> +   }
> +   }
> +   return ret;
> +}
> +
>  static struct rte_bus rte_vdev_bus = {
> .scan = vdev_scan,
> .probe = vdev_probe,
> @@ -554,7 +570,8 @@ static struct rte_bus rte_vdev_bus = {
> .unplug = vdev_unplug,
> .parse = vdev_parse,
> .dev_iterate = rte_vdev_dev_iterate,
> -};
> +   .remove = vdev_remove,
> +   };
>
>  RTE_REGISTER_BUS(vdev, rte_vdev_bus);
>
> diff --git a/lib/librte_eal/common/eal_common_bus.c 
> b/lib/librte_eal/common/eal_common_bus.c
> index baa5b532a..bff95a0ae 100644
> --- a/lib/librte_eal/common/eal_common_bus.c
> +++ b/lib/librte_eal/common/eal_common_bus.c
> @@ -85,6 +85,24 @@ rte_bus_probe(void)
> return 0;
>  }
>
> +/* Remove all devices of all buses */
> +int
> +rte_bus_remove(void)
> +{
> +   int ret;
> +   struct rte_bus *bus;
> +
> +   TAILQ_FOREACH(bus, &rte_bus_list, next) {
> +   if (!strcmp(bus->name, "vdev") || !strcmp(bus->name, "pci")) {
> +   ret = bus->remove();
> +   if (ret)
> +   RTE_LOG(INFO, EAL, "Bus (%s) remove 
> failed.\n",
> +   bus->name);
> +   }
> +   }
> +   return 0;
> +}
> +
>  /* Dump information of a single bus */
>  static int
>  bus_dump_one(FILE *f, struct rte_bus *bus)
> diff --git a/lib/librte_eal/inclu

[dpdk-dev] [PATCH] examples/l2fwd/main.c: free resources in case of error

2020-05-11 Thread Muhammad Bilal
Bugzilla ID: 437
Cc: dev@dpdk.org
Cc: sta...@dpdk.org
Cc: bruce.richard...@intel.com
Cc: vipin.vargh...@intel.com
Cc: jgraj...@cisco.com
Signed-off-by: Muhammad Bilal 
---
 examples/l2fwd/main.c | 72 ++-
 1 file changed, 57 insertions(+), 15 deletions(-)

diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 88ddfe589..dbaa457e2 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -517,6 +517,17 @@ signal_handler(int signum)
}
 }
 
+static void
+stop_and_close_eth_dev(uint16_t portid)
+{
+   RTE_ETH_FOREACH_DEV(portid) {
+   printf("Closing port %d...", portid);
+   rte_eth_dev_stop(portid);
+   rte_eth_dev_close(portid);
+   printf(" Done\n");
+   }
+}
+
 int
 main(int argc, char **argv)
 {
@@ -543,8 +554,10 @@ main(int argc, char **argv)
 
/* parse application arguments (after the EAL ones) */
ret = l2fwd_parse_args(argc, argv);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n");
+   }
 
printf("MAC updating %s\n", mac_updating ? "enabled" : "disabled");
 
@@ -552,13 +565,17 @@ main(int argc, char **argv)
timer_period *= rte_get_timer_hz();
 
nb_ports = rte_eth_dev_count_avail();
-   if (nb_ports == 0)
+   if (nb_ports == 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
+   }
 
/* check port mask to possible port mask */
-   if (l2fwd_enabled_port_mask & ~((1 << nb_ports) - 1))
+   if (l2fwd_enabled_port_mask & ~((1 << nb_ports) - 1)) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Invalid portmask; possible (0x%x)\n",
(1 << nb_ports) - 1);
+   }
 
/* reset l2fwd_dst_ports */
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++)
@@ -601,8 +618,10 @@ main(int argc, char **argv)
   lcore_queue_conf[rx_lcore_id].n_rx_port ==
   l2fwd_rx_queue_per_lcore) {
rx_lcore_id++;
-   if (rx_lcore_id >= RTE_MAX_LCORE)
+   if (rx_lcore_id >= RTE_MAX_LCORE) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Not enough cores\n");
+   }
}
 
if (qconf != &lcore_queue_conf[rx_lcore_id]) {
@@ -623,8 +642,10 @@ main(int argc, char **argv)
l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", nb_mbufs,
MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
rte_socket_id());
-   if (l2fwd_pktmbuf_pool == NULL)
+   if (l2fwd_pktmbuf_pool == NULL) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
+   }
 
/* Initialise each port */
RTE_ETH_FOREACH_DEV(portid) {
@@ -645,32 +666,40 @@ main(int argc, char **argv)
fflush(stdout);
 
ret = rte_eth_dev_info_get(portid, &dev_info);
-   if (ret != 0)
+   if (ret != 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE,
"Error during getting device (port %u) info: 
%s\n",
portid, strerror(-ret));
+   }
 
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
local_port_conf.txmode.offloads |=
DEV_TX_OFFLOAD_MBUF_FAST_FREE;
ret = rte_eth_dev_configure(portid, 1, 1, &local_port_conf);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Cannot configure device: 
err=%d, port=%u\n",
  ret, portid);
+   }
 
ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
   &nb_txd);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE,
 "Cannot adjust number of descriptors: err=%d, 
port=%u\n",
 ret, portid);
+   }
 
ret = rte_eth_macaddr_get(portid,
  &l2fwd_ports_eth_addr[portid]);
-   if (ret < 0)
+   if (ret 

[dpdk-dev] [PATCH v2] examples/l2fwd: free resources in case of error

2020-05-12 Thread Muhammad Bilal
Bugzilla ID: 437
Cc: dev@dpdk.org
Cc: sta...@dpdk.org
Cc: bruce.richard...@intel.com
Cc: vipin.vargh...@intel.com
Cc: jgraj...@cisco.com
Signed-off-by: Muhammad Bilal 
---
 examples/l2fwd/main.c | 76 ++-
 1 file changed, 60 insertions(+), 16 deletions(-)

diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 88ddfe589..efea2dce3 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -517,6 +517,18 @@ signal_handler(int signum)
}
 }
 
+static void
+stop_and_close_eth_dev(uint16_t portid)
+{
+   RTE_ETH_FOREACH_DEV(portid) {
+   printf("Closing port %d...", portid);
+   rte_eth_dev_stop(portid);
+   rte_eth_dev_close(portid);
+   printf(" Done\n");
+   rte_eal_cleanup();
+   }
+}
+
 int
 main(int argc, char **argv)
 {
@@ -524,7 +536,8 @@ main(int argc, char **argv)
int ret;
uint16_t nb_ports;
uint16_t nb_ports_available = 0;
-   uint16_t portid, last_port;
+   uint16_t portid = 0;
+   uint16_t last_port;
unsigned lcore_id, rx_lcore_id;
unsigned nb_ports_in_mask = 0;
unsigned int nb_lcores = 0;
@@ -543,8 +556,10 @@ main(int argc, char **argv)
 
/* parse application arguments (after the EAL ones) */
ret = l2fwd_parse_args(argc, argv);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n");
+   }
 
printf("MAC updating %s\n", mac_updating ? "enabled" : "disabled");
 
@@ -552,13 +567,17 @@ main(int argc, char **argv)
timer_period *= rte_get_timer_hz();
 
nb_ports = rte_eth_dev_count_avail();
-   if (nb_ports == 0)
+   if (nb_ports == 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
+   }
 
/* check port mask to possible port mask */
-   if (l2fwd_enabled_port_mask & ~((1 << nb_ports) - 1))
+   if (l2fwd_enabled_port_mask & ~((1 << nb_ports) - 1)) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Invalid portmask; possible (0x%x)\n",
(1 << nb_ports) - 1);
+   }
 
/* reset l2fwd_dst_ports */
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++)
@@ -601,8 +620,10 @@ main(int argc, char **argv)
   lcore_queue_conf[rx_lcore_id].n_rx_port ==
   l2fwd_rx_queue_per_lcore) {
rx_lcore_id++;
-   if (rx_lcore_id >= RTE_MAX_LCORE)
+   if (rx_lcore_id >= RTE_MAX_LCORE) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Not enough cores\n");
+   }
}
 
if (qconf != &lcore_queue_conf[rx_lcore_id]) {
@@ -623,8 +644,10 @@ main(int argc, char **argv)
l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", nb_mbufs,
MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
rte_socket_id());
-   if (l2fwd_pktmbuf_pool == NULL)
+   if (l2fwd_pktmbuf_pool == NULL) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
+   }
 
/* Initialise each port */
RTE_ETH_FOREACH_DEV(portid) {
@@ -645,32 +668,40 @@ main(int argc, char **argv)
fflush(stdout);
 
ret = rte_eth_dev_info_get(portid, &dev_info);
-   if (ret != 0)
+   if (ret != 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE,
"Error during getting device (port %u) info: 
%s\n",
portid, strerror(-ret));
+   }
 
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
local_port_conf.txmode.offloads |=
DEV_TX_OFFLOAD_MBUF_FAST_FREE;
ret = rte_eth_dev_configure(portid, 1, 1, &local_port_conf);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Cannot configure device: 
err=%d, port=%u\n",
  ret, portid);
+   }
 
ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
   &nb_txd);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
  

[dpdk-dev] [PATCH] doc/guides/eventdevs: removing typing error in documentation of eventdevs

2020-05-14 Thread Muhammad Bilal
Bugzilla ID: 477
Cc: dev@dpdk.org
Cc: sta...@dpdk.org
Cc: jer...@marvell.com
Signed-off-by: Muhammad Bilal 
---
 doc/guides/eventdevs/index.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guides/eventdevs/index.rst b/doc/guides/eventdevs/index.rst
index 570905b81..bb66a5eac 100644
--- a/doc/guides/eventdevs/index.rst
+++ b/doc/guides/eventdevs/index.rst
@@ -5,7 +5,7 @@ Event Device Drivers
 
 
 The following are a list of event device PMDs, which can be used from an
-application trough the eventdev API.
+application through the eventdev API.
 
 .. toctree::
 :maxdepth: 2
-- 
2.17.1



[dpdk-dev] [PATCH v2] removing typing error of word 'through' in multiple places

2020-05-15 Thread Muhammad Bilal
Removed the typing error in doc/guides/eventdevs/index.rst,
drivers/net/mlx5/mlx5.c and in lib/librte_vhost/rte_vhost.h

Cc: dev@dpdk.org
Cc: sta...@dpdk.org
Cc: jer...@marvell.com
Cc: ma...@mellanox.com
Cc: shah...@mellanox.com
Cc: maxime.coque...@redhat.com
Cc: xiaolong...@intel.com
Signed-off-by: Muhammad Bilal 
---
 doc/guides/eventdevs/index.rst | 2 +-
 drivers/net/mlx5/mlx5.c| 2 +-
 lib/librte_vhost/rte_vhost.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/guides/eventdevs/index.rst b/doc/guides/eventdevs/index.rst
index 570905b81..bb66a5eac 100644
--- a/doc/guides/eventdevs/index.rst
+++ b/doc/guides/eventdevs/index.rst
@@ -5,7 +5,7 @@ Event Device Drivers
 
 
 The following are a list of event device PMDs, which can be used from an
-application trough the eventdev API.
+application through the eventdev API.
 
 .. toctree::
 :maxdepth: 2
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 4f704cbef..264f4928a 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -3382,7 +3382,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv 
__rte_unused,
/*
 * Single IB device with multiple ports found,
 * it may be E-Switch master device and representors.
-* We have to perform identification trough the ports.
+* We have to perform identification through the ports.
 */
MLX5_ASSERT(nl_rdma >= 0);
MLX5_ASSERT(ns == 0);
diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h
index 5c72fba79..d43669f2c 100644
--- a/lib/librte_vhost/rte_vhost.h
+++ b/lib/librte_vhost/rte_vhost.h
@@ -259,7 +259,7 @@ struct vhost_device_ops {
 
/**
 * This callback gets called each time a guest gets notified
-* about waiting packets. This is the interrupt handling trough
+* about waiting packets. This is the interrupt handling through
 * the eventfd_write(callfd), which can be used for counting these
 * "slow" syscalls.
 */
-- 
2.17.1



[dpdk-dev] [PATCH 2/5] examples/l2fwd-jobstats: free resources in case of error

2020-05-19 Thread Muhammad Bilal
Freeing the resources and call rte_eal_cleanup in case of error exit.
Signed-off-by: Muhammad Bilal 
---
 examples/l2fwd-jobstats/main.c | 75 +++---
 1 file changed, 60 insertions(+), 15 deletions(-)

diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index 396fd89db..e74e16113 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -739,6 +739,18 @@ check_all_ports_link_status(uint32_t port_mask)
}
 }
 
+static void
+stop_and_close_eth_dev(uint16_t portid)
+{
+   RTE_ETH_FOREACH_DEV(portid) {
+   printf("Closing port %d...", portid);
+   rte_eth_dev_stop(portid);
+   rte_eth_dev_close(portid);
+   printf(" Done\n");
+   }
+   rte_eal_cleanup();
+}
+
 int
 main(int argc, char **argv)
 {
@@ -749,7 +761,8 @@ main(int argc, char **argv)
char name[RTE_JOBSTATS_NAMESIZE];
uint16_t nb_ports;
uint16_t nb_ports_available = 0;
-   uint16_t portid, last_port;
+   uint16_t portid = 0;
+   uint16_t last_port;
uint8_t i;
 
/* init EAL */
@@ -761,8 +774,10 @@ main(int argc, char **argv)
 
/* parse application arguments (after the EAL ones) */
ret = l2fwd_parse_args(argc, argv);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n");
+   }
 
rte_timer_subsystem_init();
 
@@ -773,12 +788,16 @@ main(int argc, char **argv)
l2fwd_pktmbuf_pool =
rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32,
0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
-   if (l2fwd_pktmbuf_pool == NULL)
+   if (l2fwd_pktmbuf_pool == NULL) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
+   }
 
nb_ports = rte_eth_dev_count_avail();
-   if (nb_ports == 0)
+   if (nb_ports == 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
+   }
 
/* reset l2fwd_dst_ports */
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++)
@@ -820,8 +839,10 @@ main(int argc, char **argv)
   lcore_queue_conf[rx_lcore_id].n_rx_port ==
   l2fwd_rx_queue_per_lcore) {
rx_lcore_id++;
-   if (rx_lcore_id >= RTE_MAX_LCORE)
+   if (rx_lcore_id >= RTE_MAX_LCORE) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Not enough cores\n");
+   }
}
 
if (qconf != &lcore_queue_conf[rx_lcore_id])
@@ -852,32 +873,40 @@ main(int argc, char **argv)
fflush(stdout);
 
ret = rte_eth_dev_info_get(portid, &dev_info);
-   if (ret != 0)
+   if (ret != 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE,
"Error during getting device (port %u) info: 
%s\n",
portid, strerror(-ret));
+   }
 
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
local_port_conf.txmode.offloads |=
DEV_TX_OFFLOAD_MBUF_FAST_FREE;
ret = rte_eth_dev_configure(portid, 1, 1, &local_port_conf);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Cannot configure device: 
err=%d, port=%u\n",
  ret, portid);
+   }
 
ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
   &nb_txd);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE,
 "Cannot adjust number of descriptors: err=%d, 
port=%u\n",
 ret, portid);
+   }
 
ret = rte_eth_macaddr_get(portid,
  &l2fwd_ports_eth_addr[portid]);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE,
 "Cannot get MAC address: err=%d, port=%u\n",
 ret, portid);
+   }
 
/* init

[dpdk-dev] [PATCH 3/5] examples/l2fwd-keepalive: free resources in case of error

2020-05-19 Thread Muhammad Bilal
Freeing the resources and call rte_eal_cleanup in case of error exit.
Signed-off-by: Muhammad Bilal 
---
 examples/l2fwd-keepalive/main.c | 97 +
 1 file changed, 74 insertions(+), 23 deletions(-)

diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index b7585d55e..04038711f 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -526,6 +526,18 @@ relay_core_state(void *ptr_data, const int id_core,
id_core, core_state, last_alive);
 }
 
+static void
+stop_and_close_eth_dev(uint16_t portid)
+{
+   RTE_ETH_FOREACH_DEV(portid) {
+   printf("Closing port %d...", portid);
+   rte_eth_dev_stop(portid);
+   rte_eth_dev_close(portid);
+   printf(" Done\n");
+   }
+   rte_eal_cleanup();
+}
+
 int
 main(int argc, char **argv)
 {
@@ -533,7 +545,8 @@ main(int argc, char **argv)
int ret;
uint16_t nb_ports;
uint16_t nb_ports_available = 0;
-   uint16_t portid, last_port;
+   uint16_t portid = 0;
+   uint16_t last_port;
unsigned lcore_id, rx_lcore_id;
unsigned nb_ports_in_mask = 0;
unsigned int total_nb_mbufs;
@@ -559,21 +572,28 @@ main(int argc, char **argv)
 
/* parse application arguments (after the EAL ones) */
ret = l2fwd_parse_args(argc, argv);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n");
+   }
 
nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
 
/* create the mbuf pool */
-   total_nb_mbufs = NB_MBUF_PER_PORT * nb_ports;
-
-   l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool",
-   total_nb_mbufs, 32, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
-   rte_socket_id());
-   if (l2fwd_pktmbuf_pool == NULL)
+   l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32,
+   0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
+   if (l2fwd_pktmbuf_pool == NULL) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
+   }
+
+   nb_ports = rte_eth_dev_count_avail();
+   if (nb_ports == 0) {
+   stop_and_close_eth_dev(portid);
+   rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
+   }
 
/* reset l2fwd_dst_ports */
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++)
@@ -615,8 +635,10 @@ main(int argc, char **argv)
   lcore_queue_conf[rx_lcore_id].n_rx_port ==
   l2fwd_rx_queue_per_lcore) {
rx_lcore_id++;
-   if (rx_lcore_id >= RTE_MAX_LCORE)
+   if (rx_lcore_id >= RTE_MAX_LCORE) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Not enough cores\n");
+   }
}
 
if (qconf != &lcore_queue_conf[rx_lcore_id])
@@ -648,33 +670,41 @@ main(int argc, char **argv)
fflush(stdout);
 
ret = rte_eth_dev_info_get(portid, &dev_info);
-   if (ret != 0)
+   if (ret != 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE,
"Error during getting device (port %u) info: 
%s\n",
portid, strerror(-ret));
+   }
 
if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
local_port_conf.txmode.offloads |=
DEV_TX_OFFLOAD_MBUF_FAST_FREE;
ret = rte_eth_dev_configure(portid, 1, 1, &local_port_conf);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE,
"Cannot configure device: err=%d, port=%u\n",
ret, portid);
+   }
 
ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
   &nb_txd);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE,
"Cannot adjust number of descriptors: err=%d, 
port=%u\n",
ret, portid);
+   }
 
ret = rte_eth_macaddr_get(portid,
  &l2fwd_ports_eth_a

[dpdk-dev] [PATCH 1/5] examples/l2fwd-event: free resources in case of error

2020-05-19 Thread Muhammad Bilal
Freeing the resources and call rte_eal_cleanup in case of error exit.
Signed-off-by: Muhammad Bilal 
---
 examples/l2fwd-event/main.c | 43 ++---
 1 file changed, 35 insertions(+), 8 deletions(-)

diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
index 9593ef11e..442a664e9 100644
--- a/examples/l2fwd-event/main.c
+++ b/examples/l2fwd-event/main.c
@@ -556,13 +556,26 @@ signal_handler(int signum)
}
 }
 
+static void
+stop_and_close_eth_dev(uint16_t portid)
+{
+   RTE_ETH_FOREACH_DEV(portid) {
+   printf("Closing port %d...", portid);
+   rte_eth_dev_stop(portid);
+   rte_eth_dev_close(portid);
+   printf(" Done\n");
+   }
+   rte_eal_cleanup();
+}
+
 int
 main(int argc, char **argv)
 {
struct l2fwd_resources *rsrc;
uint16_t nb_ports_available = 0;
uint32_t nb_ports_in_mask = 0;
-   uint16_t port_id, last_port;
+   uint16_t port_id = 0;
+   uint16_t last_port;
uint32_t nb_mbufs;
uint16_t nb_ports;
int i, ret;
@@ -581,20 +594,26 @@ main(int argc, char **argv)
 
/* parse application arguments (after the EAL ones) */
ret = l2fwd_event_parse_args(argc, argv, rsrc);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(port_id);
rte_panic("Invalid L2FWD arguments\n");
+   }
 
printf("MAC updating %s\n", rsrc->mac_updating ? "enabled" :
"disabled");
 
nb_ports = rte_eth_dev_count_avail();
-   if (nb_ports == 0)
+   if (nb_ports == 0) {
+   stop_and_close_eth_dev(port_id);
rte_panic("No Ethernet ports - bye\n");
+   }
 
/* check port mask to possible port mask */
-   if (rsrc->enabled_port_mask & ~((1 << nb_ports) - 1))
+   if (rsrc->enabled_port_mask & ~((1 << nb_ports) - 1)) {
+   stop_and_close_eth_dev(port_id);
rte_panic("Invalid portmask; possible (0x%x)\n",
(1 << nb_ports) - 1);
+   }
 
if (!rsrc->port_pairs) {
last_port = 0;
@@ -621,8 +640,10 @@ main(int argc, char **argv)
rsrc->dst_ports[last_port] = last_port;
}
} else {
-   if (check_port_pair_config(rsrc) < 0)
+   if (check_port_pair_config(rsrc) < 0) {
+   stop_and_close_eth_dev(port_id);
rte_panic("Invalid port pair config\n");
+   }
}
 
nb_mbufs = RTE_MAX(nb_ports * (RTE_TEST_RX_DESC_DEFAULT +
@@ -634,12 +655,16 @@ main(int argc, char **argv)
rsrc->pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool",
nb_mbufs, MEMPOOL_CACHE_SIZE, 0,
RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
-   if (rsrc->pktmbuf_pool == NULL)
+   if (rsrc->pktmbuf_pool == NULL) {
+   stop_and_close_eth_dev(port_id);
rte_panic("Cannot init mbuf pool\n");
+   }
 
nb_ports_available = l2fwd_event_init_ports(rsrc);
-   if (!nb_ports_available)
+   if (!nb_ports_available) {
+   stop_and_close_eth_dev(port_id);
rte_panic("All available ports are disabled. Please set 
portmask.\n");
+   }
 
/* Configure eventdev parameters if required */
if (rsrc->event_mode)
@@ -659,9 +684,11 @@ main(int argc, char **argv)
continue;
 
ret = rte_eth_dev_start(port_id);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(port_id);
rte_panic("rte_eth_dev_start:err=%d, port=%u\n", ret,
  port_id);
+   }
}
 
if (rsrc->event_mode)
-- 
2.17.1



[dpdk-dev] [PATCH 5/5] examples/l2fwd-crypto: free resources in case of error

2020-05-19 Thread Muhammad Bilal
Freeing the resources and call rte_eal_cleanup in case of error exit.
Signed-off-by: Muhammad Bilal 
---
 examples/l2fwd-crypto/main.c | 54 
 1 file changed, 43 insertions(+), 11 deletions(-)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index fcb55c370..169f011f8 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2660,6 +2660,18 @@ reserve_key_memory(struct l2fwd_crypto_options *options)
options->aad.phys_addr = rte_malloc_virt2iova(options->aad.data);
 }
 
+static void
+stop_and_close_eth_dev(uint16_t portid)
+{
+   RTE_ETH_FOREACH_DEV(portid) {
+   printf("Closing port %d...", portid);
+   rte_eth_dev_stop(portid);
+   rte_eth_dev_close(portid);
+   printf(" Done\n");
+   }
+   rte_eal_cleanup();
+}
+
 int
 main(int argc, char **argv)
 {
@@ -2667,7 +2679,7 @@ main(int argc, char **argv)
struct l2fwd_crypto_options options;
 
uint8_t nb_cryptodevs, cdev_id;
-   uint16_t portid;
+   uint16_t portid = 0;
unsigned lcore_id, rx_lcore_id = 0;
int ret, enabled_cdevcount, enabled_portcount;
uint8_t enabled_cdevs[RTE_CRYPTO_MAX_DEVS] = {0};
@@ -2684,8 +2696,10 @@ main(int argc, char **argv)
 
/* parse application arguments (after the EAL ones) */
ret = l2fwd_crypto_parse_args(&options, argc, argv);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Invalid L2FWD-CRYPTO arguments\n");
+   }
 
printf("MAC updating %s\n",
options.mac_updating ? "enabled" : "disabled");
@@ -2694,20 +2708,26 @@ main(int argc, char **argv)
l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 512,
sizeof(struct rte_crypto_op),
RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
-   if (l2fwd_pktmbuf_pool == NULL)
+   if (l2fwd_pktmbuf_pool == NULL) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
+   }
 
/* create crypto op pool */
l2fwd_crypto_op_pool = rte_crypto_op_pool_create("crypto_op_pool",
RTE_CRYPTO_OP_TYPE_SYMMETRIC, NB_MBUF, 128, 
MAXIMUM_IV_LENGTH,
rte_socket_id());
-   if (l2fwd_crypto_op_pool == NULL)
+   if (l2fwd_crypto_op_pool == NULL) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Cannot create crypto op pool\n");
+   }
 
/* Enable Ethernet ports */
enabled_portcount = initialize_ports(&options);
-   if (enabled_portcount < 1)
+   if (enabled_portcount < 1) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Failed to initial Ethernet ports\n");
+   }
 
/* Initialize the port/queue configuration of each logical core */
RTE_ETH_FOREACH_DEV(portid) {
@@ -2719,9 +2739,11 @@ main(int argc, char **argv)
if (options.single_lcore && qconf == NULL) {
while (rte_lcore_is_enabled(rx_lcore_id) == 0) {
rx_lcore_id++;
-   if (rx_lcore_id >= RTE_MAX_LCORE)
+   if (rx_lcore_id >= RTE_MAX_LCORE) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE,
"Not enough cores\n");
+   }
}
} else if (!options.single_lcore) {
/* get the lcore_id for this port */
@@ -2729,9 +2751,11 @@ main(int argc, char **argv)
   lcore_queue_conf[rx_lcore_id].nb_rx_ports ==
   options.nb_ports_per_lcore) {
rx_lcore_id++;
-   if (rx_lcore_id >= RTE_MAX_LCORE)
+   if (rx_lcore_id >= RTE_MAX_LCORE) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE,
"Not enough cores\n");
+   }
}
}
 
@@ -2748,13 +2772,17 @@ main(int argc, char **argv)
/* Enable Crypto devices */
enabled_cdevcount = initialize_cryptodevs(&options, enabled_portcount,
enabled_cdevs);
-   if (enabled_cdevcount < 0)
+   if (enabled_cdevcount < 0) {
+   stop_and_close_eth_

[dpdk-dev] [PATCH 4/5] examples/l2fwd-cat: free resources in case of error

2020-05-19 Thread Muhammad Bilal
Freeing the resources and call rte_eal_cleanup in case of error exit.
Signed-off-by: Muhammad Bilal 
---
 examples/l2fwd-cat/l2fwd-cat.c | 32 ++--
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c
index 45a497c08..06eeae9ae 100644
--- a/examples/l2fwd-cat/l2fwd-cat.c
+++ b/examples/l2fwd-cat/l2fwd-cat.c
@@ -147,6 +147,18 @@ lcore_main(void)
}
 }
 
+static void
+stop_and_close_eth_dev(uint16_t portid)
+{
+   RTE_ETH_FOREACH_DEV(portid) {
+   printf("Closing port %d...", portid);
+   rte_eth_dev_stop(portid);
+   rte_eth_dev_close(portid);
+   printf(" Done\n");
+   }
+   rte_eal_cleanup();
+}
+
 /*
  * The main function, which does initialization and calls the per-lcore
  * functions.
@@ -156,7 +168,7 @@ main(int argc, char *argv[])
 {
struct rte_mempool *mbuf_pool;
unsigned nb_ports;
-   uint16_t portid;
+   uint16_t portid = 0;
 
/* Initialize the Environment Abstraction Layer (EAL). */
int ret = rte_eal_init(argc, argv);
@@ -171,30 +183,38 @@ main(int argc, char *argv[])
 * Please see l2fwd-cat documentation for more info.
 */
ret = cat_init(argc, argv);
-   if (ret < 0)
+   if (ret < 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "PQOS: L3CA init failed!\n");
+   }
 
argc -= ret;
argv += ret;
 
/* Check that there is an even number of ports to send/receive on. */
nb_ports = rte_eth_dev_count_avail();
-   if (nb_ports < 2 || (nb_ports & 1))
+   if (nb_ports < 2 || (nb_ports & 1)) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");
+   }
 
/* Creates a new mempool in memory to hold the mbufs. */
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports,
MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
 
-   if (mbuf_pool == NULL)
+   if (mbuf_pool == NULL) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
+   }
 
/* Initialize all ports. */
RTE_ETH_FOREACH_DEV(portid)
-   if (port_init(portid, mbuf_pool) != 0)
+   if (port_init(portid, mbuf_pool) != 0) {
+   stop_and_close_eth_dev(portid);
rte_exit(EXIT_FAILURE, "Cannot init port %"PRIu16 "\n",
portid);
-
+   }
+
if (rte_lcore_count() > 1)
printf("\nWARNING: Too many lcores enabled. Only 1 used.\n");
 
-- 
2.17.1



[dpdk-dev] Which tests are compulsory to PASS for Patch to be accepted

2020-05-27 Thread Muhammad Bilal
Recently I have submitted patches and some tests were failing on patchwork.
My question is, which tests are compulsory to pass for a patch to be accepted.
As in the below mentioned patch, it is accepted while 1 test was still failing.
http://patches.dpdk.org/patch/70348/

kind regards.
Muhammad Bilal


[dpdk-dev] [PATCH] doc: removed typing mistake

2020-05-29 Thread Muhammad Bilal
There was a duplicate command instruction in the documentation of memif
so I have removed the 1 command from it.

Fixes: cd3365d2 ("net/memif: enable loopback")
Cc: jmilan@gmail.com

Signed-off-by: Muhammad Bilal 
---
 doc/guides/nics/memif.rst | 1 -
 1 file changed, 1 deletion(-)

diff --git a/doc/guides/nics/memif.rst b/doc/guides/nics/memif.rst
index 08a9fda86..ddeebed25 100644
--- a/doc/guides/nics/memif.rst
+++ b/doc/guides/nics/memif.rst
@@ -289,4 +289,3 @@ Then start the communication::
 Finally we can check port stats to see the traffic::
 
 testpmd> show port stats all
-testpmd> show port stats all
-- 
2.17.1



Re: [dpdk-dev] Which tests are compulsory to PASS for Patch to be accepted

2020-06-02 Thread Muhammad Bilal
Thank you for your response.
How will we know if a patch is failing because of some failure in the
CI infrastructure or due to earlier merge?


On Thu, May 28, 2020 at 1:59 AM Stephen Hemminger
 wrote:
>
> On Thu, 28 May 2020 01:13:27 +0500
> Muhammad Bilal  wrote:
>
> > Recently I have submitted patches and some tests were failing on patchwork.
> > My question is, which tests are compulsory to pass for a patch to be 
> > accepted.
> > As in the below mentioned patch, it is accepted while 1 test was still 
> > failing.
> > http://patches.dpdk.org/patch/70348/
> >
> > kind regards.
> > Muhammad Bilal
>
> There are two different issues:
>   1. A patch should not get blamed for some failure in the CI infrastructure.
>  Or collataral damage from an earlier merge.
>   2. A patch must not introduce a failure. I.e. if all tests passed before
>  each patch in a patchset must pass.


Re: [dpdk-dev] [EXT] [PATCH 1/5] examples/l2fwd-event: free resources in case of error

2020-06-02 Thread Muhammad Bilal
On Tue, May 19, 2020 at 2:35 PM Sunil Kumar Kori  wrote:
>
> >-Original Message-
> >From: Muhammad Bilal 
> >Sent: Tuesday, May 19, 2020 2:25 PM
> >To: declan.dohe...@intel.com; tomasz.kante...@intel.com; Pavan Nikhilesh
> >Bhagavatula ; Sunil Kumar Kori
> >
> >Cc: dev@dpdk.org; Muhammad Bilal 
> >Subject: [EXT] [PATCH 1/5] examples/l2fwd-event: free resources in case of
> >error
> >
> >External Email
> >
> >--
> >Freeing the resources and call rte_eal_cleanup in case of error exit.
> >Signed-off-by: Muhammad Bilal 
> >---
> > examples/l2fwd-event/main.c | 43 ++---
> > 1 file changed, 35 insertions(+), 8 deletions(-)
> >
> >diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
> >index 9593ef11e..442a664e9 100644
> >--- a/examples/l2fwd-event/main.c
> >+++ b/examples/l2fwd-event/main.c
> >@@ -556,13 +556,26 @@ signal_handler(int signum)
> >   }
> > }
> >
> >+static void
> >+stop_and_close_eth_dev(uint16_t portid) {
> >+  RTE_ETH_FOREACH_DEV(portid) {
> >+  printf("Closing port %d...", portid);
> >+  rte_eth_dev_stop(portid);
> >+  rte_eth_dev_close(portid);
> >+  printf(" Done\n");
> >+  }
> >+  rte_eal_cleanup();
> >+}
> >+
> > int
> > main(int argc, char **argv)
> > {
> >   struct l2fwd_resources *rsrc;
> >   uint16_t nb_ports_available = 0;
> >   uint32_t nb_ports_in_mask = 0;
> >-  uint16_t port_id, last_port;
> >+  uint16_t port_id = 0;
> >+  uint16_t last_port;
> >   uint32_t nb_mbufs;
> >   uint16_t nb_ports;
> >   int i, ret;
> >@@ -581,20 +594,26 @@ main(int argc, char **argv)
> >
> >   /* parse application arguments (after the EAL ones) */
> >   ret = l2fwd_event_parse_args(argc, argv, rsrc);
> >-  if (ret < 0)
> >+  if (ret < 0) {
> >+  stop_and_close_eth_dev(port_id);
> >   rte_panic("Invalid L2FWD arguments\n");
> >+  }
> >
Yes you are right we should use rte_exit instead of rte_panic, as
rte_exit internally calls rte_eal_cleanup function.
> IMO, up to this point only eal_init is done so rte_eal_cleanup will be 
> sufficient for this.
> Also another way to handle this, use rte_exit instead rte_panic. rte_exit 
> internally calls
> rte_eal_cleanup. Refer l2fwd.
>
> Also I think, it is better to release the relevant resources on error.
Here I'm solving the problem reported in bugzilla id 437. The bug was
that if we use --vdev=net_memif with l2fwd application (and with its
other variants) then a socket is created by memif PMD, after
rte_eal_init function has run successfully. And if an error occurs
then the application exits without freeing the resources (socket). On
running the application 2nd time we get an error of "socket already
exists".
As in the previous version of patch "
http://patches.dpdk.org/patch/70081/ " it was recommended to clean the
resources when an error occurs.

Here only using rte_eal_cleanup() is not solving the problem as using
memif PMD is creating a socket and it's only cleaned when
rte_eth_dev_close(portid) function is called. so that's why using it
along with rte_exit or rte_panic.
>
> >   printf("MAC updating %s\n", rsrc->mac_updating ? "enabled" :
> >   "disabled");
> >
> >   nb_ports = rte_eth_dev_count_avail();
> >-  if (nb_ports == 0)
> >+  if (nb_ports == 0) {
> >+  stop_and_close_eth_dev(port_id);
> >   rte_panic("No Ethernet ports - bye\n");
> >+  }
> >
> Same as above.
>
> >   /* check port mask to possible port mask */
> >-  if (rsrc->enabled_port_mask & ~((1 << nb_ports) - 1))
> >+  if (rsrc->enabled_port_mask & ~((1 << nb_ports) - 1)) {
> >+  stop_and_close_eth_dev(port_id);
> >   rte_panic("Invalid portmask; possible (0x%x)\n",
> >   (1 << nb_ports) - 1);
> >+  }
> >
> Same as above.
>
> >   if (!rsrc->port_pairs) {
> >   last_port = 0;
> >@@ -621,8 +640,10 @@ main(int argc, char **argv)
> >   rsrc->dst_ports[last_port] = last_port;
> >   }
> >   } else {
> >-  if (check_port_pair_config(rsrc) < 0)
> &g

Re: [dpdk-dev] [PATCH v2] examples/l2fwd: free resources in case of error

2020-06-05 Thread Muhammad Bilal
Is there anything else to be done for acceptance? So that this problem
can be removed from other examples.

On Tue, May 12, 2020 at 6:57 PM Muhammad Bilal  wrote:
>
> Bugzilla ID: 437
> Cc: dev@dpdk.org
> Cc: sta...@dpdk.org
> Cc: bruce.richard...@intel.com
> Cc: vipin.vargh...@intel.com
> Cc: jgraj...@cisco.com
> Signed-off-by: Muhammad Bilal 
> ---
>  examples/l2fwd/main.c | 76 ++-
>  1 file changed, 60 insertions(+), 16 deletions(-)
>
> diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
> index 88ddfe589..efea2dce3 100644
> --- a/examples/l2fwd/main.c
> +++ b/examples/l2fwd/main.c
> @@ -517,6 +517,18 @@ signal_handler(int signum)
> }
>  }
>
> +static void
> +stop_and_close_eth_dev(uint16_t portid)
> +{
> +   RTE_ETH_FOREACH_DEV(portid) {
> +   printf("Closing port %d...", portid);
> +   rte_eth_dev_stop(portid);
> +   rte_eth_dev_close(portid);
> +   printf(" Done\n");
> +   rte_eal_cleanup();
> +   }
> +}
> +
>  int
>  main(int argc, char **argv)
>  {
> @@ -524,7 +536,8 @@ main(int argc, char **argv)
> int ret;
> uint16_t nb_ports;
> uint16_t nb_ports_available = 0;
> -   uint16_t portid, last_port;
> +   uint16_t portid = 0;
> +   uint16_t last_port;
> unsigned lcore_id, rx_lcore_id;
> unsigned nb_ports_in_mask = 0;
> unsigned int nb_lcores = 0;
> @@ -543,8 +556,10 @@ main(int argc, char **argv)
>
> /* parse application arguments (after the EAL ones) */
> ret = l2fwd_parse_args(argc, argv);
> -   if (ret < 0)
> +   if (ret < 0) {
> +   stop_and_close_eth_dev(portid);
> rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n");
> +   }
>
> printf("MAC updating %s\n", mac_updating ? "enabled" : "disabled");
>
> @@ -552,13 +567,17 @@ main(int argc, char **argv)
> timer_period *= rte_get_timer_hz();
>
> nb_ports = rte_eth_dev_count_avail();
> -   if (nb_ports == 0)
> +   if (nb_ports == 0) {
> +   stop_and_close_eth_dev(portid);
> rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
> +   }
>
> /* check port mask to possible port mask */
> -   if (l2fwd_enabled_port_mask & ~((1 << nb_ports) - 1))
> +   if (l2fwd_enabled_port_mask & ~((1 << nb_ports) - 1)) {
> +   stop_and_close_eth_dev(portid);
> rte_exit(EXIT_FAILURE, "Invalid portmask; possible (0x%x)\n",
> (1 << nb_ports) - 1);
> +   }
>
> /* reset l2fwd_dst_ports */
> for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++)
> @@ -601,8 +620,10 @@ main(int argc, char **argv)
>lcore_queue_conf[rx_lcore_id].n_rx_port ==
>l2fwd_rx_queue_per_lcore) {
> rx_lcore_id++;
> -   if (rx_lcore_id >= RTE_MAX_LCORE)
> +   if (rx_lcore_id >= RTE_MAX_LCORE) {
> +   stop_and_close_eth_dev(portid);
> rte_exit(EXIT_FAILURE, "Not enough cores\n");
> +   }
> }
>
> if (qconf != &lcore_queue_conf[rx_lcore_id]) {
> @@ -623,8 +644,10 @@ main(int argc, char **argv)
> l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", nb_mbufs,
> MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
> rte_socket_id());
> -   if (l2fwd_pktmbuf_pool == NULL)
> +   if (l2fwd_pktmbuf_pool == NULL) {
> +   stop_and_close_eth_dev(portid);
> rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
> +   }
>
> /* Initialise each port */
> RTE_ETH_FOREACH_DEV(portid) {
> @@ -645,32 +668,40 @@ main(int argc, char **argv)
> fflush(stdout);
>
> ret = rte_eth_dev_info_get(portid, &dev_info);
> -   if (ret != 0)
> +   if (ret != 0) {
> +   stop_and_close_eth_dev(portid);
> rte_exit(EXIT_FAILURE,
> "Error during getting device (port %u) info: 
> %s\n",
> portid, strerror(-ret));
> +   }
>
> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
> local_port_conf.txmode

[dpdk-dev] [PATCH] Nonnumeric input check for Setting hugepages

2020-04-06 Thread Muhammad Bilal
Bugzilla ID: 432
Cc: dev@dpdk.org
Cc: sta...@dpdk.org
Cc: john.mcnam...@intel.com
Signed-off-by: Muhammad Bilal 
---
 usertools/dpdk-setup.sh | 23 ++-
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/usertools/dpdk-setup.sh b/usertools/dpdk-setup.sh
index e5bbe9fee..b0535be34 100755
--- a/usertools/dpdk-setup.sh
+++ b/usertools/dpdk-setup.sh
@@ -321,13 +321,19 @@ set_non_numa_pages()
echo -n "Number of pages: "
read Pages
 
-   echo "echo $Pages > 
/sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" > .echo_tmp
 
-   echo "Reserving hugepages"
-   sudo sh .echo_tmp
-   rm -f .echo_tmp
+   numeric="^[[:digit:]]+$"
+   PG_PATH="/sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}"
+   if [[ $Pages =~ $numeric ]]; then
+   echo "echo $Pages > $PG_PATH/nr_hugepages" > .echo_tmp
+   echo "Reserving hugepages"
+   sudo sh .echo_tmp
+   rm -f .echo_tmp
 
-   create_mnt_huge
+   create_mnt_huge
+   else
+   echo "Please enter a numeric value"
+   fi
 }
 
 #
@@ -343,10 +349,17 @@ set_numa_pages()
echo "  enter '64' to reserve 64 * 2MB pages on each node"
 
echo > .echo_tmp
+   numeric="^[[:digit:]]+$"
for d in /sys/devices/system/node/node? ; do
node=$(basename $d)
echo -n "Number of pages for $node: "
read Pages
+   while [[ ! "$Pages" =~ $numeric ]]; do
+   echo "Please enter a numeric value"
+   echo -n "Number of pages for $node: "
+   read Pages
+   done
+
echo "echo $Pages > 
$d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp
done
echo "Reserving hugepages"
-- 
2.17.1



[dpdk-dev] [PATCH] putting null checks on ops_name

2020-04-06 Thread Muhammad Bilal
Bugzilla ID: 353
Cc: dev@dpdk.org
Cc: sta...@dpdk.org
Cc: hemant.agra...@nxp.com
Signed-off-by: Muhammad Bilal 
---
 lib/librte_mbuf/rte_mbuf_pool_ops.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.c 
b/lib/librte_mbuf/rte_mbuf_pool_ops.c
index 5722976fe..c3ddfc0bd 100644
--- a/lib/librte_mbuf/rte_mbuf_pool_ops.c
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c
@@ -13,7 +13,8 @@ int
 rte_mbuf_set_platform_mempool_ops(const char *ops_name)
 {
const struct rte_memzone *mz;
-
+   if (strlen(ops_name) == 0)
+   return -1;
if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
return -ENAMETOOLONG;
 
@@ -50,7 +51,8 @@ int
 rte_mbuf_set_user_mempool_ops(const char *ops_name)
 {
const struct rte_memzone *mz;
-
+   if (strlen(ops_name) == 0)
+   return -1;
if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
return -ENAMETOOLONG;
 
-- 
2.17.1



[dpdk-dev] [PATCH v2] putting null checks on ops_name

2020-04-07 Thread Muhammad Bilal
Bugzilla ID: 353
Cc: dev@dpdk.org
Cc: sta...@dpdk.org
Cc: hemant.agra...@nxp.com
Signed-off-by: Muhammad Bilal 
---
 lib/librte_mbuf/rte_mbuf_pool_ops.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.c 
b/lib/librte_mbuf/rte_mbuf_pool_ops.c
index 5722976fe..00186aa15 100644
--- a/lib/librte_mbuf/rte_mbuf_pool_ops.c
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c
@@ -13,8 +13,10 @@ int
 rte_mbuf_set_platform_mempool_ops(const char *ops_name)
 {
const struct rte_memzone *mz;
-
-   if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+   size_t len = strnlen(ops_name, RTE_MEMPOOL_OPS_NAMESIZE);
+   if (len == 0)
+   return -EINVAL;
+   if (len == RTE_MEMPOOL_OPS_NAMESIZE)
return -ENAMETOOLONG;
 
mz = rte_memzone_lookup("mbuf_platform_pool_ops");
@@ -50,8 +52,10 @@ int
 rte_mbuf_set_user_mempool_ops(const char *ops_name)
 {
const struct rte_memzone *mz;
-
-   if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+   size_t len = strnlen(ops_name, RTE_MEMPOOL_OPS_NAMESIZE);
+   if (len == 0)
+   return -EINVAL;
+   if (len == RTE_MEMPOOL_OPS_NAMESIZE)
return -ENAMETOOLONG;
 
mz = rte_memzone_lookup("mbuf_user_pool_ops");
-- 
2.17.1



[dpdk-dev] First the test fail and than get passed

2020-04-08 Thread Muhammad Bilal
About 2 days ago, I submitted a patch for a Bug 353. And I saw that
"iol-testing" failed on patchwork for "openSUSE" Environment. Today I
checked and it shows all the tests are passed [
http://mails.dpdk.org/archives/test-report/2020-April/124201.html]. Is this
normal that first the test fail and than get passed?

Patch address : http://patches.dpdk.org/patch/67893/
Bugzilla ID: 353

Thanks,
Muhammad Bilal


[dpdk-dev] Compilation failed for Patches intended for previous releases

2020-04-13 Thread Muhammad Bilal
About 2 weeks ago, I submitted a patch for a Bug 364, Intended for
18.11 branch. The compilation on patchwork failed, whereas it is
compiled successfully on my local system. I think this might have
happened because Patch was tested on a Master branch instead of an
18.11 branch.
My question is how should we submit a patch for the 18.11 branch.

Patch  address = http://patches.dpdk.org/patch/66978/
Bugzilla ID: 364

Regards,
Muhammad Bilal


Re: [dpdk-dev] [EXT] [PATCH 1/5] examples/l2fwd-event: free resources in case of error

2020-06-15 Thread Muhammad Bilal
On Wed, Jun 10, 2020 at 3:01 PM Sunil Kumar Kori  wrote:
>
> >-Original Message-
> >From: Muhammad Bilal 
> >Sent: Tuesday, June 2, 2020 5:57 PM
> >To: Sunil Kumar Kori 
> >Cc: declan.dohe...@intel.com; tomasz.kante...@intel.com; Pavan Nikhilesh
> >Bhagavatula ; dev@dpdk.org;
> >jgraj...@cisco.com; vipin.vargh...@intel.com
> >Subject: Re: [EXT] [PATCH 1/5] examples/l2fwd-event: free resources in case
> >of error
> >
> >On Tue, May 19, 2020 at 2:35 PM Sunil Kumar Kori 
> >wrote:
> >>
> >> >-Original Message-
> >> >From: Muhammad Bilal 
> >> >Sent: Tuesday, May 19, 2020 2:25 PM
> >> >To: declan.dohe...@intel.com; tomasz.kante...@intel.com; Pavan
> >> >Nikhilesh Bhagavatula ; Sunil Kumar Kori
> >> >
> >> >Cc: dev@dpdk.org; Muhammad Bilal 
> >> >Subject: [EXT] [PATCH 1/5] examples/l2fwd-event: free resources in
> >> >case of error
> >> >
> >> >External Email
> >> >
> >> >-
> >> >- Freeing the resources and call rte_eal_cleanup in case of error
> >> >exit.
> >> >Signed-off-by: Muhammad Bilal 
> >> >---
> >> > examples/l2fwd-event/main.c | 43
> >> >++---
> >> > 1 file changed, 35 insertions(+), 8 deletions(-)
> >> >
> >> >diff --git a/examples/l2fwd-event/main.c
> >> >b/examples/l2fwd-event/main.c index 9593ef11e..442a664e9 100644
> >> >--- a/examples/l2fwd-event/main.c
> >> >+++ b/examples/l2fwd-event/main.c
> >> >@@ -556,13 +556,26 @@ signal_handler(int signum)
> >> >   }
> >> > }
> >> >
> >> >+static void
> >> >+stop_and_close_eth_dev(uint16_t portid) {
> >> >+  RTE_ETH_FOREACH_DEV(portid) {
> >> >+  printf("Closing port %d...", portid);
> >> >+  rte_eth_dev_stop(portid);
> >> >+  rte_eth_dev_close(portid);
> >> >+  printf(" Done\n");
> >> >+  }
> >> >+  rte_eal_cleanup();
> >> >+}
> >> >+
> >> > int
> >> > main(int argc, char **argv)
> >> > {
> >> >   struct l2fwd_resources *rsrc;
> >> >   uint16_t nb_ports_available = 0;
> >> >   uint32_t nb_ports_in_mask = 0;
> >> >-  uint16_t port_id, last_port;
> >> >+  uint16_t port_id = 0;
> >> >+  uint16_t last_port;
> >> >   uint32_t nb_mbufs;
> >> >   uint16_t nb_ports;
> >> >   int i, ret;
> >> >@@ -581,20 +594,26 @@ main(int argc, char **argv)
> >> >
> >> >   /* parse application arguments (after the EAL ones) */
> >> >   ret = l2fwd_event_parse_args(argc, argv, rsrc);
> >> >-  if (ret < 0)
> >> >+  if (ret < 0) {
> >> >+  stop_and_close_eth_dev(port_id);
> >> >   rte_panic("Invalid L2FWD arguments\n");
> >> >+  }
> >> >
> >Yes you are right we should use rte_exit instead of rte_panic, as rte_exit
> >internally calls rte_eal_cleanup function.
> >> IMO, up to this point only eal_init is done so rte_eal_cleanup will be
> >sufficient for this.
> >> Also another way to handle this, use rte_exit instead rte_panic.
> >> rte_exit internally calls rte_eal_cleanup. Refer l2fwd.
> >>
> >> Also I think, it is better to release the relevant resources on error.
> >Here I'm solving the problem reported in bugzilla id 437. The bug was that if
> >we use --vdev=net_memif with l2fwd application (and with its other variants)
> >then a socket is created by memif PMD, after rte_eal_init function has run
> >successfully. And if an error occurs then the application exits without 
> >freeing
> >the resources (socket). On running the application 2nd time we get an error 
> >of
> >"socket already exists".
> >As in the previous version of patch "
> >https://urldefense.proofpoint.com/v2/url?u=http-
> >3A__patches.dpdk.org_patch_70081_&d=DwIBaQ&c=nKjWec2b6R0mOyPaz7x
> >tfQ&r=dXeXaAMkP5COgn1zxHMyaF1_d9IIuq6vHQO6NrIPjaE&m=XKcRI2e7sMv
> >Y0nGabnBQl_Q8meL03FXFAjeNGdCV91A&s=TKq1J0W3QbnkeuG4c63payDWc
> >Pc4zTg4DumA95RVzwg&e=  " it was recommended to clean the resources
> >when an error occurs

Re: [dpdk-dev] [EXT] [PATCH 1/5] examples/l2fwd-event: free resources in case of error

2020-06-16 Thread Muhammad Bilal
On Tue, Jun 16, 2020 at 10:53 AM Sunil Kumar Kori  wrote:
>
> >-Original Message-
> >From: Muhammad Bilal 
> >Sent: Monday, June 15, 2020 5:30 PM
> >To: Sunil Kumar Kori 
> >Cc: declan.dohe...@intel.com; tomasz.kante...@intel.com; Pavan Nikhilesh
> >Bhagavatula ; dev@dpdk.org;
> >jgraj...@cisco.com; vipin.vargh...@intel.com
> >Subject: Re: [EXT] [PATCH 1/5] examples/l2fwd-event: free resources in case
> >of error
> >
> >On Wed, Jun 10, 2020 at 3:01 PM Sunil Kumar Kori 
> >wrote:
> >>
> >> >-Original Message-
> >> >From: Muhammad Bilal 
> >> >Sent: Tuesday, June 2, 2020 5:57 PM
> >> >To: Sunil Kumar Kori 
> >> >Cc: declan.dohe...@intel.com; tomasz.kante...@intel.com; Pavan
> >> >Nikhilesh Bhagavatula ; dev@dpdk.org;
> >> >jgraj...@cisco.com; vipin.vargh...@intel.com
> >> >Subject: Re: [EXT] [PATCH 1/5] examples/l2fwd-event: free resources
> >> >in case of error
> >> >
> >> >On Tue, May 19, 2020 at 2:35 PM Sunil Kumar Kori 
> >> >wrote:
> >> >>
> >> >> >-Original Message-
> >> >> >From: Muhammad Bilal 
> >> >> >Sent: Tuesday, May 19, 2020 2:25 PM
> >> >> >To: declan.dohe...@intel.com; tomasz.kante...@intel.com; Pavan
> >> >> >Nikhilesh Bhagavatula ; Sunil Kumar Kori
> >> >> >
> >> >> >Cc: dev@dpdk.org; Muhammad Bilal 
> >> >> >Subject: [EXT] [PATCH 1/5] examples/l2fwd-event: free resources in
> >> >> >case of error
> >> >> >
> >> >> >External Email
> >> >> >
> >> >> >--
> >> >> >---
> >> >> >- Freeing the resources and call rte_eal_cleanup in case of error
> >> >> >exit.
> >> >> >Signed-off-by: Muhammad Bilal 
> >> >> >---
> >> >> > examples/l2fwd-event/main.c | 43
> >> >> >++---
> >> >> > 1 file changed, 35 insertions(+), 8 deletions(-)
> >> >> >
> >> >> >diff --git a/examples/l2fwd-event/main.c
> >> >> >b/examples/l2fwd-event/main.c index 9593ef11e..442a664e9 100644
> >> >> >--- a/examples/l2fwd-event/main.c
> >> >> >+++ b/examples/l2fwd-event/main.c
> >> >> >@@ -556,13 +556,26 @@ signal_handler(int signum)
> >> >> >   }
> >> >> > }
> >> >> >
> >> >> >+static void
> >> >> >+stop_and_close_eth_dev(uint16_t portid) {
> >> >> >+  RTE_ETH_FOREACH_DEV(portid) {
> >> >> >+  printf("Closing port %d...", portid);
> >> >> >+  rte_eth_dev_stop(portid);
> >> >> >+  rte_eth_dev_close(portid);
> >> >> >+  printf(" Done\n");
> >> >> >+  }
> >> >> >+  rte_eal_cleanup();
> >> >> >+}
> >> >> >+
> >> >> > int
> >> >> > main(int argc, char **argv)
> >> >> > {
> >> >> >   struct l2fwd_resources *rsrc;
> >> >> >   uint16_t nb_ports_available = 0;
> >> >> >   uint32_t nb_ports_in_mask = 0;
> >> >> >-  uint16_t port_id, last_port;
> >> >> >+  uint16_t port_id = 0;
> >> >> >+  uint16_t last_port;
> >> >> >   uint32_t nb_mbufs;
> >> >> >   uint16_t nb_ports;
> >> >> >   int i, ret;
> >> >> >@@ -581,20 +594,26 @@ main(int argc, char **argv)
> >> >> >
> >> >> >   /* parse application arguments (after the EAL ones) */
> >> >> >   ret = l2fwd_event_parse_args(argc, argv, rsrc);
> >> >> >-  if (ret < 0)
> >> >> >+  if (ret < 0) {
> >> >> >+  stop_and_close_eth_dev(port_id);
> >> >> >   rte_panic("Invalid L2FWD arguments\n");
> >> >> >+  }
> >> >> >
> >> >Yes you are right we should use rte_exit instead of rte_panic, as
> >> >rte_exit internally calls rte_eal_cleanup function.
> >> >> IMO, up to this point only eal_init is done so rte_eal_cleanup wi

[dpdk-dev] When .remove function (of struct rte_vdev_driver) is called

2020-06-21 Thread Muhammad Bilal
While working on applications(l2fwd, testpmd) with PMD(memif, Tun|Tap
and some other) I have noticed that the .probe function of
rte_vdev_driver structure is called in rte_eal_init() and .remove
function of rte_vdev_driver structure is NEVER called, even after
exiting the application.

My Question is How/When .remove function of rte_vdev_driver structure is called.

Thanks,
M. Bilal


Re: [dpdk-dev] When .remove function (of struct rte_vdev_driver) is called

2020-06-21 Thread Muhammad Bilal
Yes, I have used the rte_eal_cleanup() function when application
exits. And still it does not call the .remove function of
rte_vdev_driver structure, used in PMD.

On Sun, Jun 21, 2020 at 11:11 PM Stephen Hemminger
 wrote:
>
> On Sun, 21 Jun 2020 18:17:09 +0500
> Muhammad Bilal  wrote:
>
> > While working on applications(l2fwd, testpmd) with PMD(memif, Tun|Tap
> > and some other) I have noticed that the .probe function of
> > rte_vdev_driver structure is called in rte_eal_init() and .remove
> > function of rte_vdev_driver structure is NEVER called, even after
> > exiting the application.
> >
> > My Question is How/When .remove function of rte_vdev_driver structure is 
> > called.
> >
> > Thanks,
> > M. Bilal
>
> Does application call rte_eal_cleanup on exit?


[dpdk-dev] [PATCH] drivers/bus/vdev: corrected a typing error in header file

2020-06-23 Thread Muhammad Bilal
Here I have corrected a potential typing mistake in header file.
while Uninitalizing the driver the comment was mentioning 
initializing instead of Uninitalizing in despription of parameter

Fixes: d4a586d29e65 ("bus/vdev: move code from EAL into a new driver")
Cc: jianfeng@intel.com

Signed-off-by: Muhammad Bilal 
---
 drivers/bus/vdev/rte_bus_vdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/vdev/rte_bus_vdev.h b/drivers/bus/vdev/rte_bus_vdev.h
index 2bc46530c..78a032cea 100644
--- a/drivers/bus/vdev/rte_bus_vdev.h
+++ b/drivers/bus/vdev/rte_bus_vdev.h
@@ -155,7 +155,7 @@ int rte_vdev_init(const char *name, const char *args);
  * Uninitalize a driver specified by name.
  *
  * @param name
- *   The pointer to a driver name to be initialized.
+ *   The pointer to a driver name to be uninitialized.
  * @return
  *  0 on success, negative on error
  */
-- 
2.25.1



[dpdk-dev] [PATCH v2 18.11 17.11] doc: in doc-clean removed the folder not containing rst files

2020-03-20 Thread Muhammad Bilal
in doc-clean removing the folder which contain
the text files and no .rst files,
they cause problem When switching branches and compiling
the documentation for older releases (for example 
building a documentation on 18.11 or 17.11, with a
documentation on master branch, built before.

Bugzilla ID: 364
Cc: Thomas Monjalon 
Cc: John McNamara 
Cc: M: Luca Boccassi 
Cc: dev@dpdk.org
Cc: sta...@dpdk.org
Signed-off-by: Muhammad Bilal 
---
v2:
* Added Details of branches for which patch is used.
* This patch is intended for v18.11 and v17.11 branches

 mk/rte.sdkdoc.mk | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mk/rte.sdkdoc.mk b/mk/rte.sdkdoc.mk
index c44db6447..a80250ce8 100644
--- a/mk/rte.sdkdoc.mk
+++ b/mk/rte.sdkdoc.mk
@@ -37,7 +37,7 @@ help:
 all: api-html guides-html guides-pdf
 
 .PHONY: clean
-clean: api-html-clean guides-html-clean guides-pdf-clean guides-man-clean
+clean: api-html-clean guides-html-clean guides-pdf-clean guides-man-clean 
guide-table-clean
 
 .PHONY: api-html
 api-html: $(API_EXAMPLES)
@@ -56,7 +56,7 @@ api-html: $(API_EXAMPLES)
 .PHONY: api-html-clean
 api-html-clean:
$(Q)rm -f $(API_EXAMPLES)
-   $(Q)rm -f $(RTE_OUTPUT)/doc/html/api/*
+   $(Q)rm -rf $(RTE_OUTPUT)/doc/html/api/*
$(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/html/api 2>&- 
|| true
 
 $(API_EXAMPLES): api-html-clean
@@ -67,6 +67,10 @@ guides-pdf-clean: guides-pdf-img-clean
 guides-pdf-img-clean:
$(Q)rm -f $(RTE_SDK)/doc/guides/*/img/*.pdf
 
+guide-table-clean: guide-overview_feature_table-clean
+guide-overview_feature_table-clean:
+   $(Q)rm -rf $(shell find $(RTE_SDK)/doc/guides/ -maxdepth 1 -type d '!' 
-exec test -e "{}/index.rst" ';' -print)
+
 guides-%-clean:
$(Q)rm -rf $(RTE_OUTPUT)/doc/$*/guides
$(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/$* 2>&- || 
true
-- 
2.17.1



Re: [dpdk-dev] [PATCH v2 18.11 17.11] doc: in doc-clean removed the folder not containing rst files

2020-03-20 Thread Muhammad Bilal
On Fri, Mar 20, 2020 at 2:39 PM Luca Boccassi  wrote:
>
> On Fri, 2020-03-20 at 13:02 +0500, Muhammad Bilal wrote:
> > in doc-clean removing the folder which contain
> > the text files and no .rst files,
> > they cause problem When switching branches and compiling
> > the documentation for older releases (for example
> > building a documentation on 18.11 or 17.11, with a
> > documentation on master branch, built before.
> >
> > Bugzilla ID: 364
> > Cc: Thomas Monjalon 
> > Cc: John McNamara 
> > Cc: M: Luca Boccassi 
> > Cc: dev@dpdk.org
> > Cc: sta...@dpdk.org
> > Signed-off-by: Muhammad Bilal 
> > ---
> > v2:
> > * Added Details of branches for which patch is used.
> > * This patch is intended for v18.11 and v17.11 branches
>
> Thanks for the patch, but 17.11 is EOL and will no longer receive
> updates.
>
This bug also occurs on 18.11
So this patch is also valid for 18.11.
> --
> Kind regards,
> Muhammad Bilal


Re: [dpdk-dev] [dpdk-stable] [PATCH v2 18.11 17.11] doc: in doc-clean removed the folder not containing rst files

2020-03-24 Thread Muhammad Bilal
On Fri, Mar 20, 2020 at 3:02 PM Kevin Traynor  wrote:
>
> On 20/03/2020 09:53, Muhammad Bilal wrote:
> > On Fri, Mar 20, 2020 at 2:39 PM Luca Boccassi  wrote:
> >>
> >> On Fri, 2020-03-20 at 13:02 +0500, Muhammad Bilal wrote:
> >>> in doc-clean removing the folder which contain
> >>> the text files and no .rst files,
> >>> they cause problem When switching branches and compiling
> >>> the documentation for older releases (for example
> >>> building a documentation on 18.11 or 17.11, with a
> >>> documentation on master branch, built before.
> >>>
> >>> Bugzilla ID: 364
> >>> Cc: Thomas Monjalon 
> >>> Cc: John McNamara 
> >>> Cc: M: Luca Boccassi 
> >>> Cc: dev@dpdk.org
> >>> Cc: sta...@dpdk.org
> >>> Signed-off-by: Muhammad Bilal 
> >>> ---
> >>> v2:
> >>> * Added Details of branches for which patch is used.
> >>> * This patch is intended for v18.11 and v17.11 branches
> >>
> >> Thanks for the patch, but 17.11 is EOL and will no longer receive
> >> updates.
> >>
> > This bug also occurs on 18.11
> > So this patch is also valid for 18.11.
>
>No, This patch is not for dpdk master, it is intended only for 18.11 branch
>when we switch to 18.11 branch (after making documentation in master or newer 
>branch ) an error occurs in making documentation on 18.11 branch.
>So This patch is intended to solve this problem.
> >> --
> >> Kind regards,
> >> Muhammad Bilal
> >
>


[dpdk-dev] [PATCH] doc/guides/contributing/patches.rst: corrected typing mistake in line 185

2020-03-25 Thread Muhammad Bilal
Bugzilla ID: 422
Cc: marko.kovace...@intel.com
Cc: john.mcnam...@intel.com
Cc: dev@dpdk.org
Cc: sta...@dpdk.org
Signed-off-by: Muhammad Bilal 
---
 doc/guides/contributing/patches.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index 59442824a..1fc96b733 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -182,7 +182,7 @@ A good way of thinking about whether a patch should be 
split is to consider whet
 applied without dependencies as a backport.
 
 It is better to keep the related documentation changes in the same patch
-file as the code, rather than one big documentation patch at then end of a
+file as the code, rather than one big documentation patch at the end of a
 patchset. This makes it easier for future maintenance and development of the
 code.
 
-- 
2.17.1



[dpdk-dev] [PATCH] drivers/net/i40e: fixed misplaced arguments

2020-07-14 Thread Muhammad Bilal
Here I have corrected a misplaced argument of i40e_aq_get_phy_register()
This was also evident after seeing the datatype of its arguments.

Fixes: 98e60c0d43f1 ("net/i40e: add module EEPROM callbacks for i40e")
Cc: zijie@6wind.com

Bugzilla ID: 506
Signed-off-by: Muhammad Bilal 
---
 drivers/net/i40e/i40e_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 970a31cb2..5fdfadf7b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12093,7 +12093,7 @@ static int i40e_get_module_eeprom(struct rte_eth_dev 
*dev,
}
status = i40e_aq_get_phy_register(hw,
I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE,
-   addr, offset, 1, &value, NULL);
+   addr, 1, offset, &value, NULL);
if (status)
return -EIO;
data[i] = (uint8_t)value;
-- 
2.25.1



Re: [dpdk-dev] [dpdk-stable] [PATCH] drivers/net/i40e: fixed misplaced arguments

2020-07-15 Thread Muhammad Bilal
Yes, This is the patch for the same bug, Which is already fixed. So
this duplicate patch can be ignored.

On Tue, Jul 14, 2020 at 9:54 PM Ferruh Yigit  wrote:
>
> On 7/14/2020 4:58 PM, Muhammad Bilal wrote:
> > Here I have corrected a misplaced argument of i40e_aq_get_phy_register()
> > This was also evident after seeing the datatype of its arguments.
> >
> > Fixes: 98e60c0d43f1 ("net/i40e: add module EEPROM callbacks for i40e")
> > Cc: zijie@6wind.com
> >
> > Bugzilla ID: 506
> > Signed-off-by: Muhammad Bilal 
> > ---
> >  drivers/net/i40e/i40e_ethdev.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> > index 970a31cb2..5fdfadf7b 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -12093,7 +12093,7 @@ static int i40e_get_module_eeprom(struct 
> > rte_eth_dev *dev,
> >   }
> >   status = i40e_aq_get_phy_register(hw,
> >   I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE,
> > - addr, offset, 1, &value, NULL);
> > + addr, 1, offset, &value, NULL);
> >   if (status)
> >   return -EIO;
> >   data[i] = (uint8_t)value;
> >
>
> Hi Muhammad,
>
> This seems already fixed [1], can you please double check in the 'v20.08-rc1'?
>
>
>
> [1]
> https://git.dpdk.org/dpdk/commit/?id=2fc1d6da882563ab80786d69b6d7c9d0e4ce860a
> https://patches.dpdk.org/patch/72827/


[dpdk-dev] [PATCH] doc: removed typing mistake

2020-09-09 Thread Muhammad Bilal
Here I have removed 'that' from the sentence to make it grammatically
correct, as it seems to be a typing mistake

Fixes: d0dff9ba445e ("doc: sample application user guide")
Cc: bernard.iremon...@intel.com

Signed-off-by: Muhammad Bilal 
---
 doc/guides/prog_guide/multi_proc_support.rst | 2 +-
 doc/guides/sample_app_ug/multi_process.rst   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/guides/prog_guide/multi_proc_support.rst 
b/doc/guides/prog_guide/multi_proc_support.rst
index a84083b96..a0d71a81a 100644
--- a/doc/guides/prog_guide/multi_proc_support.rst
+++ b/doc/guides/prog_guide/multi_proc_support.rst
@@ -136,7 +136,7 @@ can use).
 Running Multiple Independent Groups of DPDK Applications
 
 
-In the same way that it is possible to run independent DPDK applications side- 
by-side on a single system,
+In the same way, it is possible to run independent DPDK applications side- 
by-side on a single system,
 this can be trivially extended to multi-process groups of DPDK applications 
running side-by-side.
 In this case, the secondary processes must use the same ``--file-prefix`` 
parameter
 as the primary process whose shared memory they are connecting to.
diff --git a/doc/guides/sample_app_ug/multi_process.rst 
b/doc/guides/sample_app_ug/multi_process.rst
index f2a79a639..87c703b83 100644
--- a/doc/guides/sample_app_ug/multi_process.rst
+++ b/doc/guides/sample_app_ug/multi_process.rst
@@ -302,7 +302,7 @@ One additional enhancement in this sample application is 
that the server process
 This eliminates the need for the client processes to have the portmask 
parameter passed into them on the command line,
 as is done for the symmetric multi-process application, and therefore 
eliminates mismatched parameters as a potential source of errors.
 
-In the same way that the server process is designed to be run as a primary 
process instance only,
+In the same way, the server process is designed to be run as a primary process 
instance only,
 the client processes are designed to be run as secondary instances only.
 They have no code to attempt to create shared memory objects.
 Instead, handles to all needed rings and memory pools are obtained via calls 
to rte_ring_lookup() and rte_mempool_lookup().
-- 
2.25.1