* Re: [PATCH] examples/l3fwd: force CRC stripping for i40evf
From: Thomas Monjalon @ 2016-11-10 7:55 UTC (permalink / raw)
To: Björn Töpel, Topel, Bjorn
Cc: Yao, Lei A, Zhang, Helin, Ananyev, Konstantin, dev, Xu, Qian Q,
Wu, Jingjing
In-Reply-To: <2fddae6f-d9ee-4dfb-2a4b-3ddcda830820@gmail.com>
2016-11-10 07:17, Björn Töpel:
> As discussed in the thread, it might be better to just change the
> default in l3fwd from .hw_strip_crc = 0 to 1.
>
> I'll be looking into changing igbvf and ixgbevf to match the semantics
> of i40evf.
Just to make it sure, you mean returning an error in the driver when
a configuration cannot be applied, right?
^ permalink raw reply
* Re: [PATCH] net/qede: fix unknown speed errmsg for 25G link
From: Thomas Monjalon @ 2016-11-10 7:51 UTC (permalink / raw)
To: Rasesh Mody, Harish Patil; +Cc: dev, Dept-EngDPDKDev
In-Reply-To: <1478744784-17469-1-git-send-email-Rasesh.Mody@cavium.com>
2016-11-09 18:26, Rasesh Mody:
> From: Harish Patil <harish.patil@qlogic.com>
>
> Fix to use bitmapped values in NVM configuration for speed capability
> advertisement. This issue is specific to 25G NIC since it is capable
> of 25G and 10G speeds.
>
> Fixes: 64c239b7f8b7 ("net/qede: fix advertising link speed capability")
>
> Signed-off-by: Harish Patil <harish.patil@qlogic.com>
Now that the feature seems well implemented, I think you can add
it to the feature matrix (doc/guides/nics/features/qede.ini).
^ permalink raw reply
* Re: Clarification for eth_driver changes
From: Jianbo Liu @ 2016-11-10 7:51 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: David Marchand, dev@dpdk.org
In-Reply-To: <b81216f4-bb8e-81ec-f727-168fff11f0dd@nxp.com>
On 10 November 2016 at 15:26, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Hello David, list,
>
> I need some help and clarification regarding some changes I am doing to
> cleanup the EAL code.
>
> There are some changes which should be done for eth_driver/rte_eth_device
> structures:
>
> 1. most obvious, eth_driver should be renamed to rte_eth_driver.
> 2. eth_driver currently has rte_pci_driver embedded in it
> - there can be ethernet devices which are _not_ PCI
> - in which case, this structure should be removed.
> 3. Similarly, rte_eth_dev has rte_pci_device which should be replaced with
> rte_device.
>
> This is what the current outline of eth_driver is:
>
> +------------------------+
> | eth_driver |
> | +---------------------+|
> | | rte_pci_driver ||
> | | +------------------+||
> | | | rte_driver |||
> | | | name[] |||
> | | | ... |||
> | | +------------------+||
> | | .probe ||
> | | .remove ||
> | | ... ||
> | +---------------------+|
> | .eth_dev_init |
> | .eth_dev_uninit |
> +------------------------+
>
> This is what I was thinking:
>
> +---------------------+ +----------------------+
> | rte_pci_driver | |eth_driver |
> | +------------------+| _|_struct rte_driver *p |
> | | rte_driver <-------/ | .eth_dev_init |
> | | ... || | .eth_dev_uninit |
> | | name || +----------------------+
> | | <more> ||
> | +------------------+|
> | <PCI specific info>|
> +---------------------+
>
> ::Impact::
> Various drivers use the rte_pci_driver embedded in the eth_driver object for
> device initialization.
> == They assume that rte_pci_driver is directly embedded and hence simply
> dereference.
> == e.g. eth_igb_dev_init() in drivers/net/e1000/igb_ethdev.c file
>
> With the above change, such drivers would have to access rte_driver and then
> perform container_of to obtain their respective rte_xxx_driver.
> == this would be useful in case there is a non-PCI driver
>
> ::Problem::
> I am not sure of reason as to why eth_driver embedded rte_pci_driver in
> first place - other than a convenient way to define it before PCI driver
> registration.
>
> As all the existing PMDs are impacted - am I missing something here in
> making the above change?
>
How do you know eth_driver->p is pointing to a rte_pci_driver or rte_soc_driver?
Maybe you need to add a type/flag in rte_driver.
> Probably, similar is the case for rte_eth_dev.
>
> -
> Shreyansh
^ permalink raw reply
* Re: [PATCH v7 11/21] eal/soc: implement probing of drivers
From: Jianbo Liu @ 2016-11-10 7:41 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, Thomas Monjalon, Jan Viktorin
In-Reply-To: <9e25635b-a7cc-8ba3-76a2-ed906774e4ef@nxp.com>
On 10 November 2016 at 14:10, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> On Thursday 10 November 2016 09:00 AM, Jianbo Liu wrote:
>>
>> On 28 October 2016 at 20:26, Shreyansh Jain <shreyansh.jain@nxp.com>
>> wrote:
>>>
>>> Each SoC PMD registers a set of callback for scanning its own bus/infra
>>> and
>>> matching devices to drivers when probe is called.
>>> This patch introduces the infra for calls to SoC scan on
>>> rte_eal_soc_init()
>>> and match on rte_eal_soc_probe().
>>>
>>> Patch also adds test case for scan and probe.
>>>
>>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>>> --
>>> v4:
>>> - Update test_soc for descriptive test function names
>>> - Comments over test functions
>>> - devinit and devuninint --> probe/remove
>>> - RTE_VERIFY at some places
>>> ---
>>> app/test/test_soc.c | 205
>>> ++++++++++++++++++++++-
>>> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 4 +
>>> lib/librte_eal/common/eal_common_soc.c | 213
>>> +++++++++++++++++++++++-
>>> lib/librte_eal/common/include/rte_soc.h | 75 ++++++++-
>>> lib/librte_eal/linuxapp/eal/eal.c | 5 +
>>> lib/librte_eal/linuxapp/eal/eal_soc.c | 21 ++-
>>> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 4 +
>>> 7 files changed, 519 insertions(+), 8 deletions(-)
>>>
>> ......
>>
>>> /**
>>> + * SoC device scan callback, called from rte_eal_soc_init.
>>> + * For various SoC, the bus on which devices are attached maynot be
>>> compliant
>>> + * to a standard platform (or platform bus itself). In which case, extra
>>> + * steps are implemented by PMD to scan over the bus and add devices to
>>> SoC
>>> + * device list.
>>> + */
>>> +typedef void (soc_scan_t)(void);
>>
>>
>> I'm still not sure about the purpose of soc_scan, and how to use it.
>
>
> For each device to be used by DPDK, which cannot be scanned/identified using
> the existing PCI/VDEV methods (sysfs/bus/pci), 'soc_scan_t' provides a way
> for driver to make those devices part of device lists.
>
> Ideally, 'scan' is not a function of a driver. It is a bus function - which
> is missing in this case.
>
>> If it's for each driver, it should at least struct rte_soc_driver * as
>> its parameter.
>
>
> Its for each driver - assuming that each non-PCI driver which implements it
> knows how to find devices which it can control (for example, special area in
> sysfs, or even platform bus).
>
Considering there are several drivers in a platform bus, each driver
call the scan function, like the rte_eal_soc_scan_platform_bus() you
implemented.
The first will add soc devices to the list, but the remaining calls
are redundant.
The other issue is adding the driver parameter. Do you need extra
information from driver to scan the bus?
>> If it's for each bus, why it is in rte_soc_driver?
>
>
> Short answer - lack of a better place. It should be in dev.h probably
> (rte_device/driver) but it would look out of place (as that represents PCI
> devices also which cannot implement it - all PCI devices are scanned in one
> go irrespective of driver)
>
>> I know you will implement bus driver in the future, but we need to
>> make it clear for current simplified implementation.
>
>
> Current implementation makes only a single assumption - that rather than
> relying on EAL for identifying devices (as being done now), next best option
> in existing framework (driver) should have control of finding devices.
>
> This is primarily to make the SoC work parallel to PCI implementation
> without much top-down changes in EAL.
>
> Bus model, improvises it by moving this implementation a little above in
> hierarchy - in rte_bus<-rte_driver<-PMD.
>
> I understand your apprehension - 'driver-scanning-for-devices' is indeed not
> correct real world analogy. It is just a place holder for enabling those
> drivers/PMDs which cannot work in absence of the right model.
> And that is still work in progress.
>
>
>>
>>> +
>>> +/**
>>> + * Custom device<=>driver match callback for SoC
>>> + * Unlike PCI, SoC devices don't have a fixed definition of device
>>> + * identification. PMDs can implement a specific matching function in
>>> which
>>> + * driver and device objects are provided to perform custom match.
>>> + */
>>> +typedef int (soc_match_t)(struct rte_soc_driver *, struct rte_soc_device
>>> *);
>>> +
>>> +/**
>>> * A structure describing a SoC driver.
>>> */
>>> struct rte_soc_driver {
>>> @@ -104,6 +120,8 @@ struct rte_soc_driver {
>>> struct rte_driver driver; /**< Inherit core driver. */
>>> soc_probe_t *probe; /**< Device probe */
>>> soc_remove_t *remove; /**< Device remove */
>>> + soc_scan_t *scan_fn; /**< Callback for scanning SoC
>>> bus*/
>>> + soc_match_t *match_fn; /**< Callback to match
>>> dev<->drv */
>>> const struct rte_soc_id *id_table; /**< ID table, NULL terminated
>>> */
>>> };
>>>
>>> @@ -146,12 +164,63 @@ rte_eal_compare_soc_addr(const struct rte_soc_addr
>>> *a0,
>>> }
>>>
>>> /**
>>> + * Default function for matching the Soc driver with device. Each driver
>>> can
>>> + * either use this function or define their own soc matching function.
>>> + * This function relies on the compatible string extracted from sysfs.
>>> But,
>>> + * a SoC might have different way of identifying its devices. Such SoC
>>> can
>>> + * override match_fn.
>>> + *
>>> + * @return
>>> + * 0 on success
>>> + * -1 when no match found
>>> + */
>>> +int
>>> +rte_eal_soc_match_compat(struct rte_soc_driver *drv,
>>> + struct rte_soc_device *dev);
>>> +
>>> +/**
>>> + * Probe SoC devices for registered drivers.
>>> + *
>>> + * @return
>>> + * 0 on success
>>> + * !0 in case of any failure in probe
>>> + */
>>> +int rte_eal_soc_probe(void);
>>> +
>>> +/**
>>> + * Probe the single SoC device.
>>> + */
>>> +int rte_eal_soc_probe_one(const struct rte_soc_addr *addr);
>>> +
>>> +/**
>>> + * Close the single SoC device.
>>> + *
>>> + * Scan the SoC devices and find the SoC device specified by the SoC
>>> + * address, then call the remove() function for registered driver
>>> + * that has a matching entry in its id_table for discovered device.
>>> + *
>>> + * @param addr
>>> + * The SoC address to close.
>>> + * @return
>>> + * - 0 on success.
>>> + * - Negative on error.
>>> + */
>>> +int rte_eal_soc_detach(const struct rte_soc_addr *addr);
>>> +
>>> +/**
>>> * Dump discovered SoC devices.
>>> + *
>>> + * @param f
>>> + * File to dump device info in.
>>> */
>>> void rte_eal_soc_dump(FILE *f);
>>>
>>> /**
>>> * Register a SoC driver.
>>> + *
>>> + * @param driver
>>> + * Object for SoC driver to register
>>> + * @return void
>>> */
>>> void rte_eal_soc_register(struct rte_soc_driver *driver);
>>>
>>> @@ -167,6 +236,10 @@ RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
>>>
>>> /**
>>> * Unregister a SoC driver.
>>> + *
>>> + * @param driver
>>> + * Object for SoC driver to unregister
>>> + * @return void
>>> */
>>> void rte_eal_soc_unregister(struct rte_soc_driver *driver);
>>>
>>> diff --git a/lib/librte_eal/linuxapp/eal/eal.c
>>> b/lib/librte_eal/linuxapp/eal/eal.c
>>> index 098ba02..bd775f3 100644
>>> --- a/lib/librte_eal/linuxapp/eal/eal.c
>>> +++ b/lib/librte_eal/linuxapp/eal/eal.c
>>> @@ -70,6 +70,7 @@
>>> #include <rte_cpuflags.h>
>>> #include <rte_interrupts.h>
>>> #include <rte_pci.h>
>>> +#include <rte_soc.h>
>>> #include <rte_dev.h>
>>> #include <rte_devargs.h>
>>> #include <rte_common.h>
>>> @@ -890,6 +891,10 @@ rte_eal_init(int argc, char **argv)
>>> if (rte_eal_pci_probe())
>>> rte_panic("Cannot probe PCI\n");
>>>
>>> + /* Probe & Initialize SoC devices */
>>> + if (rte_eal_soc_probe())
>>> + rte_panic("Cannot probe SoC\n");
>>> +
>>> rte_eal_mcfg_complete();
>>>
>>> return fctret;
>>> diff --git a/lib/librte_eal/linuxapp/eal/eal_soc.c
>>> b/lib/librte_eal/linuxapp/eal/eal_soc.c
>>> index 04848b9..3929a76 100644
>>> --- a/lib/librte_eal/linuxapp/eal/eal_soc.c
>>> +++ b/lib/librte_eal/linuxapp/eal/eal_soc.c
>>> @@ -44,13 +44,28 @@
>>> #include <rte_log.h>
>>> #include <rte_soc.h>
>>>
>>> -#include "eal_internal_cfg.h"
>>> -#include "eal_filesystem.h"
>>> -#include "eal_private.h"
>>> +#include <eal_internal_cfg.h>
>>> +#include <eal_filesystem.h>
>>> +#include <eal_private.h>
>>>
>>> /* Init the SoC EAL subsystem */
>>> int
>>> rte_eal_soc_init(void)
>>> {
>>> + struct rte_soc_driver *drv;
>>> +
>>> + /* SoC is disabled by default */
>>> + if (!internal_config.enable_soc)
>>> + return 0;
>>> +
>>> + /* For each registered driver, call their scan routine to perform
>>> any
>>> + * custom scan for devices (for example, custom buses)
>>> + */
>>> + TAILQ_FOREACH(drv, &soc_driver_list, next) {
>>> + RTE_VERIFY(drv->scan_fn);
>>> + drv->scan_fn();
>>> + /* Ignore all errors from this */
>>> + }
>>> +
>>> return 0;
>>> }
>>> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>>> b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>>> index 0155025..c28e093 100644
>>> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>>> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>>> @@ -175,7 +175,11 @@ DPDK_16.11 {
>>> rte_eal_dev_attach;
>>> rte_eal_dev_detach;
>>> rte_eal_map_resource;
>>> + rte_eal_soc_detach;
>>> rte_eal_soc_dump;
>>> + rte_eal_soc_match;
>>> + rte_eal_soc_probe;
>>> + rte_eal_soc_probe_one;
>>> rte_eal_soc_register;
>>> rte_eal_soc_unregister;
>>> rte_eal_unmap_resource;
>>> --
>>> 2.7.4
>>>
>>
>
>
> --
> -
> Shreyansh
^ permalink raw reply
* Clarification for eth_driver changes
From: Shreyansh Jain @ 2016-11-10 7:26 UTC (permalink / raw)
To: david.marchand; +Cc: dev@dpdk.org
Hello David, list,
I need some help and clarification regarding some changes I am doing to
cleanup the EAL code.
There are some changes which should be done for
eth_driver/rte_eth_device structures:
1. most obvious, eth_driver should be renamed to rte_eth_driver.
2. eth_driver currently has rte_pci_driver embedded in it
- there can be ethernet devices which are _not_ PCI
- in which case, this structure should be removed.
3. Similarly, rte_eth_dev has rte_pci_device which should be replaced
with rte_device.
This is what the current outline of eth_driver is:
+------------------------+
| eth_driver |
| +---------------------+|
| | rte_pci_driver ||
| | +------------------+||
| | | rte_driver |||
| | | name[] |||
| | | ... |||
| | +------------------+||
| | .probe ||
| | .remove ||
| | ... ||
| +---------------------+|
| .eth_dev_init |
| .eth_dev_uninit |
+------------------------+
This is what I was thinking:
+---------------------+ +----------------------+
| rte_pci_driver | |eth_driver |
| +------------------+| _|_struct rte_driver *p |
| | rte_driver <-------/ | .eth_dev_init |
| | ... || | .eth_dev_uninit |
| | name || +----------------------+
| | <more> ||
| +------------------+|
| <PCI specific info>|
+---------------------+
::Impact::
Various drivers use the rte_pci_driver embedded in the eth_driver object
for device initialization.
== They assume that rte_pci_driver is directly embedded and hence
simply dereference.
== e.g. eth_igb_dev_init() in drivers/net/e1000/igb_ethdev.c file
With the above change, such drivers would have to access rte_driver and
then perform container_of to obtain their respective rte_xxx_driver.
== this would be useful in case there is a non-PCI driver
::Problem::
I am not sure of reason as to why eth_driver embedded rte_pci_driver in
first place - other than a convenient way to define it before PCI driver
registration.
As all the existing PMDs are impacted - am I missing something here in
making the above change?
Probably, similar is the case for rte_eth_dev.
-
Shreyansh
^ permalink raw reply
* Re: [PATCH] examples/l3fwd: force CRC stripping for i40evf
From: Björn Töpel @ 2016-11-10 6:17 UTC (permalink / raw)
To: Yao, Lei A, Topel, Bjorn, Zhang, Helin, Ananyev, Konstantin,
dev@dpdk.org
Cc: Xu, Qian Q, Wu, Jingjing, thomas.monjalon@6wind.com
In-Reply-To: <2DBBFF226F7CF64BAFCA79B681719D9537F2E51A@shsmsx102.ccr.corp.intel.com>
Lei wrote:
> I'm testing some DPDK sample under VMware. During the testing work, I
> find l3fwd+ ixgbe vf can work ,but L3fwd + i40evf can't work. So I
> reported this issue to Bjorn. From my perspective, if can add new
> parameter in l3fwd sample like what have already don’t in testpmd
> "----crc-strip enable" is a better way to resolve this issue.
(Please don't top-post.)
As discussed in the thread, it might be better to just change the
default in l3fwd from .hw_strip_crc = 0 to 1.
I'll be looking into changing igbvf and ixgbevf to match the semantics
of i40evf.
Björn
^ permalink raw reply
* Re: [PATCH v7 11/21] eal/soc: implement probing of drivers
From: Shreyansh Jain @ 2016-11-10 6:10 UTC (permalink / raw)
To: Jianbo Liu; +Cc: dev, Thomas Monjalon, Jan Viktorin
In-Reply-To: <CAP4Qi39Sfo6BX821ABXYdFP63DPcgWd54odSrtk8TxTH_Pcuvw@mail.gmail.com>
On Thursday 10 November 2016 09:00 AM, Jianbo Liu wrote:
> On 28 October 2016 at 20:26, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>> Each SoC PMD registers a set of callback for scanning its own bus/infra and
>> matching devices to drivers when probe is called.
>> This patch introduces the infra for calls to SoC scan on rte_eal_soc_init()
>> and match on rte_eal_soc_probe().
>>
>> Patch also adds test case for scan and probe.
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> --
>> v4:
>> - Update test_soc for descriptive test function names
>> - Comments over test functions
>> - devinit and devuninint --> probe/remove
>> - RTE_VERIFY at some places
>> ---
>> app/test/test_soc.c | 205 ++++++++++++++++++++++-
>> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 4 +
>> lib/librte_eal/common/eal_common_soc.c | 213 +++++++++++++++++++++++-
>> lib/librte_eal/common/include/rte_soc.h | 75 ++++++++-
>> lib/librte_eal/linuxapp/eal/eal.c | 5 +
>> lib/librte_eal/linuxapp/eal/eal_soc.c | 21 ++-
>> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 4 +
>> 7 files changed, 519 insertions(+), 8 deletions(-)
>>
> ......
>
>> /**
>> + * SoC device scan callback, called from rte_eal_soc_init.
>> + * For various SoC, the bus on which devices are attached maynot be compliant
>> + * to a standard platform (or platform bus itself). In which case, extra
>> + * steps are implemented by PMD to scan over the bus and add devices to SoC
>> + * device list.
>> + */
>> +typedef void (soc_scan_t)(void);
>
> I'm still not sure about the purpose of soc_scan, and how to use it.
For each device to be used by DPDK, which cannot be scanned/identified
using the existing PCI/VDEV methods (sysfs/bus/pci), 'soc_scan_t'
provides a way for driver to make those devices part of device lists.
Ideally, 'scan' is not a function of a driver. It is a bus function -
which is missing in this case.
> If it's for each driver, it should at least struct rte_soc_driver * as
> its parameter.
Its for each driver - assuming that each non-PCI driver which implements
it knows how to find devices which it can control (for example, special
area in sysfs, or even platform bus).
> If it's for each bus, why it is in rte_soc_driver?
Short answer - lack of a better place. It should be in dev.h probably
(rte_device/driver) but it would look out of place (as that represents
PCI devices also which cannot implement it - all PCI devices are scanned
in one go irrespective of driver)
> I know you will implement bus driver in the future, but we need to
> make it clear for current simplified implementation.
Current implementation makes only a single assumption - that rather than
relying on EAL for identifying devices (as being done now), next best
option in existing framework (driver) should have control of finding
devices.
This is primarily to make the SoC work parallel to PCI implementation
without much top-down changes in EAL.
Bus model, improvises it by moving this implementation a little above in
hierarchy - in rte_bus<-rte_driver<-PMD.
I understand your apprehension - 'driver-scanning-for-devices' is indeed
not correct real world analogy. It is just a place holder for enabling
those drivers/PMDs which cannot work in absence of the right model.
And that is still work in progress.
>
>> +
>> +/**
>> + * Custom device<=>driver match callback for SoC
>> + * Unlike PCI, SoC devices don't have a fixed definition of device
>> + * identification. PMDs can implement a specific matching function in which
>> + * driver and device objects are provided to perform custom match.
>> + */
>> +typedef int (soc_match_t)(struct rte_soc_driver *, struct rte_soc_device *);
>> +
>> +/**
>> * A structure describing a SoC driver.
>> */
>> struct rte_soc_driver {
>> @@ -104,6 +120,8 @@ struct rte_soc_driver {
>> struct rte_driver driver; /**< Inherit core driver. */
>> soc_probe_t *probe; /**< Device probe */
>> soc_remove_t *remove; /**< Device remove */
>> + soc_scan_t *scan_fn; /**< Callback for scanning SoC bus*/
>> + soc_match_t *match_fn; /**< Callback to match dev<->drv */
>> const struct rte_soc_id *id_table; /**< ID table, NULL terminated */
>> };
>>
>> @@ -146,12 +164,63 @@ rte_eal_compare_soc_addr(const struct rte_soc_addr *a0,
>> }
>>
>> /**
>> + * Default function for matching the Soc driver with device. Each driver can
>> + * either use this function or define their own soc matching function.
>> + * This function relies on the compatible string extracted from sysfs. But,
>> + * a SoC might have different way of identifying its devices. Such SoC can
>> + * override match_fn.
>> + *
>> + * @return
>> + * 0 on success
>> + * -1 when no match found
>> + */
>> +int
>> +rte_eal_soc_match_compat(struct rte_soc_driver *drv,
>> + struct rte_soc_device *dev);
>> +
>> +/**
>> + * Probe SoC devices for registered drivers.
>> + *
>> + * @return
>> + * 0 on success
>> + * !0 in case of any failure in probe
>> + */
>> +int rte_eal_soc_probe(void);
>> +
>> +/**
>> + * Probe the single SoC device.
>> + */
>> +int rte_eal_soc_probe_one(const struct rte_soc_addr *addr);
>> +
>> +/**
>> + * Close the single SoC device.
>> + *
>> + * Scan the SoC devices and find the SoC device specified by the SoC
>> + * address, then call the remove() function for registered driver
>> + * that has a matching entry in its id_table for discovered device.
>> + *
>> + * @param addr
>> + * The SoC address to close.
>> + * @return
>> + * - 0 on success.
>> + * - Negative on error.
>> + */
>> +int rte_eal_soc_detach(const struct rte_soc_addr *addr);
>> +
>> +/**
>> * Dump discovered SoC devices.
>> + *
>> + * @param f
>> + * File to dump device info in.
>> */
>> void rte_eal_soc_dump(FILE *f);
>>
>> /**
>> * Register a SoC driver.
>> + *
>> + * @param driver
>> + * Object for SoC driver to register
>> + * @return void
>> */
>> void rte_eal_soc_register(struct rte_soc_driver *driver);
>>
>> @@ -167,6 +236,10 @@ RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
>>
>> /**
>> * Unregister a SoC driver.
>> + *
>> + * @param driver
>> + * Object for SoC driver to unregister
>> + * @return void
>> */
>> void rte_eal_soc_unregister(struct rte_soc_driver *driver);
>>
>> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
>> index 098ba02..bd775f3 100644
>> --- a/lib/librte_eal/linuxapp/eal/eal.c
>> +++ b/lib/librte_eal/linuxapp/eal/eal.c
>> @@ -70,6 +70,7 @@
>> #include <rte_cpuflags.h>
>> #include <rte_interrupts.h>
>> #include <rte_pci.h>
>> +#include <rte_soc.h>
>> #include <rte_dev.h>
>> #include <rte_devargs.h>
>> #include <rte_common.h>
>> @@ -890,6 +891,10 @@ rte_eal_init(int argc, char **argv)
>> if (rte_eal_pci_probe())
>> rte_panic("Cannot probe PCI\n");
>>
>> + /* Probe & Initialize SoC devices */
>> + if (rte_eal_soc_probe())
>> + rte_panic("Cannot probe SoC\n");
>> +
>> rte_eal_mcfg_complete();
>>
>> return fctret;
>> diff --git a/lib/librte_eal/linuxapp/eal/eal_soc.c b/lib/librte_eal/linuxapp/eal/eal_soc.c
>> index 04848b9..3929a76 100644
>> --- a/lib/librte_eal/linuxapp/eal/eal_soc.c
>> +++ b/lib/librte_eal/linuxapp/eal/eal_soc.c
>> @@ -44,13 +44,28 @@
>> #include <rte_log.h>
>> #include <rte_soc.h>
>>
>> -#include "eal_internal_cfg.h"
>> -#include "eal_filesystem.h"
>> -#include "eal_private.h"
>> +#include <eal_internal_cfg.h>
>> +#include <eal_filesystem.h>
>> +#include <eal_private.h>
>>
>> /* Init the SoC EAL subsystem */
>> int
>> rte_eal_soc_init(void)
>> {
>> + struct rte_soc_driver *drv;
>> +
>> + /* SoC is disabled by default */
>> + if (!internal_config.enable_soc)
>> + return 0;
>> +
>> + /* For each registered driver, call their scan routine to perform any
>> + * custom scan for devices (for example, custom buses)
>> + */
>> + TAILQ_FOREACH(drv, &soc_driver_list, next) {
>> + RTE_VERIFY(drv->scan_fn);
>> + drv->scan_fn();
>> + /* Ignore all errors from this */
>> + }
>> +
>> return 0;
>> }
>> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> index 0155025..c28e093 100644
>> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> @@ -175,7 +175,11 @@ DPDK_16.11 {
>> rte_eal_dev_attach;
>> rte_eal_dev_detach;
>> rte_eal_map_resource;
>> + rte_eal_soc_detach;
>> rte_eal_soc_dump;
>> + rte_eal_soc_match;
>> + rte_eal_soc_probe;
>> + rte_eal_soc_probe_one;
>> rte_eal_soc_register;
>> rte_eal_soc_unregister;
>> rte_eal_unmap_resource;
>> --
>> 2.7.4
>>
>
--
-
Shreyansh
^ permalink raw reply
* Re: [PATCH v7 08/21] eal/soc: implement SoC device list and dump
From: Shreyansh Jain @ 2016-11-10 5:56 UTC (permalink / raw)
To: Jianbo Liu; +Cc: dev, Thomas Monjalon, Jan Viktorin
In-Reply-To: <CAP4Qi3-0Ptu4t3XrHhXi8B2bZAB5VugO6hk_Rmm-pDHuHYaeYA@mail.gmail.com>
On Thursday 10 November 2016 08:36 AM, Jianbo Liu wrote:
> On 28 October 2016 at 20:26, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>> From: Jan Viktorin <viktorin@rehivetech.com>
>>
>> SoC devices would be linked in a separate list (from PCI). This is used for
>> probe function.
>> A helper for dumping the device list is added.
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 ++
>> lib/librte_eal/common/eal_common_soc.c | 34 +++++++++++++++++++++++++
>> lib/librte_eal/common/include/rte_soc.h | 9 +++++++
>> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++
>> 4 files changed, 47 insertions(+)
>>
>> diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
>> index cf6fb8e..86e3cfd 100644
>> --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
>> +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
>> @@ -171,11 +171,13 @@ DPDK_16.11 {
>> rte_eal_dev_attach;
>> rte_eal_dev_detach;
>> rte_eal_map_resource;
>> + rte_eal_soc_dump;
>> rte_eal_soc_register;
>> rte_eal_soc_unregister;
>> rte_eal_unmap_resource;
>> rte_eal_vdrv_register;
>> rte_eal_vdrv_unregister;
>> + soc_device_list;
>> soc_driver_list;
>>
>> } DPDK_16.07;
>> diff --git a/lib/librte_eal/common/eal_common_soc.c b/lib/librte_eal/common/eal_common_soc.c
>> index 56135ed..5dcddc5 100644
>> --- a/lib/librte_eal/common/eal_common_soc.c
>> +++ b/lib/librte_eal/common/eal_common_soc.c
>> @@ -31,6 +31,8 @@
>> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>> */
>>
>> +#include <stddef.h>
>> +#include <stdio.h>
>> #include <sys/queue.h>
>>
>> #include <rte_log.h>
>> @@ -40,6 +42,38 @@
>> /* Global SoC driver list */
>> struct soc_driver_list soc_driver_list =
>> TAILQ_HEAD_INITIALIZER(soc_driver_list);
>> +struct soc_device_list soc_device_list =
>> + TAILQ_HEAD_INITIALIZER(soc_device_list);
>> +
>> +/* dump one device */
>> +static int
>> +soc_dump_one_device(FILE *f, struct rte_soc_device *dev)
>> +{
>> + int i;
>> +
>> + fprintf(f, "%s", dev->addr.name);
>> + fprintf(f, " - fdt_path: %s\n",
>> + dev->addr.fdt_path ? dev->addr.fdt_path : "(none)");
>> +
>> + for (i = 0; dev->id && dev->id[i].compatible; ++i)
>> + fprintf(f, " %s\n", dev->id[i].compatible);
>> +
>> + return 0;
>> +}
>> +
>> +/* dump devices on the bus to an output stream */
>> +void
>> +rte_eal_soc_dump(FILE *f)
>> +{
>> + struct rte_soc_device *dev = NULL;
>> +
>> + if (!f)
>> + return;
>> +
>> + TAILQ_FOREACH(dev, &soc_device_list, next) {
>> + soc_dump_one_device(f, dev);
>> + }
>> +}
>>
>> /* register a driver */
>> void
>> diff --git a/lib/librte_eal/common/include/rte_soc.h b/lib/librte_eal/common/include/rte_soc.h
>> index 23b06a9..347e611 100644
>> --- a/lib/librte_eal/common/include/rte_soc.h
>> +++ b/lib/librte_eal/common/include/rte_soc.h
>> @@ -56,8 +56,12 @@ extern "C" {
>>
>> extern struct soc_driver_list soc_driver_list;
>> /**< Global list of SoC Drivers */
>> +extern struct soc_device_list soc_device_list;
>> +/**< Global list of SoC Devices */
>>
>> TAILQ_HEAD(soc_driver_list, rte_soc_driver); /**< SoC drivers in D-linked Q. */
>> +TAILQ_HEAD(soc_device_list, rte_soc_device); /**< SoC devices in D-linked Q. */
>> +
>>
>> struct rte_soc_id {
>> const char *compatible; /**< OF compatible specification */
>> @@ -142,6 +146,11 @@ rte_eal_compare_soc_addr(const struct rte_soc_addr *a0,
>> }
>>
>> /**
>> + * Dump discovered SoC devices.
>> + */
>> +void rte_eal_soc_dump(FILE *f);
>
> If it is to dump device information (not driver), is it proper to
> rename it rte_eal_soc_device_dump()?
Well, 'SoC'=='device' in this context. Isn't it?
In which case, 'soc_device' is just redundant/reuse of a descriptive word.
Or, on a second thought, 'SoC' represents a bus type here. In which
case, this name sounds better. This would also warrant
rte_eal_soc_register->rte_eal_soc_device_register.
But, if I need to keep it in sync with PCI (rte_eal_pci_register), I
think original naming is apt.
I prefer continuing with existing (rte_eal_soc_dump) for this reason.
>
>> +
>> +/**
>> * Register a SoC driver.
>> */
>> void rte_eal_soc_register(struct rte_soc_driver *driver);
>> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> index ab6b985..0155025 100644
>> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
>> @@ -175,11 +175,13 @@ DPDK_16.11 {
>> rte_eal_dev_attach;
>> rte_eal_dev_detach;
>> rte_eal_map_resource;
>> + rte_eal_soc_dump;
>> rte_eal_soc_register;
>> rte_eal_soc_unregister;
>> rte_eal_unmap_resource;
>> rte_eal_vdrv_register;
>> rte_eal_vdrv_unregister;
>> + soc_device_list;
>> soc_driver_list;
>>
>> } DPDK_16.07;
>> --
>> 2.7.4
>>
>
-
Shreyansh
^ permalink raw reply
* Re: [PATCH v7 06/21] eal/soc: introduce very essential SoC infra definitions
From: Shreyansh Jain @ 2016-11-10 5:51 UTC (permalink / raw)
To: Jianbo Liu; +Cc: dev, Thomas Monjalon, Jan Viktorin
In-Reply-To: <CAP4Qi3922y=-ZNH=6-heRJ5kOWYcXHj-gkFyT6yMbW7b+oQ+0w@mail.gmail.com>
On Thursday 10 November 2016 09:39 AM, Jianbo Liu wrote:
> On 28 October 2016 at 20:26, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>> From: Jan Viktorin <viktorin@rehivetech.com>
>>
>> Define initial structures and functions for the SoC infrastructure.
>> This patch supports only a very minimal functions for now.
>> More features will be added in the following commits.
>>
>> Includes rte_device/rte_driver inheritance of
>> rte_soc_device/rte_soc_driver.
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>> app/test/Makefile | 1 +
>> app/test/test_soc.c | 90 +++++++++++++++++++++
>> lib/librte_eal/common/Makefile | 2 +-
>> lib/librte_eal/common/eal_private.h | 4 +
>> lib/librte_eal/common/include/rte_soc.h | 138 ++++++++++++++++++++++++++++++++
>> 5 files changed, 234 insertions(+), 1 deletion(-)
>> create mode 100644 app/test/test_soc.c
>> create mode 100644 lib/librte_eal/common/include/rte_soc.h
>>
> ....
>
>
>> +/**
>> + * Utility function to write a SoC device name, this device name can later be
>> + * used to retrieve the corresponding rte_soc_addr using above functions.
>> + *
>> + * @param addr
>> + * The SoC address
>> + * @param output
>> + * The output buffer string
>> + * @param size
>> + * The output buffer size
>> + * @return
>> + * 0 on success, negative on error.
>> + */
>> +static inline void
>> +rte_eal_soc_device_name(const struct rte_soc_addr *addr,
>> + char *output, size_t size)
>> +{
>> + int ret;
>> +
>> + RTE_VERIFY(addr != NULL);
>> + RTE_VERIFY(size >= strlen(addr->name));
>
> Is it better to use (size > strlen(addr->name)?
Yes, I missed the '\0' in this.
I will fix this.
>
>> + ret = snprintf(output, size, "%s", addr->name);
>> + RTE_VERIFY(ret >= 0);
>> +}
>> +
>> +static inline int
>> +rte_eal_compare_soc_addr(const struct rte_soc_addr *a0,
>> + const struct rte_soc_addr *a1)
>> +{
>> + if (a0 == NULL || a1 == NULL)
>> + return -1;
>> +
>> + RTE_VERIFY(a0->name != NULL);
>> + RTE_VERIFY(a1->name != NULL);
>> +
>> + return strcmp(a0->name, a1->name);
>> +}
>> +
>> +#endif
>> --
>> 2.7.4
>>
>
--
-
Shreyansh
^ permalink raw reply
* Re: [PATCH] examples/l3fwd: force CRC stripping for i40evf
From: Yao, Lei A @ 2016-11-10 5:49 UTC (permalink / raw)
To: Topel, Bjorn, Zhang, Helin, Ananyev, Konstantin, dev@dpdk.org
Cc: Xu, Qian Q, Wu, Jingjing, thomas.monjalon@6wind.com
In-Reply-To: <d17063d2-e617-b9a2-bd68-2086f9aa8cf4@intel.com>
I'm testing some DPDK sample under VMware. During the testing work, I find l3fwd+ ixgbe vf can work ,but L3fwd + i40evf can't work. So I reported this issue to Bjorn. From my perspective, if can add new parameter in l3fwd sample like what have already don’t in testpmd "----crc-strip enable" is a better way to resolve this issue.
Lei
-----Original Message-----
From: Topel, Bjorn
Sent: Wednesday, November 9, 2016 9:10 PM
To: Zhang, Helin <helin.zhang@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>; dev@dpdk.org
Cc: Xu, Qian Q <qian.q.xu@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; thomas.monjalon@6wind.com
Subject: Re: [dpdk-dev] [PATCH] examples/l3fwd: force CRC stripping for i40evf
Björn/Konstantin wrote:
>> Finally, why doesn't l3fwd have the CRC stripped?
>
> I don’t know any good reason for that for l3fwd or any other sample
> app. I think it is just a 'historical' reason.
Ok! Then I'd suggest changing the l3fwd default to actually *strip* CRC instead of not doing it. Lei, any comments?
Helin wrote:
> Yes, i40e driver changed a little bit on that according to the review
> comments during implementation, comparing to igb and ixgbe.
> I'd suggest to re-invesitgate if we can do the similar thing in igb
> and ixgbe driver.
Good. Let's do that!
> Any critical issue now? Or just an improvement comments?
Not from my perspective. The issue is that Lei needs some kind of work-around for l3fwd with i40evf, so I'll let Lei comment on how critical it is.
Björn
^ permalink raw reply
* Re: [PATCH v7 03/21] eal/linux: generalize PCI kernel unbinding driver to EAL
From: Shreyansh Jain @ 2016-11-10 5:46 UTC (permalink / raw)
To: Jianbo Liu; +Cc: dev, Thomas Monjalon, Jan Viktorin
In-Reply-To: <CAP4Qi3-otsQwjMmnW1TrmCkLcy-C+WGLCF_h82WKiqhfCca=SQ@mail.gmail.com>
Hello Jianbo,
Thanks a lot for your time in commenting this. My comments inline (as
well as on other similar mails).
On Thursday 10 November 2016 07:54 AM, Jianbo Liu wrote:
> On 28 October 2016 at 20:26, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>> From: Jan Viktorin <viktorin@rehivetech.com>
>>
>> Generalize the PCI-specific pci_unbind_kernel_driver. It is now divided
>> into two parts. First, determination of the path and string identification
>> of the device to be unbound. Second, the actual unbind operation which is
>> generic.
>>
>> BSD implementation updated as ENOTSUP
>>
>> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> --
>> Changes since v2:
>> - update BSD support for unbind kernel driver
>> ---
>> lib/librte_eal/bsdapp/eal/eal.c | 7 +++++++
>> lib/librte_eal/bsdapp/eal/eal_pci.c | 4 ++--
>> lib/librte_eal/common/eal_private.h | 13 +++++++++++++
>> lib/librte_eal/linuxapp/eal/eal.c | 26 ++++++++++++++++++++++++++
>> lib/librte_eal/linuxapp/eal/eal_pci.c | 33 +++++++++------------------------
>> 5 files changed, 57 insertions(+), 26 deletions(-)
>>
>> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
>> index 35e3117..5271fc2 100644
>> --- a/lib/librte_eal/bsdapp/eal/eal.c
>> +++ b/lib/librte_eal/bsdapp/eal/eal.c
>> @@ -633,3 +633,10 @@ rte_eal_process_type(void)
>> {
>> return rte_config.process_type;
>> }
>> +
>> +int
>> +rte_eal_unbind_kernel_driver(const char *devpath __rte_unused,
>> + const char *devid __rte_unused)
>> +{
>> + return -ENOTSUP;
>> +}
>> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
>> index 7ed0115..703f034 100644
>> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
>> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
>> @@ -89,11 +89,11 @@
>>
>> /* unbind kernel driver for this device */
>> int
>> -pci_unbind_kernel_driver(struct rte_pci_device *dev __rte_unused)
>> +pci_unbind_kernel_driver(struct rte_pci_device *dev)
>> {
>> RTE_LOG(ERR, EAL, "RTE_PCI_DRV_FORCE_UNBIND flag is not implemented "
>> "for BSD\n");
>> - return -ENOTSUP;
>> + return rte_eal_unbind_kernel_driver(dev);
>
> Missing the second parameter for devid.
Indeed. I will fix this.
Being BSD, I didn't compile test this part. I will have to find a way to
fix this in my sanity before sending next series.
>
>> }
>>
>> /* Map pci device */
>> diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
>> index 9e7d8f6..b0c208a 100644
>> --- a/lib/librte_eal/common/eal_private.h
>> +++ b/lib/librte_eal/common/eal_private.h
>> @@ -256,6 +256,19 @@ int rte_eal_alarm_init(void);
>> int rte_eal_check_module(const char *module_name);
>>
>> /**
>> + * Unbind kernel driver bound to the device specified by the given devpath,
>> + * and its string identification.
>> + *
>> + * @param devpath path to the device directory ("/sys/.../devices/<name>")
>> + * @param devid identification of the device (<name>)
>> + *
>> + * @return
>> + * -1 unbind has failed
>> + * 0 module has been unbound
>> + */
>> +int rte_eal_unbind_kernel_driver(const char *devpath, const char *devid);
>> +
>> +/**
>> * Get cpu core_id.
>> *
>> * This function is private to the EAL.
>> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
>> index 2075282..5f6676d 100644
>> --- a/lib/librte_eal/linuxapp/eal/eal.c
>> +++ b/lib/librte_eal/linuxapp/eal/eal.c
>> @@ -943,3 +943,29 @@ rte_eal_check_module(const char *module_name)
>> /* Module has been found */
>> return 1;
>> }
>> +
>> +int
>> +rte_eal_unbind_kernel_driver(const char *devpath, const char *devid)
>> +{
>> + char filename[PATH_MAX];
>> + FILE *f;
>> +
>> + snprintf(filename, sizeof(filename),
>> + "%s/driver/unbind", devpath);
>> +
>> + f = fopen(filename, "w");
>> + if (f == NULL) /* device was not bound */
>> + return 0;
>> +
>> + if (fwrite(devid, strlen(devid), 1, f) == 0) {
>> + RTE_LOG(ERR, EAL, "%s(): could not write to %s\n", __func__,
>> + filename);
>> + goto error;
>> + }
>> +
>> + fclose(f);
>> + return 0;
>> +error:
>> + fclose(f);
>> + return -1;
>> +}
>> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
>> index 876ba38..a03553f 100644
>> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
>> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
>> @@ -59,38 +59,23 @@ int
>> pci_unbind_kernel_driver(struct rte_pci_device *dev)
>> {
>> int n;
>> - FILE *f;
>> - char filename[PATH_MAX];
>> - char buf[BUFSIZ];
>> + char devpath[PATH_MAX];
>> + char devid[BUFSIZ];
>> struct rte_pci_addr *loc = &dev->addr;
>>
>> - /* open /sys/bus/pci/devices/AAAA:BB:CC.D/driver */
>> - snprintf(filename, sizeof(filename),
>> - "%s/" PCI_PRI_FMT "/driver/unbind", pci_get_sysfs_path(),
>> + /* devpath /sys/bus/pci/devices/AAAA:BB:CC.D */
>> + snprintf(devpath, sizeof(devpath),
>> + "%s/" PCI_PRI_FMT, pci_get_sysfs_path(),
>> loc->domain, loc->bus, loc->devid, loc->function);
>>
>> - f = fopen(filename, "w");
>> - if (f == NULL) /* device was not bound */
>> - return 0;
>> -
>> - n = snprintf(buf, sizeof(buf), PCI_PRI_FMT "\n",
>> + n = snprintf(devid, sizeof(devid), PCI_PRI_FMT "\n",
>> loc->domain, loc->bus, loc->devid, loc->function);
>> - if ((n < 0) || (n >= (int)sizeof(buf))) {
>> + if ((n < 0) || (n >= (int)sizeof(devid))) {
>> RTE_LOG(ERR, EAL, "%s(): snprintf failed\n", __func__);
>> - goto error;
>> - }
>> - if (fwrite(buf, n, 1, f) == 0) {
>> - RTE_LOG(ERR, EAL, "%s(): could not write to %s\n", __func__,
>> - filename);
>> - goto error;
>> + return -1;
>> }
>>
>> - fclose(f);
>> - return 0;
>> -
>> -error:
>> - fclose(f);
>> - return -1;
>> + return rte_eal_unbind_kernel_driver(devpath, devid);
>> }
>>
>> static int
>> --
>> 2.7.4
>>
>
-
Shreyansh
^ permalink raw reply
* Re: [PATCH v7 06/21] eal/soc: introduce very essential SoC infra definitions
From: Jianbo Liu @ 2016-11-10 4:09 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, Thomas Monjalon, Jan Viktorin
In-Reply-To: <1477657598-826-7-git-send-email-shreyansh.jain@nxp.com>
On 28 October 2016 at 20:26, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> From: Jan Viktorin <viktorin@rehivetech.com>
>
> Define initial structures and functions for the SoC infrastructure.
> This patch supports only a very minimal functions for now.
> More features will be added in the following commits.
>
> Includes rte_device/rte_driver inheritance of
> rte_soc_device/rte_soc_driver.
>
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
> app/test/Makefile | 1 +
> app/test/test_soc.c | 90 +++++++++++++++++++++
> lib/librte_eal/common/Makefile | 2 +-
> lib/librte_eal/common/eal_private.h | 4 +
> lib/librte_eal/common/include/rte_soc.h | 138 ++++++++++++++++++++++++++++++++
> 5 files changed, 234 insertions(+), 1 deletion(-)
> create mode 100644 app/test/test_soc.c
> create mode 100644 lib/librte_eal/common/include/rte_soc.h
>
...
> +/**
> + * Utility function to write a SoC device name, this device name can later be
> + * used to retrieve the corresponding rte_soc_addr using above functions.
> + *
> + * @param addr
> + * The SoC address
> + * @param output
> + * The output buffer string
> + * @param size
> + * The output buffer size
> + * @return
> + * 0 on success, negative on error.
> + */
> +static inline void
> +rte_eal_soc_device_name(const struct rte_soc_addr *addr,
> + char *output, size_t size)
> +{
> + int ret;
> +
> + RTE_VERIFY(addr != NULL);
> + RTE_VERIFY(size >= strlen(addr->name));
Is it better to use (size > strlen(addr->name)?
> + ret = snprintf(output, size, "%s", addr->name);
> + RTE_VERIFY(ret >= 0);
> +}
> +
> +static inline int
> +rte_eal_compare_soc_addr(const struct rte_soc_addr *a0,
> + const struct rte_soc_addr *a1)
> +{
> + if (a0 == NULL || a1 == NULL)
> + return -1;
> +
> + RTE_VERIFY(a0->name != NULL);
> + RTE_VERIFY(a1->name != NULL);
> +
> + return strcmp(a0->name, a1->name);
> +}
> +
> +#endif
> --
> 2.7.4
>
^ permalink raw reply
* Re: [PATCH v7 11/21] eal/soc: implement probing of drivers
From: Jianbo Liu @ 2016-11-10 3:30 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, Thomas Monjalon, Jan Viktorin
In-Reply-To: <1477657598-826-12-git-send-email-shreyansh.jain@nxp.com>
On 28 October 2016 at 20:26, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Each SoC PMD registers a set of callback for scanning its own bus/infra and
> matching devices to drivers when probe is called.
> This patch introduces the infra for calls to SoC scan on rte_eal_soc_init()
> and match on rte_eal_soc_probe().
>
> Patch also adds test case for scan and probe.
>
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> --
> v4:
> - Update test_soc for descriptive test function names
> - Comments over test functions
> - devinit and devuninint --> probe/remove
> - RTE_VERIFY at some places
> ---
> app/test/test_soc.c | 205 ++++++++++++++++++++++-
> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 4 +
> lib/librte_eal/common/eal_common_soc.c | 213 +++++++++++++++++++++++-
> lib/librte_eal/common/include/rte_soc.h | 75 ++++++++-
> lib/librte_eal/linuxapp/eal/eal.c | 5 +
> lib/librte_eal/linuxapp/eal/eal_soc.c | 21 ++-
> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 4 +
> 7 files changed, 519 insertions(+), 8 deletions(-)
>
.....
> /**
> + * SoC device scan callback, called from rte_eal_soc_init.
> + * For various SoC, the bus on which devices are attached maynot be compliant
> + * to a standard platform (or platform bus itself). In which case, extra
> + * steps are implemented by PMD to scan over the bus and add devices to SoC
> + * device list.
> + */
> +typedef void (soc_scan_t)(void);
I'm still not sure about the purpose of soc_scan, and how to use it.
If it's for each driver, it should at least struct rte_soc_driver * as
its parameter.
If it's for each bus, why it is in rte_soc_driver?
I know you will implement bus driver in the future, but we need to
make it clear for current simplified implementation.
> +
> +/**
> + * Custom device<=>driver match callback for SoC
> + * Unlike PCI, SoC devices don't have a fixed definition of device
> + * identification. PMDs can implement a specific matching function in which
> + * driver and device objects are provided to perform custom match.
> + */
> +typedef int (soc_match_t)(struct rte_soc_driver *, struct rte_soc_device *);
> +
> +/**
> * A structure describing a SoC driver.
> */
> struct rte_soc_driver {
> @@ -104,6 +120,8 @@ struct rte_soc_driver {
> struct rte_driver driver; /**< Inherit core driver. */
> soc_probe_t *probe; /**< Device probe */
> soc_remove_t *remove; /**< Device remove */
> + soc_scan_t *scan_fn; /**< Callback for scanning SoC bus*/
> + soc_match_t *match_fn; /**< Callback to match dev<->drv */
> const struct rte_soc_id *id_table; /**< ID table, NULL terminated */
> };
>
> @@ -146,12 +164,63 @@ rte_eal_compare_soc_addr(const struct rte_soc_addr *a0,
> }
>
> /**
> + * Default function for matching the Soc driver with device. Each driver can
> + * either use this function or define their own soc matching function.
> + * This function relies on the compatible string extracted from sysfs. But,
> + * a SoC might have different way of identifying its devices. Such SoC can
> + * override match_fn.
> + *
> + * @return
> + * 0 on success
> + * -1 when no match found
> + */
> +int
> +rte_eal_soc_match_compat(struct rte_soc_driver *drv,
> + struct rte_soc_device *dev);
> +
> +/**
> + * Probe SoC devices for registered drivers.
> + *
> + * @return
> + * 0 on success
> + * !0 in case of any failure in probe
> + */
> +int rte_eal_soc_probe(void);
> +
> +/**
> + * Probe the single SoC device.
> + */
> +int rte_eal_soc_probe_one(const struct rte_soc_addr *addr);
> +
> +/**
> + * Close the single SoC device.
> + *
> + * Scan the SoC devices and find the SoC device specified by the SoC
> + * address, then call the remove() function for registered driver
> + * that has a matching entry in its id_table for discovered device.
> + *
> + * @param addr
> + * The SoC address to close.
> + * @return
> + * - 0 on success.
> + * - Negative on error.
> + */
> +int rte_eal_soc_detach(const struct rte_soc_addr *addr);
> +
> +/**
> * Dump discovered SoC devices.
> + *
> + * @param f
> + * File to dump device info in.
> */
> void rte_eal_soc_dump(FILE *f);
>
> /**
> * Register a SoC driver.
> + *
> + * @param driver
> + * Object for SoC driver to register
> + * @return void
> */
> void rte_eal_soc_register(struct rte_soc_driver *driver);
>
> @@ -167,6 +236,10 @@ RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
>
> /**
> * Unregister a SoC driver.
> + *
> + * @param driver
> + * Object for SoC driver to unregister
> + * @return void
> */
> void rte_eal_soc_unregister(struct rte_soc_driver *driver);
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
> index 098ba02..bd775f3 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -70,6 +70,7 @@
> #include <rte_cpuflags.h>
> #include <rte_interrupts.h>
> #include <rte_pci.h>
> +#include <rte_soc.h>
> #include <rte_dev.h>
> #include <rte_devargs.h>
> #include <rte_common.h>
> @@ -890,6 +891,10 @@ rte_eal_init(int argc, char **argv)
> if (rte_eal_pci_probe())
> rte_panic("Cannot probe PCI\n");
>
> + /* Probe & Initialize SoC devices */
> + if (rte_eal_soc_probe())
> + rte_panic("Cannot probe SoC\n");
> +
> rte_eal_mcfg_complete();
>
> return fctret;
> diff --git a/lib/librte_eal/linuxapp/eal/eal_soc.c b/lib/librte_eal/linuxapp/eal/eal_soc.c
> index 04848b9..3929a76 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_soc.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_soc.c
> @@ -44,13 +44,28 @@
> #include <rte_log.h>
> #include <rte_soc.h>
>
> -#include "eal_internal_cfg.h"
> -#include "eal_filesystem.h"
> -#include "eal_private.h"
> +#include <eal_internal_cfg.h>
> +#include <eal_filesystem.h>
> +#include <eal_private.h>
>
> /* Init the SoC EAL subsystem */
> int
> rte_eal_soc_init(void)
> {
> + struct rte_soc_driver *drv;
> +
> + /* SoC is disabled by default */
> + if (!internal_config.enable_soc)
> + return 0;
> +
> + /* For each registered driver, call their scan routine to perform any
> + * custom scan for devices (for example, custom buses)
> + */
> + TAILQ_FOREACH(drv, &soc_driver_list, next) {
> + RTE_VERIFY(drv->scan_fn);
> + drv->scan_fn();
> + /* Ignore all errors from this */
> + }
> +
> return 0;
> }
> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> index 0155025..c28e093 100644
> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> @@ -175,7 +175,11 @@ DPDK_16.11 {
> rte_eal_dev_attach;
> rte_eal_dev_detach;
> rte_eal_map_resource;
> + rte_eal_soc_detach;
> rte_eal_soc_dump;
> + rte_eal_soc_match;
> + rte_eal_soc_probe;
> + rte_eal_soc_probe_one;
> rte_eal_soc_register;
> rte_eal_soc_unregister;
> rte_eal_unmap_resource;
> --
> 2.7.4
>
^ permalink raw reply
* Re: [PATCH v7 08/21] eal/soc: implement SoC device list and dump
From: Jianbo Liu @ 2016-11-10 3:06 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, Thomas Monjalon, Jan Viktorin
In-Reply-To: <1477657598-826-9-git-send-email-shreyansh.jain@nxp.com>
On 28 October 2016 at 20:26, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> From: Jan Viktorin <viktorin@rehivetech.com>
>
> SoC devices would be linked in a separate list (from PCI). This is used for
> probe function.
> A helper for dumping the device list is added.
>
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 ++
> lib/librte_eal/common/eal_common_soc.c | 34 +++++++++++++++++++++++++
> lib/librte_eal/common/include/rte_soc.h | 9 +++++++
> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++
> 4 files changed, 47 insertions(+)
>
> diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> index cf6fb8e..86e3cfd 100644
> --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> @@ -171,11 +171,13 @@ DPDK_16.11 {
> rte_eal_dev_attach;
> rte_eal_dev_detach;
> rte_eal_map_resource;
> + rte_eal_soc_dump;
> rte_eal_soc_register;
> rte_eal_soc_unregister;
> rte_eal_unmap_resource;
> rte_eal_vdrv_register;
> rte_eal_vdrv_unregister;
> + soc_device_list;
> soc_driver_list;
>
> } DPDK_16.07;
> diff --git a/lib/librte_eal/common/eal_common_soc.c b/lib/librte_eal/common/eal_common_soc.c
> index 56135ed..5dcddc5 100644
> --- a/lib/librte_eal/common/eal_common_soc.c
> +++ b/lib/librte_eal/common/eal_common_soc.c
> @@ -31,6 +31,8 @@
> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> */
>
> +#include <stddef.h>
> +#include <stdio.h>
> #include <sys/queue.h>
>
> #include <rte_log.h>
> @@ -40,6 +42,38 @@
> /* Global SoC driver list */
> struct soc_driver_list soc_driver_list =
> TAILQ_HEAD_INITIALIZER(soc_driver_list);
> +struct soc_device_list soc_device_list =
> + TAILQ_HEAD_INITIALIZER(soc_device_list);
> +
> +/* dump one device */
> +static int
> +soc_dump_one_device(FILE *f, struct rte_soc_device *dev)
> +{
> + int i;
> +
> + fprintf(f, "%s", dev->addr.name);
> + fprintf(f, " - fdt_path: %s\n",
> + dev->addr.fdt_path ? dev->addr.fdt_path : "(none)");
> +
> + for (i = 0; dev->id && dev->id[i].compatible; ++i)
> + fprintf(f, " %s\n", dev->id[i].compatible);
> +
> + return 0;
> +}
> +
> +/* dump devices on the bus to an output stream */
> +void
> +rte_eal_soc_dump(FILE *f)
> +{
> + struct rte_soc_device *dev = NULL;
> +
> + if (!f)
> + return;
> +
> + TAILQ_FOREACH(dev, &soc_device_list, next) {
> + soc_dump_one_device(f, dev);
> + }
> +}
>
> /* register a driver */
> void
> diff --git a/lib/librte_eal/common/include/rte_soc.h b/lib/librte_eal/common/include/rte_soc.h
> index 23b06a9..347e611 100644
> --- a/lib/librte_eal/common/include/rte_soc.h
> +++ b/lib/librte_eal/common/include/rte_soc.h
> @@ -56,8 +56,12 @@ extern "C" {
>
> extern struct soc_driver_list soc_driver_list;
> /**< Global list of SoC Drivers */
> +extern struct soc_device_list soc_device_list;
> +/**< Global list of SoC Devices */
>
> TAILQ_HEAD(soc_driver_list, rte_soc_driver); /**< SoC drivers in D-linked Q. */
> +TAILQ_HEAD(soc_device_list, rte_soc_device); /**< SoC devices in D-linked Q. */
> +
>
> struct rte_soc_id {
> const char *compatible; /**< OF compatible specification */
> @@ -142,6 +146,11 @@ rte_eal_compare_soc_addr(const struct rte_soc_addr *a0,
> }
>
> /**
> + * Dump discovered SoC devices.
> + */
> +void rte_eal_soc_dump(FILE *f);
If it is to dump device information (not driver), is it proper to
rename it rte_eal_soc_device_dump()?
> +
> +/**
> * Register a SoC driver.
> */
> void rte_eal_soc_register(struct rte_soc_driver *driver);
> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> index ab6b985..0155025 100644
> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> @@ -175,11 +175,13 @@ DPDK_16.11 {
> rte_eal_dev_attach;
> rte_eal_dev_detach;
> rte_eal_map_resource;
> + rte_eal_soc_dump;
> rte_eal_soc_register;
> rte_eal_soc_unregister;
> rte_eal_unmap_resource;
> rte_eal_vdrv_register;
> rte_eal_vdrv_unregister;
> + soc_device_list;
> soc_driver_list;
>
> } DPDK_16.07;
> --
> 2.7.4
>
^ permalink raw reply
* Re: [PATCH] app/test: fix crash of lpm test
From: Dai, Wei @ 2016-11-10 2:59 UTC (permalink / raw)
To: Olivier Matz, dev@dpdk.org; +Cc: Richardson, Bruce
In-Reply-To: <1478696906-20948-1-git-send-email-olivier.matz@6wind.com>
Hi, Oliver
Thanks for your catching this bug.
After reviewing related codes, I can acknowledge it.
Thanks
-Wei
> -----Original Message-----
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> Sent: Wednesday, November 9, 2016 9:08 PM
> To: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>
> Cc: Richardson, Bruce <bruce.richardson@intel.com>
> Subject: [PATCH] app/test: fix crash of lpm test
>
> The test recently added accesses to lpm->tbl8[ip >> 8] with is much larger than
> the size of the table, causing a crash of the test application.
>
> Fix this typo by replacing tbl8 by tbl24.
>
> Fixes: 231fa88ed522 ("app/test: verify LPM tbl8 recycle")
>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Wei Dai <wei.dai@intle.com>
> ---
>
> Hi Wei,
>
> I don't know lpm very well and I did not spend much time to understand the
> test case. I guess that's the proper fix, but please check carefully that I'm not
> doing something wrong :)
>
> Thanks,
> Olivier
>
>
> app/test/test_lpm.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c index 80e0efc..41ae80f
> 100644
> --- a/app/test/test_lpm.c
> +++ b/app/test/test_lpm.c
> @@ -1256,7 +1256,7 @@ test18(void)
> rte_lpm_add(lpm, ip, depth, next_hop);
>
> TEST_LPM_ASSERT(lpm->tbl24[ip>>8].valid_group);
> - tbl8_group_index = lpm->tbl8[ip>>8].group_idx;
> + tbl8_group_index = lpm->tbl24[ip>>8].group_idx;
>
> depth = 23;
> next_hop = 2;
> @@ -1272,7 +1272,7 @@ test18(void)
> rte_lpm_add(lpm, ip, depth, next_hop);
>
> TEST_LPM_ASSERT(lpm->tbl24[ip>>8].valid_group);
> - TEST_LPM_ASSERT(tbl8_group_index == lpm->tbl8[ip>>8].group_idx);
> + TEST_LPM_ASSERT(tbl8_group_index == lpm->tbl24[ip>>8].group_idx);
>
> depth = 24;
> next_hop = 4;
> @@ -1288,7 +1288,7 @@ test18(void)
> rte_lpm_add(lpm, ip, depth, next_hop);
>
> TEST_LPM_ASSERT(lpm->tbl24[ip>>8].valid_group);
> - TEST_LPM_ASSERT(tbl8_group_index == lpm->tbl8[ip>>8].group_idx);
> + TEST_LPM_ASSERT(tbl8_group_index == lpm->tbl24[ip>>8].group_idx);
>
> rte_lpm_free(lpm);
> #undef group_idx
> --
> 2.8.1
^ permalink raw reply
* Re: [PATCH v3] net/qede: fix advertising link speed capability
From: Harish Patil @ 2016-11-10 2:54 UTC (permalink / raw)
To: Thomas Monjalon, Mody, Rasesh
Cc: bruce.richardson@intel.com, dev@dpdk.org, Dept-Eng DPDK Dev
In-Reply-To: <1656706.VhxROYD8UU@xps13>
>
>2016-10-31 11:35, Rasesh Mody:
>> From: Harish Patil <harish.patil@qlogic.com>
>>
>> Fix to advertise device's link speed capability based on NVM
>> port configuration instead of returning driver supported speeds.
>>
>> Fixes: 95e67b479506 ("net/qede: add 100G link speed capability")
>>
>> Signed-off-by: Harish Patil <harish.patil@qlogic.com>
>[...]
>> + /* Fill up the native advertised speed */
>> + switch (params.speed.advertised_speeds) {
>> + case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_10G:
>> + adv_speed = 10000;
>> + break;
>> + case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_25G:
>> + adv_speed = 25000;
>> + break;
>> + case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_40G:
>> + adv_speed = 40000;
>> + break;
>> + case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_50G:
>> + adv_speed = 50000;
>> + break;
>> + case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_BB_100G:
>> + adv_speed = 100000;
>> + break;
>> + default:
>> + DP_NOTICE(hwfn, false, "Unknown speed\n");
>> + adv_speed = 0;
>> + }
>> + if_link->adv_speed = adv_speed;
>
>The qede devices support only one speed?
>I guess it is wrong but it is a step in right direction so it
>will be enough for 16.11.
>
>Applied
>
qede device is capable of 10, 25, 40, 50, 100Gb speeds.
It's configured at factory to have 100Gb, 50Gb, 40Gb or 25Gb speeds.
A unique PCI ID gets assigned to the device based on the speed configured.
25G device can auto-negotiate down to 10G speeds when connected to a 10G
switch.
So only for 25G case the above logic does not work correctly, for which I
have a submitted a minor fix today:
("[PATCH] net/qede: fix unknown speed errmsg for 25G link”). Pls include
it in 16.11.
Thanks,
Harish
^ permalink raw reply
* [PATCH] net/qede: fix unknown speed errmsg for 25G link
From: Rasesh Mody @ 2016-11-10 2:26 UTC (permalink / raw)
To: dev; +Cc: Dept-EngDPDKDev, Harish Patil
From: Harish Patil <harish.patil@qlogic.com>
Fix to use bitmapped values in NVM configuration for speed capability
advertisement. This issue is specific to 25G NIC since it is capable
of 25G and 10G speeds.
Fixes: 64c239b7f8b7 ("net/qede: fix advertising link speed capability")
Signed-off-by: Harish Patil <harish.patil@qlogic.com>
---
drivers/net/qede/qede_ethdev.c | 15 ++++++++++++++-
drivers/net/qede/qede_if.h | 2 +-
drivers/net/qede/qede_main.c | 25 ++-----------------------
3 files changed, 17 insertions(+), 25 deletions(-)
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 59129f2..f57f80d 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -647,6 +647,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
struct qede_dev *qdev = eth_dev->data->dev_private;
struct ecore_dev *edev = &qdev->edev;
struct qed_link_output link;
+ uint32_t speed_cap = 0;
PMD_INIT_FUNC_TRACE(edev);
@@ -681,7 +682,19 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
memset(&link, 0, sizeof(struct qed_link_output));
qdev->ops->common->get_link(edev, &link);
- dev_info->speed_capa = rte_eth_speed_bitflag(link.adv_speed, 0);
+ if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_1G)
+ speed_cap |= ETH_LINK_SPEED_1G;
+ if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_10G)
+ speed_cap |= ETH_LINK_SPEED_10G;
+ if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_25G)
+ speed_cap |= ETH_LINK_SPEED_25G;
+ if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_40G)
+ speed_cap |= ETH_LINK_SPEED_40G;
+ if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_50G)
+ speed_cap |= ETH_LINK_SPEED_50G;
+ if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_BB_100G)
+ speed_cap |= ETH_LINK_SPEED_100G;
+ dev_info->speed_capa = speed_cap;
}
/* return 0 means link status changed, -1 means not changed */
diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h
index 4936349..2131fe2 100644
--- a/drivers/net/qede/qede_if.h
+++ b/drivers/net/qede/qede_if.h
@@ -70,7 +70,7 @@ struct qed_link_output {
uint32_t advertised_caps; /* In ADVERTISED defs */
uint32_t lp_caps; /* In ADVERTISED defs */
uint32_t speed; /* In Mb/s */
- uint32_t adv_speed; /* In Mb/s */
+ uint32_t adv_speed; /* Speed mask */
uint8_t duplex; /* In DUPLEX defs */
uint8_t port; /* In PORT defs */
bool autoneg;
diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index d2e476c..ab22409 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -488,7 +488,6 @@ static void qed_fill_link(struct ecore_hwfn *hwfn,
struct ecore_mcp_link_state link;
struct ecore_mcp_link_capabilities link_caps;
uint32_t media_type;
- uint32_t adv_speed;
uint8_t change = 0;
memset(if_link, 0, sizeof(*if_link));
@@ -516,28 +515,8 @@ static void qed_fill_link(struct ecore_hwfn *hwfn,
if_link->duplex = QEDE_DUPLEX_FULL;
- /* Fill up the native advertised speed */
- switch (params.speed.advertised_speeds) {
- case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_10G:
- adv_speed = 10000;
- break;
- case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_25G:
- adv_speed = 25000;
- break;
- case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_40G:
- adv_speed = 40000;
- break;
- case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_50G:
- adv_speed = 50000;
- break;
- case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_BB_100G:
- adv_speed = 100000;
- break;
- default:
- DP_NOTICE(hwfn, false, "Unknown speed\n");
- adv_speed = 0;
- }
- if_link->adv_speed = adv_speed;
+ /* Fill up the native advertised speed cap mask */
+ if_link->adv_speed = params.speed.advertised_speeds;
if (params.speed.autoneg)
if_link->supported_caps |= QEDE_SUPPORTED_AUTONEG;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v7 03/21] eal/linux: generalize PCI kernel unbinding driver to EAL
From: Jianbo Liu @ 2016-11-10 2:24 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, Thomas Monjalon, Jan Viktorin
In-Reply-To: <1477657598-826-4-git-send-email-shreyansh.jain@nxp.com>
On 28 October 2016 at 20:26, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> From: Jan Viktorin <viktorin@rehivetech.com>
>
> Generalize the PCI-specific pci_unbind_kernel_driver. It is now divided
> into two parts. First, determination of the path and string identification
> of the device to be unbound. Second, the actual unbind operation which is
> generic.
>
> BSD implementation updated as ENOTSUP
>
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> --
> Changes since v2:
> - update BSD support for unbind kernel driver
> ---
> lib/librte_eal/bsdapp/eal/eal.c | 7 +++++++
> lib/librte_eal/bsdapp/eal/eal_pci.c | 4 ++--
> lib/librte_eal/common/eal_private.h | 13 +++++++++++++
> lib/librte_eal/linuxapp/eal/eal.c | 26 ++++++++++++++++++++++++++
> lib/librte_eal/linuxapp/eal/eal_pci.c | 33 +++++++++------------------------
> 5 files changed, 57 insertions(+), 26 deletions(-)
>
> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
> index 35e3117..5271fc2 100644
> --- a/lib/librte_eal/bsdapp/eal/eal.c
> +++ b/lib/librte_eal/bsdapp/eal/eal.c
> @@ -633,3 +633,10 @@ rte_eal_process_type(void)
> {
> return rte_config.process_type;
> }
> +
> +int
> +rte_eal_unbind_kernel_driver(const char *devpath __rte_unused,
> + const char *devid __rte_unused)
> +{
> + return -ENOTSUP;
> +}
> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
> index 7ed0115..703f034 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
> @@ -89,11 +89,11 @@
>
> /* unbind kernel driver for this device */
> int
> -pci_unbind_kernel_driver(struct rte_pci_device *dev __rte_unused)
> +pci_unbind_kernel_driver(struct rte_pci_device *dev)
> {
> RTE_LOG(ERR, EAL, "RTE_PCI_DRV_FORCE_UNBIND flag is not implemented "
> "for BSD\n");
> - return -ENOTSUP;
> + return rte_eal_unbind_kernel_driver(dev);
Missing the second parameter for devid.
> }
>
> /* Map pci device */
> diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
> index 9e7d8f6..b0c208a 100644
> --- a/lib/librte_eal/common/eal_private.h
> +++ b/lib/librte_eal/common/eal_private.h
> @@ -256,6 +256,19 @@ int rte_eal_alarm_init(void);
> int rte_eal_check_module(const char *module_name);
>
> /**
> + * Unbind kernel driver bound to the device specified by the given devpath,
> + * and its string identification.
> + *
> + * @param devpath path to the device directory ("/sys/.../devices/<name>")
> + * @param devid identification of the device (<name>)
> + *
> + * @return
> + * -1 unbind has failed
> + * 0 module has been unbound
> + */
> +int rte_eal_unbind_kernel_driver(const char *devpath, const char *devid);
> +
> +/**
> * Get cpu core_id.
> *
> * This function is private to the EAL.
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
> index 2075282..5f6676d 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -943,3 +943,29 @@ rte_eal_check_module(const char *module_name)
> /* Module has been found */
> return 1;
> }
> +
> +int
> +rte_eal_unbind_kernel_driver(const char *devpath, const char *devid)
> +{
> + char filename[PATH_MAX];
> + FILE *f;
> +
> + snprintf(filename, sizeof(filename),
> + "%s/driver/unbind", devpath);
> +
> + f = fopen(filename, "w");
> + if (f == NULL) /* device was not bound */
> + return 0;
> +
> + if (fwrite(devid, strlen(devid), 1, f) == 0) {
> + RTE_LOG(ERR, EAL, "%s(): could not write to %s\n", __func__,
> + filename);
> + goto error;
> + }
> +
> + fclose(f);
> + return 0;
> +error:
> + fclose(f);
> + return -1;
> +}
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
> index 876ba38..a03553f 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> @@ -59,38 +59,23 @@ int
> pci_unbind_kernel_driver(struct rte_pci_device *dev)
> {
> int n;
> - FILE *f;
> - char filename[PATH_MAX];
> - char buf[BUFSIZ];
> + char devpath[PATH_MAX];
> + char devid[BUFSIZ];
> struct rte_pci_addr *loc = &dev->addr;
>
> - /* open /sys/bus/pci/devices/AAAA:BB:CC.D/driver */
> - snprintf(filename, sizeof(filename),
> - "%s/" PCI_PRI_FMT "/driver/unbind", pci_get_sysfs_path(),
> + /* devpath /sys/bus/pci/devices/AAAA:BB:CC.D */
> + snprintf(devpath, sizeof(devpath),
> + "%s/" PCI_PRI_FMT, pci_get_sysfs_path(),
> loc->domain, loc->bus, loc->devid, loc->function);
>
> - f = fopen(filename, "w");
> - if (f == NULL) /* device was not bound */
> - return 0;
> -
> - n = snprintf(buf, sizeof(buf), PCI_PRI_FMT "\n",
> + n = snprintf(devid, sizeof(devid), PCI_PRI_FMT "\n",
> loc->domain, loc->bus, loc->devid, loc->function);
> - if ((n < 0) || (n >= (int)sizeof(buf))) {
> + if ((n < 0) || (n >= (int)sizeof(devid))) {
> RTE_LOG(ERR, EAL, "%s(): snprintf failed\n", __func__);
> - goto error;
> - }
> - if (fwrite(buf, n, 1, f) == 0) {
> - RTE_LOG(ERR, EAL, "%s(): could not write to %s\n", __func__,
> - filename);
> - goto error;
> + return -1;
> }
>
> - fclose(f);
> - return 0;
> -
> -error:
> - fclose(f);
> - return -1;
> + return rte_eal_unbind_kernel_driver(devpath, devid);
> }
>
> static int
> --
> 2.7.4
>
^ permalink raw reply
* [PATCH] doc: postpone ABI changes for Tx prepare
From: Thomas Monjalon @ 2016-11-09 22:31 UTC (permalink / raw)
To: Tomasz Kulasek; +Cc: dev
The changes for the feature "Tx prepare" should be made in version 17.02.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
doc/guides/rel_notes/deprecation.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 1a9e1ae..ab6014d 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -8,8 +8,8 @@ API and ABI deprecation notices are to be posted here.
Deprecation Notices
-------------------
-* In 16.11 ABI changes are planned: the ``rte_eth_dev`` structure will be
- extended with new function pointer ``tx_pkt_prep`` allowing verification
+* In 17.02 ABI changes are planned: the ``rte_eth_dev`` structure will be
+ extended with new function pointer ``tx_pkt_prepare`` allowing verification
and processing of packet burst to meet HW specific requirements before
transmit. Also new fields will be added to the ``rte_eth_desc_lim`` structure:
``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
--
2.7.0
^ permalink raw reply related
* Re: [PATCH] doc: postpone ABI changes for mbuf
From: Thomas Monjalon @ 2016-11-09 22:16 UTC (permalink / raw)
To: Olivier Matz; +Cc: dev, john.mcnamara
In-Reply-To: <1478707921-32509-1-git-send-email-olivier.matz@6wind.com>
2016-11-09 17:12, Olivier Matz:
> Mbuf modifications are not ready for 16.11, postpone them to 17.02.
>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Applied, thanks
^ permalink raw reply
* Re: [PATCH] maintainers: claim responsability for xen
From: Thomas Monjalon @ 2016-11-09 22:03 UTC (permalink / raw)
To: Jianfeng Tan; +Cc: dev, bruce.richardson, yuanhan.liu
In-Reply-To: <1478504326-68105-1-git-send-email-jianfeng.tan@intel.com>
2016-11-07 07:38, Jianfeng Tan:
> As some users are still using xen as the hypervisor, I suggest to
> continue support for xen in DPDK. And from 16.11, I will be the
> maintainer of all xen-related files.
>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Applied
Please Jianfeng, could you start your new role by sending a status
of Xen dom0 support in DPDK? I think there are some issues in latest releases.
^ permalink raw reply
* Re: [PATCH v1] maintainers: update documentation maintainers
From: Thomas Monjalon @ 2016-11-09 21:35 UTC (permalink / raw)
To: Mcnamara, John; +Cc: dev, Butler, Siobhan A
In-Reply-To: <0C5AFCA4B3408848ADF2A3073F7D8CC86D946399@IRSMSX109.ger.corp.intel.com>
2016-11-08 10:54, Butler, Siobhan A:
> From: Mcnamara, John
> > Documentation (with overlaps)
> > -------------
> > -M: Siobhan Butler <siobhan.a.butler@intel.com>
> > M: John McNamara <john.mcnamara@intel.com>
> > F: README
> > F: doc/
>
> Aked-by: Siobhan Butler <siobhan.a.butler@intel.com>
Applied
^ permalink raw reply
* [PATCH] doc: postpone ABI changes for mbuf
From: Olivier Matz @ 2016-11-09 16:12 UTC (permalink / raw)
To: dev, john.mcnamara
Mbuf modifications are not ready for 16.11, postpone them to 17.02.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
doc/guides/rel_notes/deprecation.rst | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 9f5fa55..1a9e1ae 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -15,16 +15,17 @@ Deprecation Notices
``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
segments limit to be transmitted by device for TSO/non-TSO packets.
-* ABI changes are planned for 16.11 in the ``rte_mbuf`` structure: some fields
+* ABI changes are planned for 17.02 in the ``rte_mbuf`` structure: some fields
may be reordered to facilitate the writing of ``data_off``, ``refcnt``, and
``nb_segs`` in one operation, because some platforms have an overhead if the
store address is not naturally aligned. Other mbuf fields, such as the
- ``port`` field, may be moved or removed as part of this mbuf work.
+ ``port`` field, may be moved or removed as part of this mbuf work. A
+ ``timestamp`` will also be added.
* The mbuf flags PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT are deprecated and
are respectively replaced by PKT_RX_VLAN_STRIPPED and
PKT_RX_QINQ_STRIPPED, that are better described. The old flags and
- their behavior will be kept in 16.07 and will be removed in 16.11.
+ their behavior will be kept until 16.11 and will be removed in 17.02.
* mempool: The functions ``rte_mempool_count`` and ``rte_mempool_free_count``
will be removed in 17.02.
--
2.8.1
^ permalink raw reply related
* [PATCH] improve git diff
From: Thomas Monjalon @ 2016-11-09 15:44 UTC (permalink / raw)
To: dev
Sometimes git does not print the name of the function being changed
after @@. It happens especially after a goto label which is not indented.
Giving a hint about the languages of files .c, .h and .py
will improve hunk headers of "git diff" rendering.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
.gitattributes | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 .gitattributes
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..fe555f8
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,3 @@
+*.c diff=cpp
+*.h diff=cpp
+*.py diff=python
--
2.7.0
^ permalink raw reply related
* [PATCH] net: introduce big and little endian types
From: Nelio Laranjeiro @ 2016-11-09 15:04 UTC (permalink / raw)
To: dev, Olivier Matz; +Cc: wenzhuo.lu, Adrien Mazarguil
This commit introduces new rte_{le,be}{16,32,64}_t types and updates
rte_{le,be,cpu}_to_{le,be,cpu}_*() and network header structures
accordingly.
Specific big/little endian types avoid uncertainty and conversion mistakes.
No ABI change since these are simply typedefs to the original types.
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
.../common/include/generic/rte_byteorder.h | 31 +++++++++++-------
lib/librte_net/rte_arp.h | 15 +++++----
lib/librte_net/rte_ether.h | 10 +++---
lib/librte_net/rte_gre.h | 30 ++++++++---------
lib/librte_net/rte_icmp.h | 11 ++++---
lib/librte_net/rte_ip.h | 38 +++++++++++-----------
lib/librte_net/rte_net.c | 10 +++---
lib/librte_net/rte_sctp.h | 9 ++---
lib/librte_net/rte_tcp.h | 19 ++++++-----
lib/librte_net/rte_udp.h | 9 ++---
10 files changed, 97 insertions(+), 85 deletions(-)
diff --git a/lib/librte_eal/common/include/generic/rte_byteorder.h b/lib/librte_eal/common/include/generic/rte_byteorder.h
index e00bccb..059c2a5 100644
--- a/lib/librte_eal/common/include/generic/rte_byteorder.h
+++ b/lib/librte_eal/common/include/generic/rte_byteorder.h
@@ -75,6 +75,13 @@
#define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN
#endif
+typedef uint16_t rte_be16_t;
+typedef uint32_t rte_be32_t;
+typedef uint64_t rte_be64_t;
+typedef uint16_t rte_le16_t;
+typedef uint32_t rte_le32_t;
+typedef uint64_t rte_le64_t;
+
/*
* An internal function to swap bytes in a 16-bit value.
*
@@ -143,65 +150,65 @@ static uint64_t rte_bswap64(uint64_t x);
/**
* Convert a 16-bit value from CPU order to little endian.
*/
-static uint16_t rte_cpu_to_le_16(uint16_t x);
+static rte_le16_t rte_cpu_to_le_16(uint16_t x);
/**
* Convert a 32-bit value from CPU order to little endian.
*/
-static uint32_t rte_cpu_to_le_32(uint32_t x);
+static rte_le32_t rte_cpu_to_le_32(uint32_t x);
/**
* Convert a 64-bit value from CPU order to little endian.
*/
-static uint64_t rte_cpu_to_le_64(uint64_t x);
+static rte_le64_t rte_cpu_to_le_64(uint64_t x);
/**
* Convert a 16-bit value from CPU order to big endian.
*/
-static uint16_t rte_cpu_to_be_16(uint16_t x);
+static rte_be16_t rte_cpu_to_be_16(uint16_t x);
/**
* Convert a 32-bit value from CPU order to big endian.
*/
-static uint32_t rte_cpu_to_be_32(uint32_t x);
+static rte_be32_t rte_cpu_to_be_32(uint32_t x);
/**
* Convert a 64-bit value from CPU order to big endian.
*/
-static uint64_t rte_cpu_to_be_64(uint64_t x);
+static rte_be64_t rte_cpu_to_be_64(uint64_t x);
/**
* Convert a 16-bit value from little endian to CPU order.
*/
-static uint16_t rte_le_to_cpu_16(uint16_t x);
+static uint16_t rte_le_to_cpu_16(rte_le16_t x);
/**
* Convert a 32-bit value from little endian to CPU order.
*/
-static uint32_t rte_le_to_cpu_32(uint32_t x);
+static uint32_t rte_le_to_cpu_32(rte_le32_t x);
/**
* Convert a 64-bit value from little endian to CPU order.
*/
-static uint64_t rte_le_to_cpu_64(uint64_t x);
+static uint64_t rte_le_to_cpu_64(rte_le64_t x);
/**
* Convert a 16-bit value from big endian to CPU order.
*/
-static uint16_t rte_be_to_cpu_16(uint16_t x);
+static uint16_t rte_be_to_cpu_16(rte_be16_t x);
/**
* Convert a 32-bit value from big endian to CPU order.
*/
-static uint32_t rte_be_to_cpu_32(uint32_t x);
+static uint32_t rte_be_to_cpu_32(rte_be32_t x);
/**
* Convert a 64-bit value from big endian to CPU order.
*/
-static uint64_t rte_be_to_cpu_64(uint64_t x);
+static uint64_t rte_be_to_cpu_64(rte_be64_t x);
#endif /* __DOXYGEN__ */
diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h
index 1836418..95f123e 100644
--- a/lib/librte_net/rte_arp.h
+++ b/lib/librte_net/rte_arp.h
@@ -40,6 +40,7 @@
#include <stdint.h>
#include <rte_ether.h>
+#include <rte_byteorder.h>
#ifdef __cplusplus
extern "C" {
@@ -50,22 +51,22 @@ extern "C" {
*/
struct arp_ipv4 {
struct ether_addr arp_sha; /**< sender hardware address */
- uint32_t arp_sip; /**< sender IP address */
+ rte_be32_t arp_sip; /**< sender IP address */
struct ether_addr arp_tha; /**< target hardware address */
- uint32_t arp_tip; /**< target IP address */
+ rte_be32_t arp_tip; /**< target IP address */
} __attribute__((__packed__));
/**
* ARP header.
*/
struct arp_hdr {
- uint16_t arp_hrd; /* format of hardware address */
+ rte_be16_t arp_hrd; /* format of hardware address */
#define ARP_HRD_ETHER 1 /* ARP Ethernet address format */
- uint16_t arp_pro; /* format of protocol address */
- uint8_t arp_hln; /* length of hardware address */
- uint8_t arp_pln; /* length of protocol address */
- uint16_t arp_op; /* ARP opcode (command) */
+ rte_be16_t arp_pro; /* format of protocol address */
+ uint8_t arp_hln; /* length of hardware address */
+ uint8_t arp_pln; /* length of protocol address */
+ rte_be16_t arp_op; /* ARP opcode (command) */
#define ARP_OP_REQUEST 1 /* request to resolve address */
#define ARP_OP_REPLY 2 /* response to previous request */
#define ARP_OP_REVREQUEST 3 /* request proto addr given hardware */
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index ff3d065..159e061 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -300,7 +300,7 @@ ether_format_addr(char *buf, uint16_t size,
struct ether_hdr {
struct ether_addr d_addr; /**< Destination address. */
struct ether_addr s_addr; /**< Source address. */
- uint16_t ether_type; /**< Frame type. */
+ rte_be16_t ether_type; /**< Frame type. */
} __attribute__((__packed__));
/**
@@ -309,8 +309,8 @@ struct ether_hdr {
* of the encapsulated frame.
*/
struct vlan_hdr {
- uint16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */
- uint16_t eth_proto;/**< Ethernet type of encapsulated frame. */
+ rte_be16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */
+ rte_be16_t eth_proto;/**< Ethernet type of encapsulated frame. */
} __attribute__((__packed__));
/**
@@ -319,8 +319,8 @@ struct vlan_hdr {
* Reserved fields (24 bits and 8 bits)
*/
struct vxlan_hdr {
- uint32_t vx_flags; /**< flag (8) + Reserved (24). */
- uint32_t vx_vni; /**< VNI (24) + Reserved (8). */
+ rte_be32_t vx_flags; /**< flag (8) + Reserved (24). */
+ rte_be32_t vx_vni; /**< VNI (24) + Reserved (8). */
} __attribute__((__packed__));
/* Ethernet frame types */
diff --git a/lib/librte_net/rte_gre.h b/lib/librte_net/rte_gre.h
index 46568ff..b651af0 100644
--- a/lib/librte_net/rte_gre.h
+++ b/lib/librte_net/rte_gre.h
@@ -45,23 +45,23 @@ extern "C" {
*/
struct gre_hdr {
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
- uint16_t res2:4; /**< Reserved */
- uint16_t s:1; /**< Sequence Number Present bit */
- uint16_t k:1; /**< Key Present bit */
- uint16_t res1:1; /**< Reserved */
- uint16_t c:1; /**< Checksum Present bit */
- uint16_t ver:3; /**< Version Number */
- uint16_t res3:5; /**< Reserved */
+ uint16_t res2:4; /**< Reserved */
+ uint16_t s:1; /**< Sequence Number Present bit */
+ uint16_t k:1; /**< Key Present bit */
+ uint16_t res1:1; /**< Reserved */
+ uint16_t c:1; /**< Checksum Present bit */
+ uint16_t ver:3; /**< Version Number */
+ uint16_t res3:5; /**< Reserved */
#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
- uint16_t c:1; /**< Checksum Present bit */
- uint16_t res1:1; /**< Reserved */
- uint16_t k:1; /**< Key Present bit */
- uint16_t s:1; /**< Sequence Number Present bit */
- uint16_t res2:4; /**< Reserved */
- uint16_t res3:5; /**< Reserved */
- uint16_t ver:3; /**< Version Number */
+ uint16_t c:1; /**< Checksum Present bit */
+ uint16_t res1:1; /**< Reserved */
+ uint16_t k:1; /**< Key Present bit */
+ uint16_t s:1; /**< Sequence Number Present bit */
+ uint16_t res2:4; /**< Reserved */
+ uint16_t res3:5; /**< Reserved */
+ uint16_t ver:3; /**< Version Number */
#endif
- uint16_t proto; /**< Protocol Type */
+ rte_be16_t proto; /**< Protocol Type */
} __attribute__((__packed__));
#ifdef __cplusplus
diff --git a/lib/librte_net/rte_icmp.h b/lib/librte_net/rte_icmp.h
index 8b287f6..81bd907 100644
--- a/lib/librte_net/rte_icmp.h
+++ b/lib/librte_net/rte_icmp.h
@@ -74,6 +74,7 @@
*/
#include <stdint.h>
+#include <rte_byteorder.h>
#ifdef __cplusplus
extern "C" {
@@ -83,11 +84,11 @@ extern "C" {
* ICMP Header
*/
struct icmp_hdr {
- uint8_t icmp_type; /* ICMP packet type. */
- uint8_t icmp_code; /* ICMP packet code. */
- uint16_t icmp_cksum; /* ICMP packet checksum. */
- uint16_t icmp_ident; /* ICMP packet identifier. */
- uint16_t icmp_seq_nb; /* ICMP packet sequence number. */
+ uint8_t icmp_type; /* ICMP packet type. */
+ uint8_t icmp_code; /* ICMP packet code. */
+ rte_be16_t icmp_cksum; /* ICMP packet checksum. */
+ rte_be16_t icmp_ident; /* ICMP packet identifier. */
+ rte_be16_t icmp_seq_nb; /* ICMP packet sequence number. */
} __attribute__((__packed__));
/* ICMP packet types */
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 4491b86..6f7da36 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -93,14 +93,14 @@ extern "C" {
struct ipv4_hdr {
uint8_t version_ihl; /**< version and header length */
uint8_t type_of_service; /**< type of service */
- uint16_t total_length; /**< length of packet */
- uint16_t packet_id; /**< packet ID */
- uint16_t fragment_offset; /**< fragmentation offset */
+ rte_be16_t total_length; /**< length of packet */
+ rte_be16_t packet_id; /**< packet ID */
+ rte_be16_t fragment_offset; /**< fragmentation offset */
uint8_t time_to_live; /**< time to live */
uint8_t next_proto_id; /**< protocol ID */
- uint16_t hdr_checksum; /**< header checksum */
- uint32_t src_addr; /**< source address */
- uint32_t dst_addr; /**< destination address */
+ rte_be16_t hdr_checksum; /**< header checksum */
+ rte_be32_t src_addr; /**< source address */
+ rte_be32_t dst_addr; /**< destination address */
} __attribute__((__packed__));
/** Create IPv4 address */
@@ -340,11 +340,11 @@ static inline uint16_t
rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
{
struct ipv4_psd_header {
- uint32_t src_addr; /* IP address of source host. */
- uint32_t dst_addr; /* IP address of destination host. */
- uint8_t zero; /* zero. */
- uint8_t proto; /* L4 protocol type. */
- uint16_t len; /* L4 length. */
+ rte_be32_t src_addr; /* IP address of source host. */
+ rte_be32_t dst_addr; /* IP address of destination host. */
+ uint8_t zero; /* zero. */
+ uint8_t proto; /* L4 protocol type. */
+ rte_be16_t len; /* L4 length. */
} psd_hdr;
psd_hdr.src_addr = ipv4_hdr->src_addr;
@@ -398,12 +398,12 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
* IPv6 Header
*/
struct ipv6_hdr {
- uint32_t vtc_flow; /**< IP version, traffic class & flow label. */
- uint16_t payload_len; /**< IP packet length - includes sizeof(ip_header). */
- uint8_t proto; /**< Protocol, next header. */
- uint8_t hop_limits; /**< Hop limits. */
- uint8_t src_addr[16]; /**< IP address of source host. */
- uint8_t dst_addr[16]; /**< IP address of destination host(s). */
+ rte_be32_t vtc_flow; /**< IP version, traffic class & flow label. */
+ rte_be16_t payload_len; /**< IP packet length - includes sizeof(ip_header). */
+ uint8_t proto; /**< Protocol, next header. */
+ uint8_t hop_limits; /**< Hop limits. */
+ uint8_t src_addr[16]; /**< IP address of source host. */
+ uint8_t dst_addr[16]; /**< IP address of destination host(s). */
} __attribute__((__packed__));
/**
@@ -427,8 +427,8 @@ rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
{
uint32_t sum;
struct {
- uint32_t len; /* L4 length. */
- uint32_t proto; /* L4 protocol - top 3 bytes must be zero */
+ rte_be32_t len; /* L4 length. */
+ rte_be32_t proto; /* L4 protocol - top 3 bytes must be zero */
} psd_hdr;
psd_hdr.proto = (ipv6_hdr->proto << 24);
diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c
index a8c7aff..9014ca5 100644
--- a/lib/librte_net/rte_net.c
+++ b/lib/librte_net/rte_net.c
@@ -153,8 +153,8 @@ ptype_inner_l4(uint8_t proto)
/* get the tunnel packet type if any, update proto and off. */
static uint32_t
-ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m,
- uint32_t *off)
+ptype_tunnel(rte_be16_t *proto, const struct rte_mbuf *m,
+ uint32_t *off)
{
switch (*proto) {
case IPPROTO_GRE: {
@@ -208,8 +208,8 @@ ip4_hlen(const struct ipv4_hdr *hdr)
/* parse ipv6 extended headers, update offset and return next proto */
static uint16_t
-skip_ip6_ext(uint16_t proto, const struct rte_mbuf *m, uint32_t *off,
- int *frag)
+skip_ip6_ext(rte_be16_t proto, const struct rte_mbuf *m, uint32_t *off,
+ int *frag)
{
struct ext_hdr {
uint8_t next_hdr;
@@ -261,7 +261,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
struct ether_hdr eh_copy;
uint32_t pkt_type = RTE_PTYPE_L2_ETHER;
uint32_t off = 0;
- uint16_t proto;
+ rte_be16_t proto;
if (hdr_lens == NULL)
hdr_lens = &local_hdr_lens;
diff --git a/lib/librte_net/rte_sctp.h b/lib/librte_net/rte_sctp.h
index 688e126..8c646c7 100644
--- a/lib/librte_net/rte_sctp.h
+++ b/lib/librte_net/rte_sctp.h
@@ -81,15 +81,16 @@ extern "C" {
#endif
#include <stdint.h>
+#include <rte_byteorder.h>
/**
* SCTP Header
*/
struct sctp_hdr {
- uint16_t src_port; /**< Source port. */
- uint16_t dst_port; /**< Destin port. */
- uint32_t tag; /**< Validation tag. */
- uint32_t cksum; /**< Checksum. */
+ rte_be16_t src_port; /**< Source port. */
+ rte_be16_t dst_port; /**< Destin port. */
+ rte_be32_t tag; /**< Validation tag. */
+ rte_le32_t cksum; /**< Checksum. */
} __attribute__((__packed__));
#ifdef __cplusplus
diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
index 28b61e6..545d4ab 100644
--- a/lib/librte_net/rte_tcp.h
+++ b/lib/librte_net/rte_tcp.h
@@ -77,6 +77,7 @@
*/
#include <stdint.h>
+#include <rte_byteorder.h>
#ifdef __cplusplus
extern "C" {
@@ -86,15 +87,15 @@ extern "C" {
* TCP Header
*/
struct tcp_hdr {
- uint16_t src_port; /**< TCP source port. */
- uint16_t dst_port; /**< TCP destination port. */
- uint32_t sent_seq; /**< TX data sequence number. */
- uint32_t recv_ack; /**< RX data acknowledgement sequence number. */
- uint8_t data_off; /**< Data offset. */
- uint8_t tcp_flags; /**< TCP flags */
- uint16_t rx_win; /**< RX flow control window. */
- uint16_t cksum; /**< TCP checksum. */
- uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
+ rte_be16_t src_port; /**< TCP source port. */
+ rte_be16_t dst_port; /**< TCP destination port. */
+ rte_be32_t sent_seq; /**< TX data sequence number. */
+ rte_be32_t recv_ack; /**< RX data acknowledgement sequence number. */
+ uint8_t data_off; /**< Data offset. */
+ uint8_t tcp_flags; /**< TCP flags */
+ rte_be16_t rx_win; /**< RX flow control window. */
+ rte_be16_t cksum; /**< TCP checksum. */
+ rte_be16_t tcp_urp; /**< TCP urgent pointer, if any. */
} __attribute__((__packed__));
#ifdef __cplusplus
diff --git a/lib/librte_net/rte_udp.h b/lib/librte_net/rte_udp.h
index bc5be4a..89fdded 100644
--- a/lib/librte_net/rte_udp.h
+++ b/lib/librte_net/rte_udp.h
@@ -77,6 +77,7 @@
*/
#include <stdint.h>
+#include <rte_byteorder.h>
#ifdef __cplusplus
extern "C" {
@@ -86,10 +87,10 @@ extern "C" {
* UDP Header
*/
struct udp_hdr {
- uint16_t src_port; /**< UDP source port. */
- uint16_t dst_port; /**< UDP destination port. */
- uint16_t dgram_len; /**< UDP datagram length */
- uint16_t dgram_cksum; /**< UDP datagram checksum */
+ rte_be16_t src_port; /**< UDP source port. */
+ rte_be16_t dst_port; /**< UDP destination port. */
+ rte_be16_t dgram_len; /**< UDP datagram length */
+ rte_be16_t dgram_cksum; /**< UDP datagram checksum */
} __attribute__((__packed__));
#ifdef __cplusplus
--
2.1.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox