Commit Graph

89 Commits

Author SHA1 Message Date
David Marchand
eeded2044a log: register with standardized names
Let's try to enforce the convention where most drivers use a pmd. logtype
with their class reflected in it, and libraries use a lib. logtype.

Introduce two new macros:
- RTE_LOG_REGISTER_DEFAULT can be used when a single logtype is
  used in a component. It is associated to the default name provided
  by the build system,
- RTE_LOG_REGISTER_SUFFIX can be used when multiple logtypes are used,
  and then the passed name is appended to the default name,

RTE_LOG_REGISTER is left untouched for existing external users
and for components that do not comply with the convention.

There is a new Meson variable log_prefix to adapt the default name
for baseband (pmd.bb.), bus (no pmd.) and mempool (no pmd.) classes.

Note: achieved with below commands + reverted change on net/bonding +
edits on crypto/virtio, compress/mlx5, regex/mlx5

$ git grep -l RTE_LOG_REGISTER drivers/ |
  while read file; do
    pattern=${file##drivers/};
    class=${pattern%%/*};
    pattern=${pattern#$class/};
    drv=${pattern%%/*};
    case "$class" in
      baseband) pattern=pmd.bb.$drv;;
      bus) pattern=bus.$drv;;
      mempool) pattern=mempool.$drv;;
      *) pattern=pmd.$class.$drv;;
    esac
    sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern',/RTE_LOG_REGISTER_DEFAULT(\1,/' $file;
    sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\.\(.*\),/RTE_LOG_REGISTER_SUFFIX(\1, \2,/' $file;
  done

$ git grep -l RTE_LOG_REGISTER lib/ |
  while read file; do
    pattern=${file##lib/};
    pattern=lib.${pattern%%/*};
    sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern',/RTE_LOG_REGISTER_DEFAULT(\1,/' $file;
    sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\.\(.*\),/RTE_LOG_REGISTER_SUFFIX(\1, \2,/' $file;
  done

Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2021-05-11 15:17:55 +02:00
Ferruh Yigit
d345d6c957 drivers/net: fix FW version query
Fixes a few different things:
* Remove 'fw_version' NULL checks, it is allowed if the 'fw_size' is
  zero, 'fw_version' being NULL but 'fw_size' not zero condition checked
  in ethdev layer
* Be sure required buffer size is returned if provided one is not big
  enough, instead of returning success (0)
* Document in doxygen comment the '-EINVAL' is a valid return type
* Take into account that 'snprintf' can return negative value
* Cast length to 'size_t' to compare it with 'fw_size'

Fixes: bb42aa9ffe ("net/atlantic: configure device start/stop")
Fixes: ff70acdf42 ("net/axgbe: support reading FW version")
Fixes: e2652b0a20 ("net/bnxt: support get FW version")
Fixes: cf0fab1d2c ("net/dpaa: support firmware version get API")
Fixes: 748eccb97c ("net/dpaa2: add support for firmware version get")
Fixes: b883c0644a ("net/e1000: add firmware version get")
Fixes: 293430677e ("net/enic: add handler to return firmware version")
Fixes: 1f5ca0b460 ("net/hns3: support some device operations")
Fixes: bd5b86732b ("net/hns3: modify format for firmware version")
Fixes: ed0dfdd0e9 ("net/i40e: add firmware version get")
Fixes: e31cb9a362 ("net/ice: support FW version getting")
Fixes: 4f09bc55ac ("net/igc: implement device base operations")
Fixes: eec10fb0ce ("net/ionic: support FW version")
Fixes: 8b0b565742 ("net/ixgbe: add firmware version get")
Fixes: 4d9f5b8adc ("net/octeontx2: add FW version get operation")
Fixes: f97b56f9f1 ("net/qede: support FW version query")
Fixes: 83fef46a22 ("net/sfc: add callback to retrieve FW version")
Fixes: bc84ac0fad ("net/txgbe: support getting FW version")
Fixes: 2191347120 ("ethdev: add firmware version get")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Rasesh Mody <rmody@marvell.com>
Acked-by: Jiawen Wu <jiawenwu@trustnetic.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2021-04-26 13:50:42 +02:00
Bruce Richardson
4ad4b20a79 drivers: change indentation in build files
Switch from using tabs to 4 spaces for meson.build indentation.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2021-04-21 14:04:09 +02:00
Thomas Monjalon
924e6b7634 drivers: replace page size definitions with function
The page size is often retrieved from the macro PAGE_SIZE.
If PAGE_SIZE is not defined, it is either using hard coded default,
or getting the system value from the UNIX-only function sysconf().

Such definitions are replaced with the generic function
rte_mem_page_size() defined for each supported OS.

Removing PAGE_SIZE definitions will fix dlb drivers for musl libc,
because #ifdef checks were missing, causing redefinition errors.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Boyer <aboyer@pensando.io>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
Acked-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
2021-03-23 08:41:05 +01:00
Andrew Boyer
656bfc9a4e net/ionic: fix completion type in lif init
The completion type was wrong.
Don't check the completion if the wait timed out.

Fixes: 669c8de67c ("net/ionic: support basic LIF")
Cc: stable@dpdk.org

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
e19eea1e8e net/ionic: store Tx fragment limit in queue
A future patch will allow Tx scatter/gather to be disabled. Store the
value in the queue so it can be changed at runtime based on the
configuration.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
86551f81a6 net/ionic: send as many packets as possible
Rather than dropping the whole burst if some don't fit.
This improves performance.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
Signed-off-by: Vishwas Danivas <vishwas@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
77c60793cd net/ionic: ring doorbell once at the end of each burst
This improves performance.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
dd10c5b4c6 net/ionic: break up queue post function
Break it up rather than inlining it, so that we can remove
branches from the hot path.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
ed522a3f09 net/ionic: log queue counters when tearing down
This improves debuggability.

To see the logs, use EAL arg: --log-level=pmd.net.ionic,debug

While here, stop counting fragments, but start counting mtods.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
8ec5ad7f80 net/ionic: use socket id passed in for Rx and Tx queues
Pipe the value from the queue setup routines through to
ionic_qcq_alloc().

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
be39f75cd4 net/ionic: split up queue-completion queue structure
Create a unique Q-CQ struct for adminq, notifyq, rxq, and txq to
reduce the size of each object.

Minimize the size of each field to squeeze into as few cachelines
as possible.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
4ad56b7a7c net/ionic: cut down queue structure
This will conserve resources.

Rename ionic_qcq_alloc() arg from 'base' to 'type_name' for clarity.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
aeb70a00b1 net/ionic: remove unused interrupt free function
This will conserve resources.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
c6a9a6fb57 net/ionic: remove unused field from queue structure
This will conserve resources.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
700f974d77 net/ionic: convert info array to generic pointers
Drop the callback part of the object and store only the pointers.
This saves a bit of space and simplifies the code.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
750aebd5eb net/ionic: consolidate adminq code
The adminq is the only caller of ionic_q_service(), so absorb it
into ionic_adminq_service().
Move all of the adminq code together into ionic_main.c.
Staticize a few things.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
0f2b55a401 net/ionic: remove unused filter delete function
This function is unused.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
2aed98657a net/ionic: cut down completion queue structure
Add Q_NEXT_TO_POST() and Q_NEXT_TO_SRVC() macros.
Use a precomputed size mask.

This will conserve resources.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-25 16:58:56 +01:00
Andrew Boyer
d13d7829fc net/ionic: fix Tx fragment limits
The reported nb_seg_max should include the main fragment in the
descriptor and the fragments in the accompanying SGL.

Update the Tx prep check as well.

These were missed when updating to the v1 Tx queue structures.

Fixes: 5611763610 ("net/ionic: clean up Tx queue version support")

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-05 12:44:16 +01:00
Andrew Boyer
5611763610 net/ionic: clean up Tx queue version support
The ionic PMD only supports Tx queue version 1 or greater.
Version 1 introduced a new SGL format with support for more
fragments per descriptor.

Add release notes and an explanation to the docs.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-03 00:48:11 +01:00
Andrew Boyer
76276d716b net/ionic: use existing array size macro
Using the RTE_DIM() macro makes the code clearer.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-02-03 00:48:11 +01:00
Andrew Boyer
7c3a867ba2 net/ionic: fix address handling in Tx
Don't assume standard headroom.
Use helper variables to improve readability.

Fixes: a27d901331 ("net/ionic: add Rx and Tx handling")
Cc: stable@dpdk.org
Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-29 18:16:10 +01:00
Andrew Boyer
0de3e209af net/ionic: fix up function attribute tags
One function marked cold is in the hot path.
Make sure to always inline hot path functions.

Fixes: a27d901331 ("net/ionic: add Rx and Tx handling")
Cc: stable@dpdk.org

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-29 18:16:10 +01:00
Andrew Boyer
68591087ac net/ionic: convert per-queue offloads into queue flags
This will conserve resources by reducing struct ionic_qcq.

Saving a cacheline or two in the rxq and txq structs helps when
running in embedded configurations where CPU cache space is at a
premium.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-29 18:16:10 +01:00
Andrew Boyer
f603eebc43 net/ionic: allow separate L3 and L4 checksum offload
DTS, at least, expects to be able to specify L4 checksum offload
without L3 csum offload. Split up the flag checks.

Fixes: a27d901331 ("net/ionic: add Rx and Tx handling")
Cc: stable@dpdk.org

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-29 18:16:10 +01:00
Andrew Boyer
f3926b1f87 net/ionic: observe endiannness in ioread/iowrite
The IONIC FW is little-endian.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-29 18:16:10 +01:00
Andrew Boyer
d318c6464c net/ionic: inline queue space function
This is a hot-path function.
Remove ionic_q_has_space() while here.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-29 18:16:10 +01:00
Andrew Boyer
bef60d87ad net/ionic: inline queue flush function
This is hot-path function.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
Signed-off-by: Neel Patel <neel@pensando.io>
2021-01-29 18:16:10 +01:00
Andrew Boyer
c5d1585035 net/ionic: query firmware for supported queue versions
This allows the PMD to better support FW changes.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
2021-01-29 18:16:10 +01:00
Andrew Boyer
a27e0e96ab net/ionic: observe endianness in Rx filter
The IONIC firmware is little-endian.
Add a new field to struct ionic_rx_filter to store the CPU-endian
match type.
Use a local variable for the VLAN when searching the hash table.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-29 18:16:10 +01:00
Andrew Boyer
09f806e95d net/ionic: observe endianness in firmware commands
The IONIC firmware is little-endian.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-29 18:16:10 +01:00
Andrew Boyer
4c8f8d57f6 net/ionic: strip out unneeded interrupt code
Only the NotifyQ uses an interrupt, so simplify the other queues.

Simplify ionic_dev_cmd_adminq_init() and ionic_cq_init().
Move ionic_intr_alloc() into ionic_notify_qcq_alloc().
Create ionic_lif_notifyq_deinit().
Simplify ionic_lif_qcq_deinit().
Remove unneeded flags and defines.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-29 18:16:10 +01:00
Bruce Richardson
df96fd0d73 ethdev: make driver-only headers private
The rte_ethdev_driver.h, rte_ethdev_vdev.h and rte_ethdev_pci.h files are
for drivers only and should be a private to DPDK and not installed.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Steven Webster <steven.webster@windriver.com>
2021-01-29 20:59:09 +01:00
Andrew Boyer
0dad8b3d4c net/ionic: fix link speed and autonegotiation
Don't assume autoneg in link_update().

Always call ionic_dev_cmd_port_autoneg() in start().

This allows the client to specify the link settings.

Fixes: 598f672639 ("net/ionic: add basic port operations")
Cc: stable@dpdk.org

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-19 03:30:32 +01:00
Andrew Boyer
c3ab74fcc8 net/ionic: clear up confusion around FC autoneg
IONIC does not support Flow-Control autonegotiation.

Always wait for completion after each dev cmd.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-19 03:30:32 +01:00
Andrew Boyer
9c3cc2fc09 net/ionic: do not add station MAC filter on init
The address is not needed in the firmware.
This reduces the startup time a bit.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
Signed-off-by: Neel Patel <neel@pensando.io>
2021-01-19 03:30:32 +01:00
Andrew Boyer
8baeb91d23 net/ionic: set port admin state to up in port init
This reduces the startup time a bit.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
Signed-off-by: Neel Patel <neel@pensando.io>
2021-01-19 03:30:32 +01:00
Andrew Boyer
b5d9a4f0d1 net/ionic: combine queue init and enable commands
Adding F_ENA to the q_init command has the same effect as q_enable.
This reduces the startup time a bit.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
Signed-off-by: Neel Patel <neel@pensando.io>
2021-01-19 03:30:32 +01:00
Andrew Boyer
18a4446586 net/ionic: revise configuration flag handling
Configuration flags come to the driver in dev_configure(). From there,
the driver calls ionic_lif_configure() to update the lif->feature
bitfield, and then programs the port.

Features like VLAN_RX_FILTER and RX_HASH cannot be disabled in the
device, so do nothing in response to requests to disable them. (The
device config would ideally show them enabled by default, but some
DTS tests fail if RSS_HASH is set but RSS is not.)

Move features from the per-queue to per-port lists. IONIC does not
really support per-queue configuration: the stack disallows disabling
a queue feature if it is enabled on the port, while the device
disallows enabling a queue feature if it is disabled on the port.
Thus all configuration is per-port.

Move the guts of ionic_vlan_offload_set() into a new function,
ionic_lif_configure_vlan_offload(), so it can be called by
ionic_lif_configure().

Move the check for DEV_RX_OFFLOAD_SCATTER from rx_queue_setup() up
into ionic_lif_configure().

Warn if rx_drop_en is not set.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-19 03:30:32 +01:00
Pallavi Kadam
b9d60b5434 drivers/net: build i40e and mlx5 on Windows
Allows i40e and mlx5 PMDs to compile on Windows and disable other drivers.

Disable few i40e warnings with Clang such as comparison of integers of
different signs and macro redefinitions.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Tal Shnaiderman <talshn@nvidia.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2021-01-14 23:51:24 +01:00
Andrew Boyer
a0a99f21dd net/ionic: stop queues when LIF is stopped
Otherwise they cannot be restarted, because the FW will reject INIT
or ENA commands on queues which are already running.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-13 18:51:58 +01:00
Andrew Boyer
9fdf11c463 net/ionic: improve queue state handling
Skip ionic_lif_[rxq|txq]_init() in queue start if it's already done.
Move ionic_lif_[rxq|txq]_deinit() from queue stop to queue release.

This allows the queues to be restarted.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-13 18:51:58 +01:00
Andrew Boyer
be63459e0b net/ionic: improve link state handling
Add UP and FW_RESET state flags.
Update the stack info when the link state changes.
Convert set_link_up/set_link_down to lif_start/lif_stop.
Condition reported link state on UP flag.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-13 18:51:58 +01:00
Andrew Boyer
175e4e7ed7 net/ionic: complete release on close
ionic_dev_close() is responsible for destroying the ethdev, lif, and
adapter. eth_ionic_dev_remove() calls ionic_dev_close().

Remove-on-close is now required behavior for a PMD.
Remove the UNMAINTAINED flag.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-13 18:51:58 +01:00
Andrew Boyer
00b65da52d net/ionic: remove multi-LIF support
This feature is unused, so remove it.

There is exactly one adapter / lif / ethdev per port.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-13 18:51:58 +01:00
Andrew Boyer
0578335a71 net/ionic: preserve Rx mode across LIF stop/start
Otherwise, non-default settings (like PROMISC) get reset.
This will become important when link toggling is tied to LIF stop/start.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-13 18:51:58 +01:00
Andrew Boyer
3d845eddc1 net/ionic: preserve RSS state unless RETA size changes
This preserves settings across a LIF stop/start.
This will become important when link toggling is tied to LIF stop/start.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
2021-01-13 18:51:58 +01:00
Andrew Boyer
4ae96cb88f net/ionic: do minor logging fixups
Expose ionic_opcode_to_str() so it can be used for dev cmds, too.
Store the device name in struct adapter.

Switch to memcpy() to work around gcc false positives.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-01-08 16:03:04 +01:00
Andrew Boyer
75f9690223 net/ionic: make minor refactorings
This makes the code clearer and conserves resources.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-01-08 16:03:04 +01:00