dpdk.git
9 years agoixgbevf: fix statistic wraparound
Harry van Haaren [Mon, 12 Oct 2015 16:45:32 +0000 (17:45 +0100)]
ixgbevf: fix statistic wraparound

Fix a misinterpretation of VF stats in ixgbe

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Roger Melton <rmelton@cisco.com>
9 years agoigbvf: fix statistic wraparound
Harry van Haaren [Mon, 12 Oct 2015 16:45:33 +0000 (17:45 +0100)]
igbvf: fix statistic wraparound

Fix a misinterpreatation of VF statistic macro in e1000/igb.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Roger Melton <rmelton@cisco.com>
9 years agoigb: fix ieee1588 frame identification in i210
Pablo de Lara [Mon, 19 Oct 2015 13:20:03 +0000 (14:20 +0100)]
igb: fix ieee1588 frame identification in i210

Fixed issue where the flag PKT_RX_IEEE1588_PTP was not being set
in Intel I210 NIC, as EtherType in RX descriptor is in bits 8:10 of
Packet Type and not in the default bits 0:2.

Fixes known issue "IEEE1588 support possibly not working
with an Intel Ethernet Controller I210 NIC"

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoigb: enable TSO support
Wang Xiao W [Wed, 21 Oct 2015 07:55:26 +0000 (15:55 +0800)]
igb: enable TSO support

This patch enables igb TSO feature, the feature works on both PF and VF.
The TCP segmentation offload needs to write the offload related information
into the advanced context descriptors, which is similar to checksum offload.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000: fix total byte statistics
Harry van Haaren [Thu, 22 Oct 2015 15:18:04 +0000 (16:18 +0100)]
e1000: fix total byte statistics

This patch fixes a bug in reading the 64 bit register reading
which was causing the total octets counters to show zero.
Now the code reads both the lower and higher 32 bits.
Tested in testpmd, byte values are correct.

Fixes: 805803445a02 ("e1000: support EM devices (also known as e1000/e1000e)")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000: add new i218 devices
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:21 +0000 (10:51 +0800)]
e1000: add new i218 devices

Add the new e1000 devices to the DPDK PCI device list.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: minor changes
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:20 +0000 (10:51 +0800)]
e1000/base: minor changes

Some minor code change. No functionality impact.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: allow both ULP and EEE in Sx state
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:19 +0000 (10:51 +0800)]
e1000/base: allow both ULP and EEE in Sx state

This patch implements a modified flow that allows both ULP and EEE
in Sx (Sticky mode).

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: synchronize PHY interface on non-ME systems
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:18 +0000 (10:51 +0800)]
e1000/base: synchronize PHY interface on non-ME systems

On power up, the MAC - PHY interface needs to be set to PCIe, even if
cable is disconnected.  In ME systems, the ME handles this on exit from
Sx(Sticky mode) state. In non-ME, the driver handles it. Added a check
for non-ME system to the driver code that handles that.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: increase timeout of reset check
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:14 +0000 (10:51 +0800)]
e1000/base: increase timeout of reset check

Previously, in check_reset_block RSPCIPHY was polled for 100 ms before determining
that the ME veto is set. This needed to be increased to 300 ms.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: initialize 88E1543 PHY
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:15 +0000 (10:51 +0800)]
e1000/base: initialize 88E1543 PHY

The initialization process for 88E1543 PHY.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: disable IPv6 extension header parsing
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:12 +0000 (10:51 +0800)]
e1000/base: disable IPv6 extension header parsing

All 1G Server products need to have IPv6 extension headers turned off.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: prevent ULP flow if cable connected
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:03 +0000 (10:51 +0800)]
e1000/base: prevent ULP flow if cable connected

Enabling ulp on link down when cable is connect caused an infinite
loop of linkup/down indications in the NDIS driver.
After discussed, correct flow is to enable ULP only when cable is
disconnected.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: add flags to set EEE advertisement modes
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:02 +0000 (10:51 +0800)]
e1000/base: add flags to set EEE advertisement modes

Requires driver changes!

Change e1000_set_eee_i350 and e1000_set_eee_i354 to have flags allowing
changes in the advertised EEE speeds.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: support inverted format ETrackId
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:59 +0000 (10:50 +0800)]
e1000/base: support inverted format ETrackId

There are some images which contain ETrackID in inverted format. This patch
allows reading this format.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: support different EEARBC for i210
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:00 +0000 (10:51 +0800)]
e1000/base: support different EEARBC for i210

EEARBC has changed on i210. It means EEARBC has a different address on
i210 than on other NICs. So, add a new entity named EEARBC_I210 to the
register list and make sure the right one is being used on i210.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: add bit to disable packetbuffer read
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:08 +0000 (10:51 +0800)]
e1000/base: add bit to disable packetbuffer read

Added bit FEXTNVM7[18], that controls disabling MAC packet buffer read.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: add defaults for i210 Rx/Tx PBSIZE
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:53 +0000 (10:50 +0800)]
e1000/base: add defaults for i210 Rx/Tx PBSIZE

These are the defaults for the packet buffer size registers that need to
be explicitly set back if someone changes them and comes back to a normal
driver.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: fix K1 configuration
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:09 +0000 (10:51 +0800)]
e1000/base: fix K1 configuration

