Commit Graph

178 Commits

Author SHA1 Message Date
Pablo Cascón
61d4008fe6 net/nfp: support setting link up/down
Add functions to set the link state up or down.

Signed-off-by: Pablo Cascón <pablo.cascon@netronome.com>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2019-03-29 17:25:32 +01:00
Natanael Copa
bdbf45c24b net/nfp: fix build with musl libc
Fixes following build error on systems without execinfo.h:

drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c:19:10: fatal error:
execinfo.h: No such file or directory
 #include <execinfo.h>
          ^~~~~~~~~~~~

Fixes: c7e9729da6 ("net/nfp: support CPP")
Cc: stable@dpdk.org

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2019-03-31 01:02:24 +01:00
Pallantla Poornima
968e9c14f3 net/nfp: fix possible buffer overflow
sprintf function is not secure as it doesn't check the length of string.
More secure function snprintf is used.

Fixes: 896c265ef9 ("net/nfp: use new CPP interface")
Fixes: c4171b520b ("net/nfp: support PF multiport")
Cc: stable@dpdk.org

Signed-off-by: Pallantla Poornima <pallantlax.poornima@intel.com>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2019-03-21 18:01:32 +01:00
Alejandro Lucero
761186fc7b net/nfp: fix RSS query
Current code is not properly giving the RSS information
regarding the redirection table.

Fixes: 934e4c60fb ("nfp: add RSS")
Cc: stable@dpdk.org

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2019-03-20 18:15:42 +01:00
Pablo Cascón
027412fe94 net/nfp: fix setting MAC address
Some firmwares, mostly for VFs, do not advertise the feature /
capability of changing the MAC address while the interface is up. With
such firmware a request to change the MAC address that at the same
time also tries to enable the not available feature will be denied by
the firmware resulting in an error message like:

nfp_net_reconfig(): Error nfp_net reconfig for ctrl: 80000000 update: 800

Fix set_mac_addr by not trying to enable a feature if it is not
advertised by the firmware.

Fixes: 2fe669f4bc ("net/nfp: support MAC address change")
Cc: stable@dpdk.org

Signed-off-by: Pablo Cascón <pablo.cascon@netronome.com>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2019-03-20 18:15:42 +01:00
Andrius Sirvys
902f389f9b drivers/net: fix shifting 32-bit signed variable 31 times
Shifting signed 32-bit values by 31-bits has the potential for
unexpected  outcomes as compiler can overwrite a bit.
Specified that values are unsigned.

Errors are observed from running cppcheck.

Bugzilla ID: 58
Fixes: 69e209be54 ("net/axgbe: add register map and related macros")
Fixes: b5bf771922 ("bnx2x: driver support routines")
Fixes: ed2ced6fe9 ("net/bnxt: check initialization before accessing stats")
Fixes: 6fda3f0ddd ("net/cxgbe: add API to program hardware MPS table")
Fixes: bdb244b969 ("e1000: whitespace changes")
Fixes: 5a32a257f9 ("e1000: more NICs in base driver")
Fixes: 2fe669f4bc ("net/nfp: support MAC address change")
Fixes: defb9a5dd1 ("nfp: introduce driver initialization")
Fixes: ec94dbc573 ("qede: add base driver")
Fixes: d2e7d931d0 ("net/qede/base: formatting changes")
Fixes: cdc07e83bb ("net/tap: add eBPF program file")
Cc: stable@dpdk.org

Signed-off-by: Andrius Sirvys <andrius.sirvys@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2019-03-01 18:17:36 +01:00
Alejandro Lucero
29a62d1476 net/nfp: add CPP bridge as service
The Netronome's Network Flow Processor chip is highly programmable
with the goal of processing packets at high speed. Processing units
and other chip components are available from the host through the
PCIe CPP(Command Push Pull bus) interface. The NFP PF PMD configures
a CPP handler for setting up and working with vNICs, perform actions
like link up or down, or accessing extended stats from the MAC component.

