[dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function

2015-03-04 Thread Tetsuya Mukawa
2015-02-26 19:57 GMT+09:00 Thomas Monjalon :
> 2015-02-26 18:06, Tetsuya Mukawa:
>> 2015-02-26 16:03 GMT+09:00 Thomas Monjalon :
>> > 2015-02-25 16:49, Stephen Hemminger:
>> >> Build fails if HOTPLUG is disabled
>>
>> Hi Stephen,
>>
>> I appreciate for you reporting.
>>
>> >
>> > OK thanks for reporting.
>> > Actually there is no good reason to disable hotplug on Linux.
>> > Though it means that it's impossible to build on FreeBSD.
>> >
>> > Tetsuya, the right fix is to remove this option.
>>
>> Hi Thomas,
>>
>> Yes, I agree with it. I will add some codes to remove the option.
>> Please let me have a few days, I need to prepare BSD machine for compile 
>> test.
>>
>> > You should manage to graceful degrades hotplug in not supported
>> > cases supported: devices cannot be detachable in case of VFIO or nic_uio.
>> > What about uio_pci_generic?
>>
>> We cannot detach a vfio device so far. But we can detach a igb_uio and
>> uio_pci_generic device.
>> About a vfio ddevice, I haven't checked related code yet, but I guess
>> I will submit code to detach a vfio device in post-rc1.
>
> OK thanks.
> I made a quick fix (moving #ifdef) waiting the option removal:
> http://dpdk.org/browse/dpdk/commit/?id=7609e6609350
>

Hi Thomas,

I submit the patches to remove HOTPLUG config macro.

Thanks,
Tetsuya


[dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function

2015-02-28 Thread Thomas Monjalon
2015-02-26 12:21, Mcnamara, John:
> Hi,
> 
> The HEAD doesn't compile with gcc 4.7.2:
> 
> $ git clone http://dpdk.org/git/dpdk
> $ cd dpdk
> $ make T=x86_64-native-linuxapp-gcc -j install 
> 
> ...
> == Build lib/librte_pipeline
>   SYMLINK-FILE include/rte_pipeline.h
>   CC rte_pipeline.o
> /tmp/dpdk/lib/librte_pmd_null/rte_eth_null.c: In function 'eth_stats_get':
> 
> /tmp/dpdk/lib/librte_pmd_null/rte_eth_null.c:302:28:
> error: array subscript is above array bounds [-Werror=array-bounds]
> /tmp/dpdk/lib/librte_pmd_null/rte_eth_null.c:302:28: 
> error: array subscript is above array bounds [-Werror=array-bounds]
> /tmp/dpdk/lib/librte_pmd_null/rte_eth_null.c:302:28: 
> error: array subscript is above array bounds [-Werror=array-bounds]
> ...
> 
> cc1: all warnings being treated as errors
> make[5]: *** [rte_eth_null.o] Error 1
> make[4]: *** [librte_pmd_null] Error 2
> 
> 
> The following commit introduced this issue:
> 
> $ git bisect good  
> c743e50c475f73edf78e5ba26445d7c6ea217f40 is the first bad commit
> commit c743e50c475f73edf78e5ba26445d7c6ea217f40
> Author: Tetsuya Mukawa 
> Date:   Mon Feb 23 14:12:34 2015 +0900
> 
> null: new poll mode driver
> 
> 
> I don't see the issue with gcc 4.9.

Fixed: http://dpdk.org/browse/dpdk/commit/?id=e34550c8b97826



[dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function

2015-02-27 Thread Tetsuya Mukawa
On 2015/02/27 0:36, Mcnamara, John wrote:
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Mcnamara, John
>> Sent: Thursday, February 26, 2015 12:21 PM
>> To: Tetsuya Mukawa; Thomas Monjalon
>> Cc: dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port
>> hotplug function
>>
>> The following commit introduced this issue:
>>
>> $ git bisect good
>> c743e50c475f73edf78e5ba26445d7c6ea217f40 is the first bad commit
>> commit c743e50c475f73edf78e5ba26445d7c6ea217f40
> Hi,
>
> The above commit also has throws a warning with ICC:
>
> lib/librte_pmd_null/rte_eth_null.c(47): error #83:
> type qualifier specified more than once
>
>   static const char const *valid_arguments[] = {
> ^
>
> 
> An earlier commit also throws a warning with ICC:
>  
>
> lib/librte_pmd_null/rte_eth_null.c(47): error #83: 
> type qualifier specified more than once
>
> static const char const *valid_arguments[] = {
> ^
>
> Commit:
>
> 92d94d3744d7760d8d5e490be810612cf4a9cfb0 is the first bad commit
> commit 92d94d3744d7760d8d5e490be810612cf4a9cfb0
> Author: Tetsuya Mukawa 
> Date:   Thu Feb 26 04:32:26 2015 +0900
>
> ethdev: attach or detach port
>
>
> I applied the following patch to fix these issues, (in order to test with the 
> HEAD). You can review them to see if they are valid and apply something 
> similar:
>
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index bb94ccb..6ea7a17 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -433,7 +433,7 @@ static enum rte_eth_dev_type
>  rte_eth_dev_get_device_type(uint8_t port_id)
>  {
> if (!rte_eth_dev_is_valid_port(port_id))
> -   return -1;
> +   return RTE_ETH_DEV_UNKNOWN;
> return rte_eth_devices[port_id].dev_type;
>  }
>  
> diff --git a/lib/librte_pmd_null/rte_eth_null.c 
> b/lib/librte_pmd_null/rte_eth_null.c
> index bb10276..3ef5842 100644
> --- a/lib/librte_pmd_null/rte_eth_null.c
> +++ b/lib/librte_pmd_null/rte_eth_null.c
> @@ -44,7 +44,7 @@
>  static unsigned default_packet_size = 64;
>  static unsigned default_packet_copy;
>  
> -static const char const *valid_arguments[] = {
> +static const char *valid_arguments[] = {
> ETH_NULL_PACKET_SIZE_ARG,
> ETH_NULL_PACKET_COPY_ARG,
> NULL
>
>
> John.

Hi Mcnamara and Stephen,

I appreciate for reporting.
I start checking all compile issues of null pmd.

Thanks,
Tetsuya



[dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function

2015-02-26 Thread Tetsuya Mukawa
2015-02-26 19:57 GMT+09:00 Thomas Monjalon :
> 2015-02-26 18:06, Tetsuya Mukawa:
>> 2015-02-26 16:03 GMT+09:00 Thomas Monjalon :
>> > 2015-02-25 16:49, Stephen Hemminger:
>> >> Build fails if HOTPLUG is disabled
>>
>> Hi Stephen,
>>
>> I appreciate for you reporting.
>>
>> >
>> > OK thanks for reporting.
>> > Actually there is no good reason to disable hotplug on Linux.
>> > Though it means that it's impossible to build on FreeBSD.
>> >
>> > Tetsuya, the right fix is to remove this option.
>>
>> Hi Thomas,
>>
>> Yes, I agree with it. I will add some codes to remove the option.
>> Please let me have a few days, I need to prepare BSD machine for compile 
>> test.
>>
>> > You should manage to graceful degrades hotplug in not supported
>> > cases supported: devices cannot be detachable in case of VFIO or nic_uio.
>> > What about uio_pci_generic?
>>
>> We cannot detach a vfio device so far. But we can detach a igb_uio and
>> uio_pci_generic device.
>> About a vfio ddevice, I haven't checked related code yet, but I guess
>> I will submit code to detach a vfio device in post-rc1.
>
> OK thanks.
> I made a quick fix (moving #ifdef) waiting the option removal:
> http://dpdk.org/browse/dpdk/commit/?id=7609e6609350
>

Thank you so much for that.

Tetsuya,


[dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function

2015-02-26 Thread Tetsuya Mukawa
2015-02-26 16:03 GMT+09:00 Thomas Monjalon :
> 2015-02-25 16:49, Stephen Hemminger:
>> Build fails if HOTPLUG is disabled

Hi Stephen,

I appreciate for you reporting.

>
> OK thanks for reporting.
> Actually there is no good reason to disable hotplug on Linux.
> Though it means that it's impossible to build on FreeBSD.
>
> Tetsuya, the right fix is to remove this option.

Hi Thomas,

Yes, I agree with it. I will add some codes to remove the option.
Please let me have a few days, I need to prepare BSD machine for compile test.

> You should manage to graceful degrades hotplug in not supported
> cases supported: devices cannot be detachable in case of VFIO or nic_uio.
> What about uio_pci_generic?

We cannot detach a vfio device so far. But we can detach a igb_uio and
uio_pci_generic device.
About a vfio ddevice, I haven't checked related code yet, but I guess
I will submit code to detach a vfio device in post-rc1.

Thanks,
Tetsuya


[dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function

2015-02-26 Thread Mcnamara, John
Hi,

The HEAD doesn't compile with gcc 4.7.2:

$ git clone http://dpdk.org/git/dpdk
$ cd dpdk
$ make T=x86_64-native-linuxapp-gcc -j install 

...
== Build lib/librte_pipeline
  SYMLINK-FILE include/rte_pipeline.h
  CC rte_pipeline.o
/tmp/dpdk/lib/librte_pmd_null/rte_eth_null.c: In function 'eth_stats_get':

/tmp/dpdk/lib/librte_pmd_null/rte_eth_null.c:302:28:
error: array subscript is above array bounds [-Werror=array-bounds]
/tmp/dpdk/lib/librte_pmd_null/rte_eth_null.c:302:28: 
error: array subscript is above array bounds [-Werror=array-bounds]
/tmp/dpdk/lib/librte_pmd_null/rte_eth_null.c:302:28: 
error: array subscript is above array bounds [-Werror=array-bounds]
...

cc1: all warnings being treated as errors
make[5]: *** [rte_eth_null.o] Error 1
make[4]: *** [librte_pmd_null] Error 2


The following commit introduced this issue:

$ git bisect good  
c743e50c475f73edf78e5ba26445d7c6ea217f40 is the first bad commit
commit c743e50c475f73edf78e5ba26445d7c6ea217f40
Author: Tetsuya Mukawa 
Date:   Mon Feb 23 14:12:34 2015 +0900

null: new poll mode driver


I don't see the issue with gcc 4.9.

Regards,

John


[dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function

2015-02-26 Thread Thomas Monjalon
2015-02-26 18:06, Tetsuya Mukawa:
> 2015-02-26 16:03 GMT+09:00 Thomas Monjalon :
> > 2015-02-25 16:49, Stephen Hemminger:
> >> Build fails if HOTPLUG is disabled
> 
> Hi Stephen,
> 
> I appreciate for you reporting.
> 
> >
> > OK thanks for reporting.
> > Actually there is no good reason to disable hotplug on Linux.
> > Though it means that it's impossible to build on FreeBSD.
> >
> > Tetsuya, the right fix is to remove this option.
> 
> Hi Thomas,
> 
> Yes, I agree with it. I will add some codes to remove the option.
> Please let me have a few days, I need to prepare BSD machine for compile test.
> 
> > You should manage to graceful degrades hotplug in not supported
> > cases supported: devices cannot be detachable in case of VFIO or nic_uio.
> > What about uio_pci_generic?
> 
> We cannot detach a vfio device so far. But we can detach a igb_uio and
> uio_pci_generic device.
> About a vfio ddevice, I haven't checked related code yet, but I guess
> I will submit code to detach a vfio device in post-rc1.

OK thanks.
I made a quick fix (moving #ifdef) waiting the option removal:
http://dpdk.org/browse/dpdk/commit/?id=7609e6609350



[dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function

2015-02-26 Thread Thomas Monjalon
2015-02-25 16:49, Stephen Hemminger:
> Build fails if HOTPLUG is disabled

OK thanks for reporting.
Actually there is no good reason to disable hotplug on Linux.
Though it means that it's impossible to build on FreeBSD.

Tetsuya, the right fix is to remove this option.
You should manage to graceful degrades hotplug in not supported
cases supported: devices cannot be detachable in case of VFIO or nic_uio.
What about uio_pci_generic?


[dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function

2015-02-26 Thread Thomas Monjalon
> This patch adds port hotplug support to Null PMD.
> 
> v9:
>  - Use rte_eth_dev_release_port() instead of rte_eth_dev_free().
> v7:
>  - Add parameter checkings.
>(Thanks to Iremonger, Bernard)
> v6:
>  - Fix a parameter of rte_eth_dev_free().
> v4:
>  - Fix commit title.
> 
> Signed-off-by: Tetsuya Mukawa 

Applied, thanks

I assumed you are OK to be the maintainer of Null PMD.



[dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function

2015-02-25 Thread Stephen Hemminger
Build fails if HOTPLUG is disabled

== Build lib/librte_ether
  CC rte_ethdev.o
/var/src/dpdk/lib/librte_ether/rte_ethdev.c:430:1: error: 
?rte_eth_dev_get_device_type? defined but not used [-Werror=unused-function]
 rte_eth_dev_get_device_type(uint8_t port_id)
 ^
/var/src/dpdk/lib/librte_ether/rte_ethdev.c:438:1: error: ?rte_eth_dev_save? 
defined but not used [-Werror=unused-function]
 rte_eth_dev_save(struct rte_eth_dev *devs, size_t size)
 ^
/var/src/dpdk/lib/librte_ether/rte_ethdev.c:450:1: error: 
?rte_eth_dev_get_changed_port? defined but not used [-Werror=unused-function]
 rte_eth_dev_get_changed_port(struct rte_eth_dev *devs, uint8_t *port_id)
 ^
/var/src/dpdk/lib/librte_ether/rte_ethdev.c:464:1: error: 
?rte_eth_dev_get_addr_by_port? defined but not used [-Werror=unused-function]
 rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
 ^
/var/src/dpdk/lib/librte_ether/rte_ethdev.c:481:1: error: 
?rte_eth_dev_get_name_by_port? defined but not used [-Werror=unused-function]
 rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
 ^
/var/src/dpdk/lib/librte_ether/rte_ethdev.c:503:1: error: 
?rte_eth_dev_is_detachable? defined but not used [-Werror=unused-function]
 rte_eth_dev_is_detachable(uint8_t port_id)
 ^
cc1: all warnings being treated as errors


[dpdk-dev] [PATCH v11 2/2] librte_pmd_null: Support port hotplug function

2015-02-23 Thread Tetsuya Mukawa
This patch adds port hotplug support to Null PMD.

v9:
 - Use rte_eth_dev_release_port() instead of rte_eth_dev_free().
v7:
 - Add parameter checkings.
   (Thanks to Iremonger, Bernard)
v6:
 - Fix a parameter of rte_eth_dev_free().
v4:
 - Fix commit title.

Signed-off-by: Tetsuya Mukawa 
---
 lib/librte_pmd_null/rte_eth_null.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/lib/librte_pmd_null/rte_eth_null.c 
b/lib/librte_pmd_null/rte_eth_null.c
index aaa0839..bb10276 100644
--- a/lib/librte_pmd_null/rte_eth_null.c
+++ b/lib/librte_pmd_null/rte_eth_null.c
@@ -336,6 +336,13 @@ eth_stats_reset(struct rte_eth_dev *dev)
}
 }

+static struct eth_driver rte_null_pmd = {
+   .pci_drv = {
+   .name = "rte_null_pmd",
+   .drv_flags = RTE_PCI_DRV_DETACHABLE,
+   },
+};
+
 static void
 eth_queue_release(void *q)
 {
@@ -429,10 +436,12 @@ eth_dev_null_create(const char *name,
data->nb_tx_queues = (uint16_t)nb_tx_queues;
data->dev_link = pmd_link;
data->mac_addrs = _addr;
+   strncpy(data->name, eth_dev->data->name, strlen(eth_dev->data->name));

eth_dev->data = data;
eth_dev->dev_ops = 
eth_dev->pci_dev = pci_dev;
+   eth_dev->driver = _null_pmd;

/* finally assign rx and tx ops */
if (packet_copy) {
@@ -536,10 +545,36 @@ rte_pmd_null_devinit(const char *name, const char *params)
return eth_dev_null_create(name, numa_node, packet_size, packet_copy);
 }

+static int
+rte_pmd_null_devuninit(const char *name)
+{
+   struct rte_eth_dev *eth_dev = NULL;
+
+   if (name == NULL)
+   return -EINVAL;
+
+   RTE_LOG(INFO, PMD, "Closing null ethdev on numa socket %u\n",
+   rte_socket_id());
+
+   /* reserve an ethdev entry */
+   eth_dev = rte_eth_dev_allocated(name);
+   if (eth_dev == NULL)
+   return -1;
+
+   rte_free(eth_dev->data->dev_private);
+   rte_free(eth_dev->data);
+   rte_free(eth_dev->pci_dev);
+
+   rte_eth_dev_release_port(eth_dev);
+
+   return 0;
+}
+
 static struct rte_driver pmd_null_drv = {
.name = "eth_null",
.type = PMD_VDEV,
.init = rte_pmd_null_devinit,
+   .uninit = rte_pmd_null_devuninit,
 };

 PMD_REGISTER_DRIVER(pmd_null_drv);
-- 
1.9.1