This patch is for the following updates to the K1 configurations:
Tx idle period for entering K1 should be 128 ns.
Minimum Tx idle period in K1 should be 256 ns.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: fix link detect flow
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:06 +0000 (10:51 +0800)]
e1000/base: fix link detect flow

In case that auto-negotiate is not enabled, call
e1000_setup_copper_link_generic instead of e1000_phy_setup_autoneg.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: fix link check for i354 88E1112 PHY
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:13 +0000 (10:51 +0800)]
e1000/base: fix link check for i354 88E1112 PHY

e1000_check_for_link_media_swap() is supposed to check PHY page 0 for
copper and PHY page 1 for "other" (fiber) link. We switched back from
page 1 to page 0 too soon, before e1000_check_for_link_82575() is
executed and we were never finding link on fiber (other).

Note: The precedence of link type is controlled by the PHY settings.

If the link is copper, as the M88E1112 page address is set to 1, it should be
set back to 0 before checking this link.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: fix beacon duration for i217
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:11 +0000 (10:51 +0800)]
e1000/base: fix beacon duration for i217

Fix for I217 Packet Loss issue - The Management Engine sets the FEXTNVM4
Beacon Duration incorrectly.  This fix ensures that the correct value will
always be set. Correct value for this field is 8 usec.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: fix TIPG for non 10 half duplex mode
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:04 +0000 (10:51 +0800)]
e1000/base: fix TIPG for non 10 half duplex mode

TIPG value is increased when setting speed to 10 half to prevent
packet loss. However, it was never decreased again when speed
changes. This caused performance issues in the NDIS driver.
Fix this to restore TIPG to default value on non 10 half.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: fix reset of DH89XXCC SGMII
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:54 +0000 (10:50 +0800)]
e1000/base: fix reset of DH89XXCC SGMII

For DH89XXCC_SGMII, write flush leaves registers of this device trashed
(0xFFFFFFFF). Added check for this device.
Also, after both for Port SW Reset and Device Reset case, platform should
wait at least 3ms before reading any registers. Since waiting is
conditionally executed only for Device Reset - removed the condition.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: fix EEPROM access for i210
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:16 +0000 (10:51 +0800)]
e1000/base: fix EEPROM access for i210

The i210 has two EEPROM access registers that are located in
non-standard offsets: EEARBC and EEMNGCTL. EEARBC was fixed previously
and EEMNGCTL should also be corrected.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: fix redundant PHY power down for i210
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:51 +0000 (10:50 +0800)]
e1000/base: fix redundant PHY power down for i210

The wrong bit is being used in PHYREG16 for PHY power down. In addition,
the use of PHYREG 16 is unnecessary if bit 11 of PHYREG 0 is used.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: fix jumbo frame CRC failures
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:50 +0000 (10:50 +0800)]
e1000/base: fix jumbo frame CRC failures

This is a patch to change the value of register 776.20[11:2] for jumbo
mode from 0x1A to 0x1F. This is to enlarge the gap between read and
write pointers in the TX Fifo.
And replace the magic number with a macro by the way.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: fix link flap on 82579
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:49 +0000 (10:50 +0800)]
e1000/base: fix link flap on 82579

Several customers have reported a link flap issue on 82579. The symptoms
are random and intermittent link losses when 82579 is connected to specific
switches. Issue has been root caused as interoperability problem between
the NIC and at least some Broadcom PHYs in the Energy Efficient Ethernet
wake mechanism.
To fix the issue, we are disabling the Phase Locked Loop shutdown in 100M
Low Power Idle. This solution will cause an increase of power in 100M EEE
link. It may cost additional 28mW in this specific mode.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: return error in resume workaround
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:05 +0000 (10:51 +0800)]
e1000/base: return error in resume workaround

Add u32 return value to function e1000_resume_workarounds_pchlan,
so that calling function can detect PHY access failure during resuming
flow.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: check more errors for ESB2 init and reset
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:58 +0000 (10:50 +0800)]
e1000/base: check more errors for ESB2 init and reset

Adding code where missing to handle case where calls to
e1000_read_kmrn_reg_80003es2lan and e1000_write_kmrn_reg_80003es2lan return
an error value.
Also, when accessing the E1000_KMRNCTRLSTA_INBAND_PARAM offset to disable
far-end loopback on 80003es2lan devices, make the handling of a read or
write failure consistent between hw_init and hw_reset.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: check more NVM read errors
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:55 +0000 (10:50 +0800)]
e1000/base: check more NVM read errors

Adding code to a case where e1000_nvn_read is called, but there is no
consideration for when the read fails (returns an error code).
Also, this patch adds an error message to a base NVM reading function that
is missing it for consistency.
This patch is not covering all cases of these conditions, it only covers
the code used by the e1000e driver.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: return code after setting receive address register
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:52 +0000 (10:50 +0800)]
e1000/base: return code after setting receive address register

Previously, the rar_set functions were of type void, and when they failed
to program an address register they would, at most,  put a message into
the log and end.  The fact that they failed to program an address into a
address register, if checked for, should be captured and passed back to
the caller so that the drivers can deal with the situation (or not) as
they deem best.
Drivers can ignore or use the return value.  No change to base drivers
is mandated by this change unless a driver wants to handle the failure
to program an address register (e.g. evaluate the return value).

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: remove useless return variables
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:56 +0000 (10:50 +0800)]
e1000/base: remove useless return variables

