Re: [lng-odp] [PATCH] linux-gen: fix dpdk pktio init

2017-02-06 Thread Maxim Uvarov
Merged,
Maxim.


On 02/06/17 11:22, Elo, Matias (Nokia - FI/Espoo) wrote:
> Good catch.
> 
> Reviewed-and-tested-by: Matias Elo 
> 
>> On 4 Feb 2017, at 22:33, Maxim Uvarov  wrote:
>>
>> struct rte_eth_dev_info should be initialized before
>> usage with strcmp(dev_info.driver_name, "rte_ixgbe_pmd").
>> Patch fixes segfault on that compare.
>>
>> CC: Elo Matias 
>> Signed-off-by: Maxim Uvarov 
>> ---
>> platform/linux-generic/pktio/dpdk.c | 14 +++---
>> 1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/platform/linux-generic/pktio/dpdk.c 
>> b/platform/linux-generic/pktio/dpdk.c
>> index 0eb025ae..9a9f7a4e 100644
>> --- a/platform/linux-generic/pktio/dpdk.c
>> +++ b/platform/linux-generic/pktio/dpdk.c
>> @@ -560,19 +560,19 @@ static int dpdk_output_queues_config(pktio_entry_t 
>> *pktio_entry,
>>  return 0;
>> }
>>
>> -static void dpdk_init_capability(pktio_entry_t *pktio_entry)
>> +static void dpdk_init_capability(pktio_entry_t *pktio_entry,
>> + struct rte_eth_dev_info *dev_info)
>> {
>>  pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
>>  odp_pktio_capability_t *capa = _dpdk->capa;
>> -struct rte_eth_dev_info dev_info;
>>
>> -memset(_info, 0, sizeof(struct rte_eth_dev_info));
>> +memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
>>  memset(capa, 0, sizeof(odp_pktio_capability_t));
>>
>> -rte_eth_dev_info_get(pkt_dpdk->port_id, _info);
>> -capa->max_input_queues = RTE_MIN(dev_info.max_rx_queues,
>> +rte_eth_dev_info_get(pkt_dpdk->port_id, dev_info);
>> +capa->max_input_queues = RTE_MIN(dev_info->max_rx_queues,
>>   PKTIO_MAX_QUEUES);
>> -capa->max_output_queues = RTE_MIN(dev_info.max_tx_queues,
>> +capa->max_output_queues = RTE_MIN(dev_info->max_tx_queues,
>>PKTIO_MAX_QUEUES);
>>  capa->set_op.op.promisc_mode = 1;
>>
>> @@ -631,7 +631,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
>>  return -1;
>>  }
>>
>> -dpdk_init_capability(pktio_entry);
>> +dpdk_init_capability(pktio_entry, _info);
>>
>>  mtu = dpdk_mtu_get(pktio_entry);
>>  if (mtu == 0) {
>> -- 
>> 2.11.0.295.gd7dffce
>>
> 



Re: [lng-odp] [PATCH] linux-gen: fix dpdk pktio init

2017-02-06 Thread Elo, Matias (Nokia - FI/Espoo)
Good catch.

Reviewed-and-tested-by: Matias Elo 

> On 4 Feb 2017, at 22:33, Maxim Uvarov  wrote:
> 
> struct rte_eth_dev_info should be initialized before
> usage with strcmp(dev_info.driver_name, "rte_ixgbe_pmd").
> Patch fixes segfault on that compare.
> 
> CC: Elo Matias 
> Signed-off-by: Maxim Uvarov 
> ---
> platform/linux-generic/pktio/dpdk.c | 14 +++---
> 1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/platform/linux-generic/pktio/dpdk.c 
> b/platform/linux-generic/pktio/dpdk.c
> index 0eb025ae..9a9f7a4e 100644
> --- a/platform/linux-generic/pktio/dpdk.c
> +++ b/platform/linux-generic/pktio/dpdk.c
> @@ -560,19 +560,19 @@ static int dpdk_output_queues_config(pktio_entry_t 
> *pktio_entry,
>   return 0;
> }
> 
> -static void dpdk_init_capability(pktio_entry_t *pktio_entry)
> +static void dpdk_init_capability(pktio_entry_t *pktio_entry,
> +  struct rte_eth_dev_info *dev_info)
> {
>   pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
>   odp_pktio_capability_t *capa = _dpdk->capa;
> - struct rte_eth_dev_info dev_info;
> 
> - memset(_info, 0, sizeof(struct rte_eth_dev_info));
> + memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
>   memset(capa, 0, sizeof(odp_pktio_capability_t));
> 
> - rte_eth_dev_info_get(pkt_dpdk->port_id, _info);
> - capa->max_input_queues = RTE_MIN(dev_info.max_rx_queues,
> + rte_eth_dev_info_get(pkt_dpdk->port_id, dev_info);
> + capa->max_input_queues = RTE_MIN(dev_info->max_rx_queues,
>PKTIO_MAX_QUEUES);
> - capa->max_output_queues = RTE_MIN(dev_info.max_tx_queues,
> + capa->max_output_queues = RTE_MIN(dev_info->max_tx_queues,
> PKTIO_MAX_QUEUES);
>   capa->set_op.op.promisc_mode = 1;
> 
> @@ -631,7 +631,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
>   return -1;
>   }
> 
> - dpdk_init_capability(pktio_entry);
> + dpdk_init_capability(pktio_entry, _info);
> 
>   mtu = dpdk_mtu_get(pktio_entry);
>   if (mtu == 0) {
> -- 
> 2.11.0.295.gd7dffce
> 



[lng-odp] [PATCH] linux-gen: fix dpdk pktio init

2017-02-04 Thread Maxim Uvarov
struct rte_eth_dev_info should be initialized before
usage with strcmp(dev_info.driver_name, "rte_ixgbe_pmd").
Patch fixes segfault on that compare.

CC: Elo Matias 
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/dpdk.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 0eb025ae..9a9f7a4e 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -560,19 +560,19 @@ static int dpdk_output_queues_config(pktio_entry_t 
*pktio_entry,
return 0;
 }
 
-static void dpdk_init_capability(pktio_entry_t *pktio_entry)
+static void dpdk_init_capability(pktio_entry_t *pktio_entry,
+struct rte_eth_dev_info *dev_info)
 {
pkt_dpdk_t *pkt_dpdk = _entry->s.pkt_dpdk;
odp_pktio_capability_t *capa = _dpdk->capa;
-   struct rte_eth_dev_info dev_info;
 
-   memset(_info, 0, sizeof(struct rte_eth_dev_info));
+   memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
memset(capa, 0, sizeof(odp_pktio_capability_t));
 
-   rte_eth_dev_info_get(pkt_dpdk->port_id, _info);
-   capa->max_input_queues = RTE_MIN(dev_info.max_rx_queues,
+   rte_eth_dev_info_get(pkt_dpdk->port_id, dev_info);
+   capa->max_input_queues = RTE_MIN(dev_info->max_rx_queues,
 PKTIO_MAX_QUEUES);
-   capa->max_output_queues = RTE_MIN(dev_info.max_tx_queues,
+   capa->max_output_queues = RTE_MIN(dev_info->max_tx_queues,
  PKTIO_MAX_QUEUES);
capa->set_op.op.promisc_mode = 1;
 
@@ -631,7 +631,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
return -1;
}
 
-   dpdk_init_capability(pktio_entry);
+   dpdk_init_capability(pktio_entry, _info);
 
mtu = dpdk_mtu_get(pktio_entry);
if (mtu == 0) {
-- 
2.11.0.295.gd7dffce