There exist NFP host tools which access the NFP components for
programming and debugging but they require the CPP interface. When the
PMD is bound to the PF, the DPDK app owns the CPP interface, so these
host tools can not access the NFP through other means like NFP kernel
drivers.

This patch adds a CPP bridge using the rte_service API which can be
enabled by a DPDK app. Interestingly, DPDK clients like OVS will not
enable specific service cores, but this can be performed with a
secondary process specifically enabling this CPP bridge service and
therefore giving access to the NFP to those host tools.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2019-01-14 22:57:33 +01:00
Alejandro Lucero
4d2c0cb5a3 net/nfp: fix device start/stop for VFs
Previous commit adding multiprocess support broke VF support.
When VFs, the PMD does not set the link up or down.

Fixes: ef28aa96e5 ("net/nfp: support multiprocess")

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2019-01-14 17:44:29 +01:00
Alejandro Lucero
ef28aa96e5 net/nfp: support multiprocess
This patch introduces changes for supporting multiprocess support.
This is trivial for VFs but comes with some limitations for the PF.

Due to restrictions when using NFP CPP interface, just one secondary
process is supported by now for the PF.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-12-13 17:53:50 +00:00
Alejandro Lucero
0de9eb6138 mem: rename DMA mask check with proper prefix
Current name rte_eal_check_dma_mask does not follow the naming
used in the rest of the file.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-05 01:01:54 +01:00
Alejandro Lucero
f7378a03d1 net/nfp: support IOVA VA mode
NFP can handle IOVA as VA. It requires to check those IOVAs
being in the supported range what is done during initialization.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-10-28 22:07:13 +01:00
Alejandro Lucero
388022d5d0 net/nfp: check hugepage IOVA based on DMA mask
NFP devices can not handle DMA addresses requiring more than
40 bits. This patch uses rte_dev_check_dma_mask with 40 bits
and avoids device initialization if memory out of NFP range.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-10-28 22:06:51 +01:00
Agalya Babu RadhaKrishnan
e60a1a8ba5 net/nfp: disable in FreeBSD build with meson
Disabled nfp build in FreeBSD because it is not supported
Added changes to enable NFP build if it is Linux OS and
disable in FreeBSD.

Fixes: d9b9ca7e05 ("net/nfp: add to meson build")
Cc: stable@dpdk.org

Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
2018-10-27 17:58:08 +02:00
Alejandro Lucero
f14a516898 net/nfp: fix RSS
Three problems are fixed in this patch:

 - RSS capabilities not advertised properly
 - RSS configuration just done for some RSS types
 - RSS hash match reported for just some RSS types

Fixes: 934e4c60fb ("nfp: add RSS")
Cc: stable@dpdk.org

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-10-11 18:53:48 +02:00
Alejandro Lucero
0962b51d3c net/nfp: fix mbuf flags with checksum good
If checksum offload enabled and hardware reports checksum as good,
update mbuf ol_flags with proper *_CKSUM_GOOD bits.

Fixes: b812daadad ("nfp: add Rx and Tx")
Cc: stable@dpdk.org

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-09-28 01:41:01 +02:00
Ferruh Yigit
323e7b667f ethdev: make default behavior CRC strip on Rx
Removed DEV_RX_OFFLOAD_CRC_STRIP offload flag.
Without any specific Rx offload flag, default behavior by PMDs is to
strip CRC.

PMDs that support keeping CRC should advertise DEV_RX_OFFLOAD_KEEP_CRC
Rx offload capability.

Applications that require keeping CRC should check PMD capability first
and if it is supported can enable this feature by setting
DEV_RX_OFFLOAD_KEEP_CRC in Rx offload flag in rte_eth_dev_configure()

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Tomasz Duszynski <tdu@semihalf.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Jan Remes <remes@netcope.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
2018-09-14 20:08:41 +02:00
Alejandro Lucero
7712a1c660 net/nfp: fix live MAC changes not supported
Some NFP firmwares support live changes to the MAC address, but
this is not always true and the firmware advertises it accordingly.