Although this change should be optimized out by the compiler, just
return a constant directly rather than declare a variable.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: remove obsolete comment
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:10 +0000 (10:51 +0800)]
e1000/base: remove obsolete comment

The "FIXME" comment is revomed from e1000_acquire_swfw_sync_80003es2lan
but forgotten being removed from e1000_acquire_swfw_sync_82575 while
the similar changes were made to both.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: cleanup unused tag
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:07 +0000 (10:51 +0800)]
e1000/base: cleanup unused tag

Remove all NAHUM6LP_HW tags.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: apply paranoia to macro arguments
Wenzhuo Lu [Fri, 16 Oct 2015 02:51:01 +0000 (10:51 +0800)]
e1000/base: apply paranoia to macro arguments

Macro arguments need to be in parens since we can pass in expressions.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: add new devices
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:48 +0000 (10:50 +0800)]
e1000/base: add new devices

Add some new i218 devices.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agoe1000/base: update readme and copyright
Wenzhuo Lu [Fri, 16 Oct 2015 02:50:47 +0000 (10:50 +0800)]
e1000/base: update readme and copyright

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
9 years agovhost-user: enable multiple queue
Yuanhan Liu [Thu, 22 Oct 2015 12:35:55 +0000 (20:35 +0800)]
vhost-user: enable multiple queue

By setting VHOST_USER_PROTOCOL_F_MQ protocol feature bit, and
VIRTIO_NET_F_MQ feature bit.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agovhost-user: handle message to enable vring
Changchun Ouyang [Thu, 22 Oct 2015 12:35:54 +0000 (20:35 +0800)]
vhost-user: handle message to enable vring

This message is used to enable/disable a specific vring queue pair.
The first queue pair is enabled by default.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agovirtio: fix deadloop after wrong config read
Changchun Ouyang [Thu, 22 Oct 2015 12:35:53 +0000 (20:35 +0800)]
virtio: fix deadloop after wrong config read

The old code adjusts the config bytes we want to read depending on
what kind of features we have, but we later cast the entire buf we
read with "struct virtio_net_config", which is obviously wrong.

The wrong config reading results to a dead loop at virtio_send_command()
while starting testpmd.

The right way to go is to read related config bytes when corresponding
feature is set, which is exactly what this patch does.

Fixes: 823ad647950a ("virtio: support multiple queues")

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agovhost: use queue id instead of constant ring index
Changchun Ouyang [Thu, 22 Oct 2015 12:35:52 +0000 (20:35 +0800)]
vhost: use queue id instead of constant ring index

Do not use VIRTIO_RXQ or VIRTIO_TXQ anymore; use the queue_id
instead, which will be set to a proper value for a specific queue
when we have multiple queue support enabled.

For now, queue_id is still set with VIRTIO_RXQ or VIRTIO_TXQ,
so it should not break anything.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agovhost-user: prepare multiple queue setup
Yuanhan Liu [Fri, 18 Sep 2015 08:01:10 +0000 (16:01 +0800)]
vhost-user: prepare multiple queue setup

All queue pairs, including the default (the first) queue pair,
are allocated dynamically, when a vring_call message is received
first time for a specific queue pair.

This is a refactor work for enabling vhost-user multiple queue;
it should not break anything as it does no functional changes:
we don't support mq set, so there is only one mq at max.

This patch is based on Changchun's patch.

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agovhost-user: announce queue number in message
Yuanhan Liu [Thu, 22 Oct 2015 12:35:50 +0000 (20:35 +0800)]
vhost-user: announce queue number in message

Add VHOST_USER_GET_QUEUE_NUM message
to tell the frontend (qemu) how many queue pairs we support.

And it is initiated to VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agovhost-user: support protocol features
Yuanhan Liu [Thu, 22 Oct 2015 12:35:49 +0000 (20:35 +0800)]
vhost-user: support protocol features

The two protocol features messages are introduced by qemu vhost
maintainer(Michael) for extendting vhost-user interface. Here is
an excerpta from the vhost-user spec:

    Any protocol extensions are gated by protocol feature bits,
    which allows full backwards compatibility on both master
    and slave.

The vhost-user multiple queue features will be treated as a vhost-user
extension, hence, we have to implement the two messages first.

VHOST_USER_PROTOCOL_FEATURES is initialized to 0, as we don't support
any yet.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agoeal: default to using all cores
Rich Lane [Fri, 25 Sep 2015 20:37:16 +0000 (13:37 -0700)]
eal: default to using all cores

This is a useful default for simple applications where the assignment
of lcores to CPUs doesn't matter. It's also useful for more complex
applications that automatically assign tasks to cores based on the
NUMA topology.

Signed-off-by: Rich Lane <rich.lane@bigswitch.com>
9 years agoeal: make the -n argument optional
Panu Matilainen [Thu, 15 Oct 2015 11:49:05 +0000 (14:49 +0300)]
eal: make the -n argument optional

Obtaining the correct value of memory channels, especially from a
running system, can be anything from difficult to plain impossible.
Since the value is merely an optimization and does not affect functionality
otherwise, its pointless to force such a guess on users initially, such
things belong to performance tuning phase.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agomempool: use a better default for number of memory channels
Panu Matilainen [Thu, 15 Oct 2015 11:49:04 +0000 (14:49 +0300)]
mempool: use a better default for number of memory channels

Optimize for quad-channel by default, this should work well for
all the cases, better than the previous value of one anyway.

Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agodoc: fix syntax in testpmd user guide
John McNamara [Mon, 28 Sep 2015 19:45:46 +0000 (20:45 +0100)]
doc: fix syntax in testpmd user guide

Fix a number of RST issues in the testpmd user guide and
refactored the structure to:

* Remove redundant roadmap section.
* Merge Overview section into Introduction.
* Move "set fwd" to the start of its section.

Signed-off-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agodoc: fix pdf build warning
John McNamara [Mon, 12 Oct 2015 12:54:40 +0000 (13:54 +0100)]
doc: fix pdf build warning

Fix a pdf doc build warning where a link wasn't recognised:

    doc/guides/contributing/documentation.rst::
        WARNING: unusable reference target found: inkscape.org

Signed-off-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
9 years agoeal: fix memory leak in stack dump
Zhe Tao [Mon, 21 Sep 2015 09:00:47 +0000 (17:00 +0800)]
eal: fix memory leak in stack dump

Free the memory allocated by the backtrace_symbols
to prevent the memory leak.

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
9 years agoigb_uio: remove unnecessary function to get device
Ferruh Yigit [Thu, 10 Sep 2015 19:09:39 +0000 (20:09 +0100)]
igb_uio: remove unnecessary function to get device

Return value of igbuio_get_uio_pci_dev() is already kept in priv
variable.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
9 years agomk: quote KERNELCC to allow ccache build
Simon Kagstrom [Thu, 24 Sep 2015 07:43:28 +0000 (09:43 +0200)]
mk: quote KERNELCC to allow ccache build

Otherwise building with KERNELCC="ccache gcc" will fail:
 ccache: invalid option -- 'p'

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agombuf: move chaining from ip_frag library
Simon Kagstrom [Thu, 15 Oct 2015 07:01:46 +0000 (09:01 +0200)]
mbuf: move chaining from ip_frag library

Chaining/segmenting mbufs can be useful in many places, so make it
global.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Johan Faltstrom <johan.faltstrom@netinsight.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agoacl: improve rules sorting
Mark Smith [Wed, 26 Aug 2015 19:25:18 +0000 (15:25 -0400)]
acl: improve rules sorting

Replace O(n^2) list sort with an O(n log n) merge sort.
The merge sort is based on the solution suggested in:
http://cslibrary.stanford.edu/105/LinkedListProblems.pdf
Tested sort_rules() improvement:
100K rules: O(n^2):  31382 milliseconds; O(n log n): 10 milliseconds
259K rules: O(n^2): 133753 milliseconds; O(n log n): 22 milliseconds

Signed-off-by: Mark Smith <marsmith@akamai.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoapp/testpmd: detect numa socket count
Stephen Hurd [Fri, 21 Aug 2015 02:25:21 +0000 (19:25 -0700)]
app/testpmd: detect numa socket count

Currently, there is a MAX_SOCKET macro which artificially limits the
number of NUMA sockets testpmd can use.  Anything on a higher socket
ends up using socket zero.  This patch replaces this with a variable
set during set_default_fwd_lcores_config() and uses RTE_MAX_NUMA_NODES
where a hard-coded max number of sockets is required.

Signed-off-by: Stephen Hurd <shurd@broadcom.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agompipe: return error for init allocation failure
Ravi Kerur [Wed, 19 Aug 2015 20:00:07 +0000 (13:00 -0700)]
mpipe: return error for init allocation failure

In function rte_pmd_mpipe_devinit, if rte_eth_dev_allocate
fails return error which is inline with other drivers.

Signed-off-by: Ravi Kerur <rkerur@gmail.com>
Acked-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Zhigang Lu <zlu@ezchip.com>
9 years agocfgfile: increase entry name and value sizes
Jasvinder Singh [Thu, 22 Oct 2015 14:03:03 +0000 (15:03 +0100)]
cfgfile: increase entry name and value sizes

This patch refers to the ABI change proposed for
librte_cfgfile(rte_cfgfile.h). In order to allow
for longer names and values, the values of macro
CFG_NAME_LEN and CFG_VAL_LEN is increased.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoexamples/qos_sched: remove duplicated cfgfile library
Michal Jastrzebski [Thu, 22 Oct 2015 14:03:02 +0000 (15:03 +0100)]
examples/qos_sched: remove duplicated cfgfile library

This is a supplement for previous patch that was incomplete.
Previous commit message: This is a modification of qos_sched
example to use librte_cfgfile for parsing configuration file.

Fixes: db935d0171dd ("examples/qos_sched: use librte_cfgfile")

Signed-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
9 years agoeal: fix C++ build
Christoph Gysin [Tue, 29 Sep 2015 06:53:01 +0000 (09:53 +0300)]
eal: fix C++ build

'virtual' is a keyword and can't be used if the code is to compile with
C++ compilers.

If rte_devargs.h was included in C++ code, compilation with clang++
failed with an error. g++ did not fail, but only because of a bug
that treats it as an anonymous struct with a decl-specifier which it
ignores.

This simply renames the member to 'virt'.