This patch checks if firmware does not support live changes and
sets RTE_ETH_DEV_NOLIVE_MAC_ADDR in that case.

Cc: stable@dpdk.org

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-08-28 15:27:39 +02:00
Thomas Monjalon
f8e9989606 remove useless constructor headers
A constructor is usually declared with RTE_INIT* macros.
As it is a static function, no need to declare before its definition.
The macro is used directly in the function definition.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2018-07-12 00:00:35 +02:00
Ferruh Yigit
ab3ce1e0c1 ethdev: remove old offload API
In DPDK 17.11, the ethdev offloads API has changed:
	commit cba7f53b71 ("ethdev: introduce Tx queue offloads API")
	commit ce17eddefc ("ethdev: introduce Rx queue offloads API")
The new API is documented in the programmer's guide:
	http://doc.dpdk.org/guides/prog_guide/poll_mode_drv.html#hardware-offload

For reminder, the main concepts in the new API were:
	- All offloads are disabled by default
	- Distinction between per port and per queue offloads.

The transition bits are now removed:
	- Translation of the old API in ethdev
	- rte_eth_conf.rxmode.ignore_offload_bitfield
	- ETH_TXQ_FLAGS_IGNORE

The old API bits are now removed:
	- Rx per-port rte_eth_conf.rxmode.[bit-fields]
	- Tx per-queue rte_eth_txconf.txq_flags
	- ETH_TXQ_FLAGS_NO*

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Shahaf Shuler <shahafs@mellanox.com>
2018-07-04 21:50:32 +02:00
Ferruh Yigit
70815c9eca ethdev: add new offload flag to keep CRC
DEV_RX_OFFLOAD_KEEP_CRC offload flag is added. PMDs that support
keeping CRC should advertise this offload capability.

DEV_RX_OFFLOAD_CRC_STRIP flag will remain one more release
default behavior in PMDs are to keep the CRC until this flag removed

Until DEV_RX_OFFLOAD_CRC_STRIP flag is removed:
- Setting both KEEP_CRC & CRC_STRIP is INVALID
- Setting only CRC_STRIP PMD should strip the CRC
- Setting only KEEP_CRC PMD should keep the CRC
- Not setting both PMD should keep the CRC

A helper function rte_eth_dev_is_keep_crc() has been added to be able to
change the no flag behavior with minimal changes in PMDs.

The PMDs that doesn't report the DEV_RX_OFFLOAD_KEEP_CRC offload can
remove rte_eth_dev_is_keep_crc() checks next release, related code
commented to help the maintenance task.

And DEV_RX_OFFLOAD_CRC_STRIP has been added to virtual drivers since
they don't use CRC at all, when an application requires this offload
virtual PMDs should not return error.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-07-03 01:35:58 +02:00
Alejandro Lucero
342a7bdd6e net/nfp: avoid access to sysfs resource0 file
NFP CPP interface dinamically configures NFP CPP BARs for accessing
any NFP chip component from user space. This requires to map PCI BAR
regions specifically. However, this does not require to do such map
over the usual map done by VFIO or UIO drivers with the device PCI
BARs.

This patch avoids this remapping and therefore also avoids to access
the device sysfs resource0 file for doing that remapping.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-07-03 01:35:58 +02:00
Alejandro Lucero
4c27985f05 net/nfp: avoid sysfs resource file access
Getting the bar size is required for NFP CPP interface configuration.
However, this information can be obtained from the VFIO or UIO driver
instead of accessing the sysfs resource file.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-07-03 01:35:58 +02:00
Alejandro Lucero
ebf2ed7208 net/nfp: use generic PCI config access functions
This patch avoids direct access to device config sysfs file using
rte_pci_read_config instead.

Apart from replicating code, it turns out this direct access does
not always work if non-root users execute DPDK apps. In those cases
it is mandatory to go through VFIO specific function for reading pci
config space.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-07-03 01:35:58 +02:00
Bruce Richardson
d9b9ca7e05 net/nfp: add to meson build
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-06-14 19:27:50 +02:00
Alejandro Lucero
01f65293ce net/nfp: fix field initialization in Tx descriptor
TX descriptor eop_offset field is not initialized and it could
contain garbage. This patch fixes the potential problem setting
EOP as the only subfield. The other subfield, data offset, is
not used by now.