Reported-by: Ming Zhao <mzhao@luminatewireless.com>
Signed-off-by: Christoph Gysin <christoph.gysin@gmail.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agoeal/linux: make alarm not affected by system time jump
Wen-Chi Yang [Fri, 5 Jun 2015 02:46:36 +0000 (10:46 +0800)]
eal/linux: make alarm not affected by system time jump

Due to eal_alarm_callback() and rte_eal_alarm_set() use gettimeofday()
to get the current time, and gettimeofday() is affected by jumps.

For example, set up a rte_alarm which will be triggerd next second (
current time + 1 second) by rte_eal_alarm_set(). And the callback
function of this rte_alarm sets up another rte_alarm which will be
triggered next second (current time + 2 second).
Once we change the system time when the callback function is triggered,
it is possible that rte alarm functionalities work out of expectation.

Replace gettimeofday() with clock_gettime(CLOCK_MONOTONIC_RAW, &now)
could avoid this phenomenon.

Signed-off-by: Wen-Chi Yang <wolkayang@gmail.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
9 years agovirtio: fix Coverity unsigned warnings
Stephen Hemminger [Fri, 28 Aug 2015 16:23:38 +0000 (09:23 -0700)]
virtio: fix Coverity unsigned warnings

There are some places in virtio driver where uint16_t or int are used
where it would be safer to use unsigned.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
9 years agovirtio: do not report link state feature unless available
Stephen Hemminger [Fri, 28 Aug 2015 16:23:37 +0000 (09:23 -0700)]
virtio: do not report link state feature unless available

If host does not support virtio link state (like current DPDK vhost)
then don't set the flag. This keeps applications from incorrectly
assuming that link state is available when it is not. It also
avoids useless "guess what works in the config".

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
9 years agovhost: fix missing device checks
Jerome Jutteau [Mon, 19 Oct 2015 09:44:27 +0000 (11:44 +0200)]
vhost: fix missing device checks

virtio-net search for it's device in reset_owner.
The function don't check the return result of get_config_ll_entry.
Using get_config_ll_entry in reset_owner don't show any error when the
device is not found. This patch fix this by using get_device instead
instead of get_config_ll_entry.

In user_get_vring_base, get_device return is not checked and may cause
segfault when device is not found.

Signed-off-by: Jerome Jutteau <jerome.jutteau@outscale.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
9 years agovhost: keep device identifier after reset owner
Jerome Jutteau [Mon, 19 Oct 2015 09:44:26 +0000 (11:44 +0200)]
vhost: keep device identifier after reset owner

virtio-net clean and init device after a VHOST_USER_RESET_OWNER.
This reset device identifier to 0 and break ll_root listing logic.
This patch keep the old device identifier and re-write it on the cleaned
device.

Signed-off-by: Jerome Jutteau <jerome.jutteau@outscale.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
9 years agovirtio: fix crash when releasing null queue
Bernard Iremonger [Tue, 20 Oct 2015 15:37:41 +0000 (16:37 +0100)]
virtio: fix crash when releasing null queue

if input parameter vq is NULL, hw = vq->hw, causes a segmentation fault.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
9 years agoeal: fix io permission for virtio interrupt handler
David Marchand [Wed, 14 Oct 2015 09:50:49 +0000 (11:50 +0200)]
eal: fix io permission for virtio interrupt handler

For virtio-net pmd, the interrupt management thread must be created after
this driver has initialised so that iopl() has been properly called and
its effects are inherited by all eal children threads.

Before this change, changing link status on a virtio-net device would
trigger a segfault in the interrupt thread :

$ mkdir -p /mnt/huge
$ echo 256 > /proc/sys/vm/nr_hugepages
$ mount -t hugetlbfs none /mnt/huge
$ lspci |grep Ethernet
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
$ modprobe uio
$ insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
$ echo 0000:00:03.0 > /sys/bus/pci/devices/0000\:00\:03.0/driver/unbind
$ echo 1af4 1000 > /sys/bus/pci/drivers/igb_uio/new_id
$ ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x6 -n 3 -w 0000:00:03.0 -- -i --txqflags=0xf01 --total-num-mbufs 2048
[snip]
EAL: PCI device 0000:00:03.0 on NUMA socket -1
EAL:   probe driver: 1af4:1000 rte_virtio_pmd
Interactive-mode selected
Configuring Port 0 (socket 0)
Port 0: DE:AD:DE:01:02:03
Checking link statuses...
Port 0 Link Up - speed 10000 Mbps - full-duplex
Done
testpmd>

Then, from qemu monitor:
(qemu) set_link virtio-net-pci.0 off

testpmd> Segmentation fault

Fixes: 565b85dcd9f4 ("eal: set iopl only when needed")

Reported-by: Stephen Hemminger <shemming@brocade.com>
Suggested-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
9 years agomlx4: do not expose broadcast address in MAC list
Didier Pallard [Mon, 5 Oct 2015 17:50:08 +0000 (19:50 +0200)]
mlx4: do not expose broadcast address in MAC list

Use the last array entry to store the broadcast address and keep it hidden
by not reporting the entire array size.

This is done to prevent DPDK applications from attempting to modify or
remove it.

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
9 years agomlx4: save bound interface
Francesco Santoro [Mon, 5 Oct 2015 17:50:07 +0000 (19:50 +0200)]
mlx4: save bound interface

Allows applications to retrieve the name of the related netdevice.

Signed-off-by: Francesco Santoro <francesco.santoro@6wind.com>
9 years agomlx4: fix missing offload flags in scattered Rx
Adrien Mazarguil [Mon, 5 Oct 2015 17:50:06 +0000 (19:50 +0200)]
mlx4: fix missing offload flags in scattered Rx

They were dropped by mistake in the commit below.

Fixes: ab351fe1c95c ("mbuf: remove packet type from offload flags")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agoenic: fix hash creation when not using first numa node
David Marchand [Fri, 11 Sep 2015 08:02:31 +0000 (10:02 +0200)]
enic: fix hash creation when not using first numa node

If dpdk is run with memory only available on socket != 0, then hash
creation will fail and flow director feature won't be available.
Fix this by asking for allocation on caller socket.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked by: Sujith Sankar <ssujith@cisco.com>

9 years agoenic: fix allocation when not using first numa node
David Marchand [Fri, 11 Sep 2015 08:02:30 +0000 (10:02 +0200)]
enic: fix allocation when not using first numa node

Seen by code review.

If dpdk is run with memory only available on socket != 0, then enic pmd
refuses to initialize ports as this pmd requires some memory on socket 0.
Fix this by setting socket to SOCKET_ID_ANY, so that allocations happen on
the caller socket.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked by: Sujith Sankar <ssujith@cisco.com>

9 years agocxgbe: allow to change mtu
Rahul Lakkireddy [Thu, 8 Oct 2015 13:46:09 +0000 (19:16 +0530)]
cxgbe: allow to change mtu

Add a mtu_set() eth_dev_ops to allow DPDK apps to modify device mtu.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
9 years agocxgbe: receive jumbo frames
Rahul Lakkireddy [Thu, 8 Oct 2015 13:46:08 +0000 (19:16 +0530)]
cxgbe: receive jumbo frames

Ensure jumbo mode is enabled and that the mbuf data room size can
accommodate jumbo size.  If the mbuf data room size can't accommodate
jumbo size, chain mbufs to jumbo size.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
9 years agocxgbe: transmit jumbo frames
Rahul Lakkireddy [Thu, 8 Oct 2015 13:46:07 +0000 (19:16 +0530)]
cxgbe: transmit jumbo frames

Add a non-coalesce path.  Skip coalescing for Jumbo Frames, and send the
packet through non-coalesced path if there are enough credits.  Also,
free these non-coalesced packets while reclaiming credits.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
9 years agocxgbe: enable jumbo frames
Rahul Lakkireddy [Thu, 8 Oct 2015 13:46:06 +0000 (19:16 +0530)]
cxgbe: enable jumbo frames

Increase max_rx_pktlen to accommodate jumbo frame size. Perform sanity
checks and enable jumbo mode in rx queue setup. Set link mtu based on
max_rx_pktlen.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
9 years agocxgbe: optimize forwarding performance for 40G
Rahul Lakkireddy [Thu, 8 Oct 2015 13:46:05 +0000 (19:16 +0530)]
cxgbe: optimize forwarding performance for 40G

Update sge initialization with respect to free-list manager configuration
and ingress arbiter. Also update refill logic to refill mbufs only after
a certain threshold for rx.  Optimize tx packet prefetch.

Approx. 3 MPPS improvement seen in forwarding performance after the
optimization.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
9 years agocxgbe: update documentation
Rahul Lakkireddy [Thu, 8 Oct 2015 13:46:10 +0000 (19:16 +0530)]
cxgbe: update documentation

- Add a missed step to mount huge pages in Linux.
- Re-structure Sample Application Notes.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
9 years agoaf_packet: check Tx error
John W. Linville [Thu, 27 Aug 2015 17:50:50 +0000 (13:50 -0400)]
af_packet: check Tx error

Coverity CID # 13200

If sendto fails, the packets will not get transmitted.  Return 0 as
the number of packets transmitted.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
9 years agoaf_packet: refactor error handling to avoid NULL pointer dereference
John W. Linville [Thu, 27 Aug 2015 17:17:13 +0000 (13:17 -0400)]
af_packet: refactor error handling to avoid NULL pointer dereference

Coverity CID # 13321

Checking *internals != NULL before accessing req is not good enough,
because **internals is a function argument and the function doesn't
really know what is passed-in.  We can close our eyes and ignore the
warning on the basis of controlling all the calling code, or we can
refactor the error exit to avoid the issue entirely...

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agoport: move metadata offset reference at mbuf head
Fan Zhang [Fri, 11 Sep 2015 13:35:45 +0000 (14:35 +0100)]
port: move metadata offset reference at mbuf head

This patch relates to ABI change proposed for librte_port. Macros to
access the packet meta-data stored within the packet buffer has been
adjusted to cover the packet mbuf structure.

The LIBABIVER number is incremented.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoapps: add name to LPM parameters
Jasvinder Singh [Thu, 17 Sep 2015 16:03:20 +0000 (17:03 +0100)]
apps: add name to LPM parameters

LPM table and pipeline apps have been modified to
include name parameter of the lpm table.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agotable: add name to LPM parameters
Jasvinder Singh [Thu, 17 Sep 2015 16:03:19 +0000 (17:03 +0100)]
table: add name to LPM parameters