Fixes: b812daadad ("nfp: add Rx and Tx")
Cc: stable@dpdk.org

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-06-14 19:27:50 +02:00
Alejandro Lucero
8c7cd2fa4e net/nfp: fix unused header reference
Apart from not being used, this is causing problem when compiling
DPDK with the musl library as reported by bugzilla.

Bugzilla ID: 40
Fixes: c7e9729da6 ("net/nfp: support CPP")
Cc: stable@dpdk.org

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-06-14 19:27:50 +02:00
Alejandro Lucero
5f6ed2f4e0 net/nfp: fix lock file usage
DPDK apps can be executed as non-root users but current NFP lock
file for avoiding concurrent accesses to CPP interface is precluding
this option or requires to modify system file permissions.

When the NFP device is bound to VFIO, this driver does not allow this
concurrent access, so the lock file is not required at all.

OVS-DPDK as executed in RedHat distributions is the main NFP user
needing this fix.

Fixes: c7e9729da6 ("net/nfp: support CPP")

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-05-25 17:07:40 +02:00
Alejandro Lucero
f0caa20c40 net/nfp: remove reference to old offload API
This was missed in a previous patch for using new offload API.

It turns out the line can be removed because that internal PMD
crc_len data is not being used.

Fixes: a922c6a789 ("net/nfp: support new HW offloads API")

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-05-25 17:07:40 +02:00
Andy Green
1bcb5ecb17 net/nfp: fix memcpy out of source range
drivers/net/nfp/nfp_net.c:669:2: error:
‘memcpy’ forming offset [5, 6] is out of the bounds [0, 4]
of object ‘tmp’ with type ‘uint32_t’ {aka ‘unsigned int’}
[-Werror=array-bounds]
memcpy(&hw->mac_addr[0], &tmp, sizeof(struct ether_addr));

Fixes: e6decee382 ("net/nfp: use random MAC address if not configured")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-05-14 23:32:23 +02:00
Andy Green
62280b7819 net/nfp: fix off-by-one and no nul on strncpy use
drivers/net/nfp/nfpcore/nfp_resource.c:76:2:error:
‘strncpy’ output may be truncated copying 8 bytes from a string of length 8
[-Werror=stringop-truncation]
  strncpy(name_pad, res->name, sizeof(name_pad));

Fixes: c7e9729da6 ("net/nfp: support CPP")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2018-05-14 23:32:23 +02:00
Andy Green
01077fa9ac net/nfp: fix strncpy misuse
Fixes: c7e9729da6 ("net/nfp: support CPP")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-05-14 23:32:23 +02:00
Andy Green
a74640c468 net/nfp: fix buffer overflow of FW strings
drivers/net/nfp/nfp_net.c: In function ‘nfp_pf_pci_probe’:
drivers/net/nfp/nfp_net.c:3160: 23: error:
‘%s’ directive writing up to 99 bytes into a region of size 76
[-Werror=format-overflow=]
  sprintf(fw_name, "%s/%s.nffw", DEFAULT_FW_PATH, serial);

Note fw_buf still has to increase somewhat even after
restricting serial[], since otherwise:

drivers/net/nfp/nfp_net.c: In function ‘nfp_pf_pci_probe’:
drivers/net/nfp/nfp_net.c:3176:23:
error: ‘%s’ directive writing up to 99 bytes into a region of size 76
[-Werror=format-overflow=]
  sprintf(fw_name, "%s/%s", DEFAULT_FW_PATH, card);
                       ^~
drivers/net/nfp/nfp_net.c:3262:32:
  err = nfp_fw_upload(dev, nsp, card_desc);
                                ~~~~~~~~~