This patch relates to ABI change proposed for librte_table
(lpm table). A new parameter to hold the table name has
been added to the LPM table parameter structures
rte_table_lpm_params and rte_table_lpm_ipv6_params.

The LIBABIVER number is incremented. The release notes
is updated and the deprecation announcement is removed.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoip_frag: fix bit-fields in ipv6 fragment extension
Piotr Azarewicz [Thu, 10 Sep 2015 07:09:17 +0000 (09:09 +0200)]
ip_frag: fix bit-fields in ipv6 fragment extension

Previous implementation won't work on every environment. The order of
allocation of bit-fields within a unit (high-order to low-order or
low-order to high-order) is implementation-defined.
Solution: used bytes instead of bit fields.

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agofm10k/base: add FM10420 device ids
Wang Xiao W [Thu, 10 Sep 2015 04:38:32 +0000 (12:38 +0800)]
fm10k/base: add FM10420 device ids

Add the device ID for Boulder Rapids and Atwood Channel to enable
drivers to support those devices.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: pack TLV overlay structures
Wang Xiao W [Thu, 10 Sep 2015 04:38:21 +0000 (12:38 +0800)]
fm10k/base: pack TLV overlay structures

This patch adds #pragma pack(push, 1) around some structures which are passed
via TLV messages. These structures must not be left unpacked as GCC and
other compilers are wont to do. Otherwise, we get invalid message
responses from the Switch Manager software since it sends 20 bytes and
we expect 24.

Solaris (and other OS's) are not C99 compliant, so they are not able
to use the C99 style #pragma pack() code. Wrap with C99 tag for easy
stripping.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: fix ieee1588 adjustment direction
Wang Xiao W [Thu, 10 Sep 2015 04:38:22 +0000 (12:38 +0800)]
fm10k/base: fix ieee1588 adjustment direction

The SYSTIME_CFG.Adjust field has a Direction bit to indicate whether the
adjustment is positive or negative. However, we incorrectly read the
documentation and the direction bit should be set 1 when positive, not
when negative.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: add clock offset message
Wang Xiao W [Thu, 10 Sep 2015 04:38:37 +0000 (12:38 +0800)]
fm10k/base: add clock offset message

Add support for clock offset message from switch manager. Each PEP will
be responsible for notifying its own VFs, and the originating PEP must
notify its own VFs prior or in addition to sending, as it will not
receive a copy of its own message. Base drivers are expected to need
custom implementations so no message handler is provided in shared code.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: add ieee1588 clock owner message support
Wang Xiao W [Thu, 10 Sep 2015 04:38:35 +0000 (12:38 +0800)]
fm10k/base: add ieee1588 clock owner message support

Add support for tx timestamp mode response message. The switch manager
should send this message whenever the owner changes or when a new port
appears. To simplify logic, treat this as full clock ownership, and call
it the CLOCK_OWNER message. Implement this as a hw->flags field, so that
base driver may use it to disable any functions which modify the clock
including Tx timestamps, frequency adjustments, and offset adjustments.
This ensures only one PEP will be handling these at a time.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: remove 1588 VF API
Wang Xiao W [Thu, 10 Sep 2015 04:38:33 +0000 (12:38 +0800)]
fm10k/base: remove 1588 VF API

Remove support for VF transmit timestamps. VFs should not write the
timestamp bit in the Tx descriptor. Only one Tx timestamp can be
realistically handled at once. It is expected that the switch manager
use FFU logic to disable all timestamp requests except for those
originating from a specific virtual port. It is not possible to
correlate this timestamp accurately if more than one occurs out any
given EPL at a time. Since the primary purpose of Tx timestamps is to
implement PTP daemon, which also requires BAR4 access to change the
clock, do not allow VFs to transmit timestamp. Remove the PF<->VF
message for this behavior.

Note, the VF already didn't have ability to request Tx timestamp mode,
so it essentially wasn't allowed to timestamp before anyways under the
old API.

No longer support old API of request-response timestamp mode messages.
New API only sends timestamp-response when the switch decides which port
will be given control of timestamps. To simplify review of this code,
completely remove the support and re-add support for the response
message in a future patch.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: check VF has a queue
Wang Xiao W [Thu, 10 Sep 2015 04:38:31 +0000 (12:38 +0800)]
fm10k/base: check VF has a queue

It is possible that the PF has not yet assigned resources to the VF.
Although rare, this could result in the VF attempting to read queues it
does not own and result in FUM or THI faults in the PF. To prevent this,
check queue 0 before we continue in init_hw_vf.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: fix VF re-enabling
Wang Xiao W [Thu, 10 Sep 2015 04:38:24 +0000 (12:38 +0800)]
fm10k/base: fix VF re-enabling

When a VF issues an LPORT_STATE request to enable a port which is
already enabled, the PF will first disable the VF. Then it is supposed
to re-enable the VF again with new settings. This is primarily done in
order to ensure that the switch management software properly clears the
previous VF settings. (ie: switch flow rules and so forth). However,
there is a bug in the flow because we check if VF is enabled and don't
re-enable it at the end. The issue is that we disable the VF in order to
clear switch rules, and never follow-up with a re-enable. This results in
a call to enable the VF results in disabling the logical port.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: fix VF queues counting
Wang Xiao W [Thu, 10 Sep 2015 04:38:20 +0000 (12:38 +0800)]
fm10k/base: fix VF queues counting

During initialization, the VF counts its rings by walking the TQDLOC
registers. This only works if the TQMAP/RQMAP registers are set to map
the out-of-bound rings to the first one, so the VF driver can detect when
it has run out of queues cleanly. Update the PF to reset the empty
TQMAP/RQMAP registers post-VFLR to prevent innocent VF drivers from
triggering malicious events.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: fix VF multicast
Wang Xiao W [Thu, 10 Sep 2015 04:38:27 +0000 (12:38 +0800)]
fm10k/base: fix VF multicast

The VF will send a message to request multicast addresses with the
default vid. In the current code, if the PF has statically assigned a
VLAN to a VF, then the VF will not get the multicast addresses. Fix up
all of the various vlan messages to use identical checks (since each
check was different). Also use set as a variable, so that it simplifies
our check for whether vlan matches the pf_vid.

The new logic will allow set of a vlan if it is zero, automatically
converting to the default vid. Otherwise it will allow setting the PF
vid, or any VLAN if PF has not statically assigned a VLAN. This is
consistent behavior, and allows VF to request either 0 or the
default_vid without silently failing. Note that we need the check for
zero since VFs might not get the default VID message in time to actually
request non-zero VLANs.

Create a function, fm10k_iov_select_vid which implements the logic for
selecting a default vid. This helps us remove duplicate code and
streamlines location of this logic so that we don't make similar bugs in
the future.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: fix VF multicast update
Wang Xiao W [Thu, 10 Sep 2015 04:38:19 +0000 (12:38 +0800)]
fm10k/base: fix VF multicast update

VFs were being improperly added to the switch's multicast group. The
error stems from the fact that incorrect arguments were passed to the
"update_mc_addr" function. It would seem to be a copy paste error since
the parameters are similar to the "update_uc_addr" function.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: add mailbox counters
Wang Xiao W [Thu, 10 Sep 2015 04:38:26 +0000 (12:38 +0800)]
fm10k/base: add mailbox counters

A previous bug was uncovered by addition of a debug stat to indicate the
actual number of DWORDS we pulled from the mbmem. It turned out this was
not the same as the tx_dwords counter. While the previous bug fix should
have corrected this in all cases, add some debug stats that count the
number of DWORDs pushed or pulled from the mbmem. Base drivers can use
this in debug builds to help detect this problem in the future.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: fix mailbox connect
Wang Xiao W [Thu, 10 Sep 2015 04:38:30 +0000 (12:38 +0800)]
fm10k/base: fix mailbox connect

When we connect to the mailbox, we insert a fake disconnect header so
that the code does not see an error and thus instantly error every time
we bring up the mailbox. However, we incorrectly record the tail and
head from the local perspective. Since the remote end shouldn't have
anything for us, add a "create_fake_disconnect_hdr" function which
inverts the TAIL and HEAD fields. This enables us to connect without any
errors of either TAIL or HEAD incorrectness, and prevents creating
extraneous error messages. This is necessary now since mbx_reset_work
does not actually clear the Tx FIFO head and tail pointers.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: fix mailbox phantom messages
Wang Xiao W [Thu, 10 Sep 2015 04:38:29 +0000 (12:38 +0800)]
fm10k/base: fix mailbox phantom messages

The phantom messages were a result of incorrectly forgetting to drop
already transmitted messages. We would reset pulled, and tail_len but
left the head/tail pointers alone.

The correct fix is to loop through pulled and drop messages until we've
dropped at least as many bytes as we pulled (possibly dropping a message
we've only partially transmitted. However, we also have to account for
tail_len variable and the 'ack' value as in mbx_pull_head. This means
that we need to re-read the HEAD field of the mailbox header.

Based on testing, this resolves the phantom messages issue, as well as
correctly keeping messages which have yet to be transmitted at all in
the Tx FIFO. Thus, we will begin re-transmission once we have
re-connected.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: ignore oversized mailbox messages
Wang Xiao W [Thu, 10 Sep 2015 04:38:16 +0000 (12:38 +0800)]
fm10k/base: ignore oversized mailbox messages

When we call update_max_size, it does not drop all oversized messages.
This is due to the difficulty in performing this operation, since it is
a FIFO which makes updating anything other than head or tail very
difficult. To fix this, modify validate_msg_size to ensure that we error
out later when trying to transmit the message that could be oversized.
This will generally be a rare condition, as it requires the FIFO to
include a message larger than the max_size negotiated during mailbox
connect. Note that max_size is always smaller than rx.size, so it should
be safe to use here.

Also, update the update_max_size function header comment to clearly
indicate that it does not drop all oversized messages, but only those at
the head of the FIFO.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
9 years agofm10k/base: avoid Tx drop increment during mailbox negotiation
Wang Xiao W [Thu, 10 Sep 2015 04:38:15 +0000 (12:38 +0800)]
fm10k/base: avoid Tx drop increment during mailbox negotiation

After shutting down the mailbox by force, we then go about resetting max
size to 0, and clearing all messages in the FIFO. However, we should
just reset the head pointer so that the FIFO will become empty, rather than
changing the max size to 0. This helps prevent increment in tx_dropped
counter during mailbox negotiation, which is confusing to viewers of
Linux ethtool statistics output.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>