drivers/net/nfp/nfp_net.c:3176:2:
note: ‘sprintf’ output between 25 and 124 bytes into a destination of size 100
  sprintf(fw_name, "%s/%s", DEFAULT_FW_PATH, card);

Fixes: 896c265ef9 ("net/nfp: use new CPP interface")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2018-05-14 23:32:23 +02:00
Thomas Monjalon
fbe90cdd77 ethdev: add probing finish function
A new hook function is added and called inside the PMDs at the end
of the device probing:
	- in primary process, after allocating, init and config
	- in secondary process, after attaching and local init

This new function is almost empty for now.
It will be used later to add some post-initialization processing.

For the PMDs calling the helpers rte_eth_dev_create() or
rte_eth_dev_pci_generic_probe(), the hook rte_eth_dev_probing_finish()
is called from here, and not in the PMD itself.

Note that the helper rte_eth_dev_create() could be used more,
especially for vdevs, avoiding some code duplication in PMDs.

Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
2018-05-14 22:31:53 +01:00
Wei Dai
a4996bd89c ethdev: new Rx/Tx offloads API
This patch check if a input requested offloading is valid or not.
Any reuqested offloading must be supported in the device capabilities.
Any offloading is disabled by default if it is not set in the parameter
dev_conf->[rt]xmode.offloads to rte_eth_dev_configure() and
[rt]x_conf->offloads to rte_eth_[rt]x_queue_setup().
If any offloading is enabled in rte_eth_dev_configure() by application,
it is enabled on all queues no matter whether it is per-queue or
per-port type and no matter whether it is set or cleared in
[rt]x_conf->offloads to rte_eth_[rt]x_queue_setup().
If a per-queue offloading hasn't be enabled in rte_eth_dev_configure(),
it can be enabled or disabled for individual queue in
ret_eth_[rt]x_queue_setup().
A new added offloading is the one which hasn't been enabled in
rte_eth_dev_configure() and is reuqested to be enabled in
rte_eth_[rt]x_queue_setup(), it must be per-queue type,
otherwise trigger an error log.
The underlying PMD must be aware that the requested offloadings
to PMD specific queue_setup() function only carries those
new added offloadings of per-queue type.

This patch can make above such checking in a common way in rte_ethdev
layer to avoid same checking in underlying PMD.

This patch assumes that all PMDs in 18.05-rc2 have already
converted to offload API defined in 17.11 . It also assumes
that all PMDs can return correct offloading capabilities
in rte_eth_dev_infos_get().

In the beginning of [rt]x_queue_setup() of underlying PMD,
add offloads = [rt]xconf->offloads |
dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API
defined in 17.11 to avoid upper application broken due to offload
API change.
PMD can use the info that input [rt]xconf->offloads only carry
the new added per-queue offloads to do some optimization or some
code change on base of this patch.

Signed-off-by: Wei Dai <wei.dai@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
2018-05-14 22:31:51 +01:00
Stephen Hemminger
99d9d9d4dd net/nfp: use dynamic logging everywhere
Drivers should only log with their assigned logtype, not with the
generic PMD log type.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-27 18:00:58 +01:00
Stephen Hemminger
17239271d2 net/nfp: add newline in PMD_RX/TX_LOG macros
Be consistent with usage in other drivers.
No need for snowflake drivers.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-27 18:00:57 +01:00
Stephen Hemminger
c524468ad9 net/nfp: fix double space in init log
Shouldn't pass extra newline.

Fixes: 7dcb19d78f ("net/nfp: fix Rx interrupt when multiqueue")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-27 18:00:57 +01:00
Stephen Hemminger
8613520640 net/nfp: add implied new line to log macro
The PMD_INIT_LOG macro always adds a newline, and other drivers version
of PMD_DRV_LOG always adds a newline. Therefore change nfp driver
to be consitent with others.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-27 18:00:57 +01:00
Stephen Hemminger
a064f88210 net/nfp: use correct logtype for init messages
The NFP driver init messages would come out under PMD not net.pmd.nfp.init.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-27 18:00:57 +01:00
Alejandro Lucero
0c0e46c36b net/nfp: fix mbufs releasing when stop or close
PMDs have the responsibility of releasing mbufs sent through xmit burst
function. NFP PMD attaches those sent mbufs to the TX ring structure,
and it is at the next time a specific ring descriptor is going to be
used when the previous linked mbuf, already transmitted at that point,
is released. Those mbufs belonging to a chained mbuf got its own link
to a ring descriptor, and they are released independently of the mbuf
head of that chain.

The problem is how those mbufs are released when the PMD is stopped or
closed. Instead of releasing those mbufs as the xmit functions does,
this is independently of being in a mbuf chain, the code calls
rte_pktmbuf_free which will release not just the mbuf head in that
chain but all the chained mbufs. The loop will try to release those
mbufs which have already been released again when chained mbufs exist.

This patch fixes the problem using rte_pktmbuf_free_seg instead.

Fixes: b812daadad ("nfp: add Rx and Tx")
Cc: stable@dpdk.org

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-27 17:34:42 +01:00
Alejandro Lucero
2fe669f4bc net/nfp: support MAC address change
This patch allows to use another MAC address than the one coming
with the NIC by default.

The change requires to tell the vNIC after writing into the port
BAR space. The change will fail if the port is enabled and the
vNIC does not support a live address change.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-27 15:54:55 +01:00
Yangchao Zhou
687790cf9a net/nfp: fix possible resource leak
Fixes: c7e9729da6 ("net/nfp: support CPP")

Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-27 15:54:55 +01:00
Thomas Monjalon
c0e3f8ed6c drivers/net: remove duplicated includes
Duplicated includes are found with devtools/check-dup-includes.sh

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-04-27 15:54:55 +01:00
Alejandro Lucero
0e7970c21a net/nfp: support hardware RSS v2
Chained metadata instead of prepend metadata was added in
firmware version 4. However, it could be old firmwares evolving
but not supporting chained metadata.

This patch adds support for an old firmware being updated and
getting a firmware version number higher than 4, but it still not
implementing chained metadata.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-14 00:43:30 +02:00
Alejandro Lucero
d14c082f86 net/nfp: support LSO offload version 2
This new LSO offload version facilitates how firmware implements
this functionality and helps improving the performance.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-14 00:43:30 +02:00
Ferruh Yigit
cd8c7c7ce2 ethdev: replace bus specific struct with generic dev
Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it
although it is common for all ethdev in all buses.

Replacing pci specific struct with generic device struct and updating
places that are using pci device in a way to get this information from
generic device.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: David Marchand <david.marchand@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-04-14 00:41:44 +02:00
Alejandro Lucero
a922c6a789 net/nfp: support new HW offloads API
In next 18.05 the old hw offload API will be removed. This patch adds
support for just the new hw offload API.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-14 00:40:21 +02:00
Alejandro Lucero
70217f1d8d net/nfp: remove files
New CPP interface makes NSPU interface obsolete. These files are
not needed anymore.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-14 00:40:21 +02:00
Alejandro Lucero
896c265ef9 net/nfp: use new CPP interface
PF PMD support was based on NSPU interface. This patch changes the
PMD for using the new CPP user space interface which gives more
flexibility for adding new functionalities.

This change just affects initialization with the datapath being the
same than before.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-14 00:40:21 +02:00
Alejandro Lucero
c7e9729da6 net/nfp: support CPP
CPP refers to the internal NFP Command Push Pull bus. This patch allows
to create CPP commands from user space allowing to access any single
part of the chip.

This CPP interface is the base for having other functionalities like
mutexes when accessing specific chip components, chip resources management,
firmware upload or using the NSP, an embedded arm processor which can
perform tasks on demand.

NSP was the previous only way for doing things in the chip by the PMD,
where a NSPU interface was used for commands like firmware upload or
port link configuration. CPP interface supersedes NSPU, but it is still
possible to use NSP through CPP.

CPP interface adds a great flexibility for doing things like extended
stats or firmware debugging.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
2018-04-14 00:40:21 +02:00