dpdk.git
9 years agoexamples/tep_term: add tunnel filter type configuration
Jijiang Liu [Mon, 22 Jun 2015 16:41:01 +0000 (00:41 +0800)]
examples/tep_term: add tunnel filter type configuration

Add the filter types for VXLAN packet.

The following filter type are added here.

  - Inner MAC&VLAN and tenant ID

  - Inner MAC and tenent ID, and Outer MAC

  - Inner MAC and tenant ID

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
9 years agoexamples/tep_term: add UDP tunneling port configuration
Jijiang Liu [Mon, 22 Jun 2015 16:41:00 +0000 (00:41 +0800)]
examples/tep_term: add UDP tunneling port configuration

The port number of UDP tunneling packet is configurable.

For i40e, it has 16 entries in total.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
9 years agoexamples/tep_term: implement VXLAN processing
Jijiang Liu [Mon, 22 Jun 2015 16:40:59 +0000 (00:40 +0800)]
examples/tep_term: implement VXLAN processing

Implement the VXLAN packet processing functions.

  - VXLAN port configuration

  - VXLAN tunnel setup

  - VXLAN tunnel destroying

  - VXLAN packet processing for Rx side

  - VXLAN packet processing for Tx side

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Signed-off-by: Thomas Long <thomas.long@intel.com>
9 years agoexamples/tep_term: add structures for VXLAN processing
Jijiang Liu [Mon, 22 Jun 2015 16:40:58 +0000 (00:40 +0800)]
examples/tep_term: add structures for VXLAN processing

Add the common APIs of tunneling packet processing.

We are trying to create a framework for tunneling packet processing, which includes

  - Tunnel port configuration

  - Tunnel setup

  - Tunnel destroying

  - Tunneling packet processing for Rx side

  - Tunneling packet processing for Tx side

  - Tunnel parameter processing

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Signed-off-by: Thomas Long <thomas.long@intel.com>
9 years agoexamples/tep_term: define basic VXLAN port information
Jijiang Liu [Mon, 22 Jun 2015 16:40:57 +0000 (00:40 +0800)]
examples/tep_term: define basic VXLAN port information

Add some basic VXLAN definitions in vxlan.h file.

It includes VXLAN port information and VXLAN device structures.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Signed-off-by: Thomas Long <thomas.long@intel.com>
9 years agoexamples/tep_term: initialize VXLAN sample
Jijiang Liu [Mon, 22 Jun 2015 16:40:56 +0000 (00:40 +0800)]
examples/tep_term: initialize VXLAN sample

This patch creates the virtio devices management mechanism.

These functions are from the vHost example, which include:

  - virtio device creation.

  - virtio device destroying.

  - virtio device maintenance.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
[Thomas: remove unused function validate_nb_devices()]
[Thomas: add maintainers section]

9 years agoapp/test: fix crash after mbuf allocation failure
Tetsuya Mukawa [Fri, 12 Jun 2015 02:54:00 +0000 (11:54 +0900)]
app/test: fix crash after mbuf allocation failure

The patch fixes potential null pointer accesses in test_mbuf.
If 'm[i]' is null, stop accessing it.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agoexamples/distributor: fix debug macro
Bruce Richardson [Fri, 5 Jun 2015 16:01:17 +0000 (17:01 +0100)]
examples/distributor: fix debug macro

The macro to turn on additional debug output when the app was compiled
with "-DDEBUG" was missing a ";".

Fixes: 07db4a975094 ("examples/distributor: new sample app")

Signed-off-by: Anbarasan Murugesan <anbarasanx.murugesan@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoreorder: allow random number as starting point
Simon Kagstrom [Wed, 20 May 2015 11:02:05 +0000 (13:02 +0200)]
reorder: allow random number as starting point

We use sequence numbers from a generator which has potentially started
long before the receiver. Therefore, the first number will typically
be > 0. The rte_reorder code will not work in this case, since the
packet is seen as outside of the buffer.

The patch instead records the first sequence number inserted as the
starting point.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Johan Faltstrom <johan.faltstrom@netinsight.net>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agoport: fix unaligned access to metadata
Daniel Mrzyglod [Fri, 5 Jun 2015 14:55:10 +0000 (16:55 +0200)]
port: fix unaligned access to metadata

Fix RTE_MBUF_METADATA macros to allow for unaligned accesses to
meta-data fields.
Forcing aligned accesses is not really required, so this is removing an
unneeded constraint.
This issue was met during testing of the new version of the ip_pipeline
application. There is no performance impact.
This change has no ABI impact, as the previous code that uses aligned
accesses continues to run without any issues.

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoeal: fix log level of early messages
Keith Wiles [Mon, 8 Jun 2015 21:55:52 +0000 (16:55 -0500)]
eal: fix log level of early messages

The RTE_LOG(DEBUG, ...) messages in rte_eal_cpu_init() are printed
even when the log level on the command line was set to INFO or lower.

The problem is the rte_eal_cpu_init() routine was called before
the command line args are scanned. Setting --log-level=7 now
correctly does not print the messages from the rte_eal_cpu_init() routine.

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agolog: fix crash after dump
Jan Blunck [Mon, 1 Jun 2015 09:30:38 +0000 (11:30 +0200)]
log: fix crash after dump

In rte_log_dump_history() the log_history list is reinitialized without
resetting the log_history_size. In the next call to rte_log_add_in_history()
the log_history_size > RTE_LOG_HISTORY and the code unconditionally tries
to remove the first entry:

Program received signal SIGSEGV, Segmentation fault.
rte_log_add_in_history (
    buf=buf@entry=0x7f02035cd000 "[snip]\n", size=size@entry=86)
    at /usr/src/packages/BUILD/lib/librte_eal/common/eal_common_log.c:122

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agoivshmem: fix crash in corner case
Sergio Gonzalez Monroy [Thu, 18 Jun 2015 12:27:30 +0000 (13:27 +0100)]
ivshmem: fix crash in corner case

Depending on the configured segments it is possible to hit a
segmentation fault as a result of decrementing an unsigned index with
value 0.

To avoid it, exit the loop if the index has value 0.

Fixes: 40b966a211ab ("ivshmem: library changes for mmaping using ivshmem")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agokni: ignore double initialization
Marc Sune [Thu, 18 Jun 2015 16:34:48 +0000 (18:34 +0200)]
kni: ignore double initialization

Prevent double initialization of the KNI subsytem.

Signed-off-by: Marc Sune <marc.sune@bisdn.de>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoring: fix return of new port id on creation
Bruce Richardson [Thu, 18 Jun 2015 13:28:41 +0000 (14:28 +0100)]
ring: fix return of new port id on creation

The rte_eth_from_rings API allowed the creation of an ethdev port at
runtime using rte_rings as the underlying storage. However, the return
value from this function was either 0 or -1, and these values were never
actually documented in the API documentation. Unfortunately, the programmers
guide doc examples for this API implied that the return value from this
function was the port id of the newly created ethdev.

Since this latter behaviour is more useful - and already implied by the
documentation, this patch changes the return 0 to "return
data->port_id". It also adds in doxygen comments for the function so it
can be correctly documented in the API reference.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agofm10k: fix mac/vlan filtering
Shaopeng He [Mon, 15 Jun 2015 01:26:10 +0000 (09:26 +0800)]
fm10k: fix mac/vlan filtering

This patch includes 3 changes related to MAC/VLAN address table
when the system (e.g. testpmd) is started and closed:
 - remove default MAC address with fixed VLAN 0 which was for the
   debug purpose before the MAC/VLAN filter function was implemented.
 - enable VF MAC/VLAN filter for the first valid MAC address
   and first valid VLAN ID. This is needed for system (e.g. testpmd)
   to setup default MAC address and default VLAN for VF.
   Later attempt to change these default value will be refused by
   under layer shared code and PF host functions.
 - un-register any combination of VLAN and MAC address from fm10k
   switch side MAC table when the system (e.g. testpmd) is closed.

Signed-off-by: Shaopeng He <shaopeng.he@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
Tested-by: Michael Qiu <michael.qiu@intel.com>
9 years agofm10k: update vlan offload features
Shaopeng He [Thu, 18 Jun 2015 07:21:21 +0000 (15:21 +0800)]
fm10k: update vlan offload features

Fm10k PF/VF does not support QinQ; VLAN strip and filter are always on
for PF/VF ports.

Signed-off-by: Shaopeng He <shaopeng.he@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
9 years agofm10k: add mac filtering
Shaopeng He [Thu, 18 Jun 2015 07:21:20 +0000 (15:21 +0800)]
fm10k: add mac filtering

MAC filter function was newly added, each PF and VF can have up to
64 MAC addresses.
VF filter needs support from PF host, which is not available now.

Signed-off-by: Shaopeng He <shaopeng.he@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
9 years agofm10k: update mac table with vlan filtering
Shaopeng He [Thu, 18 Jun 2015 07:21:19 +0000 (15:21 +0800)]
fm10k: update mac table with vlan filtering

VLAN filter was updated to add/delete one static entry in MAC table for
each combination of VLAN and MAC address. More sanity checks were added.

Signed-off-by: Shaopeng He <shaopeng.he@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
9 years agofm10k: fix default mac/vlan in switch
Chen Jing D(Mark) [Fri, 29 May 2015 08:10:44 +0000 (16:10 +0800)]
fm10k: fix default mac/vlan in switch

Since the communication between PF/Switch Manager, VF/PF is
asynchronous through mailbox, it's hard to determine when Switch
Manager/PF host will send the default vlan to PF/VF. So, it's
necessary to set default vlan until the device is started.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Shaopeng He <shaopeng.he@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
9 years agofm10k: check mac address
Chen Jing D(Mark) [Fri, 29 May 2015 08:10:43 +0000 (16:10 +0800)]
fm10k: check mac address

After acquiring MAC address from HW, it's necessary to validate
MAC address before use.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Shaopeng He <shaopeng.he@intel.com>
Tested-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
9 years agofm10k: fix switch synchronization
Chen Jing D(Mark) [Fri, 29 May 2015 08:10:42 +0000 (16:10 +0800)]
fm10k: fix switch synchronization

In fm10k, PF driver needs to communicate with switch through
mailbox if it needs to add/delete MAC address.
This fix will validate if switch is ready before going forward.
Then, it is necessary to acquire LPORT_MAP info after issuing
MAC addr request to switch.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Shaopeng He <shaopeng.he@intel.com>
Tested-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
9 years agofm10k: fix Tx multi-segment frame
Chen Jing D(Mark) [Fri, 29 May 2015 08:10:41 +0000 (16:10 +0800)]
fm10k: fix Tx multi-segment frame

In TX side, bit FM10K_TXD_FLAG_LAST in TX descriptor only is set
in the last descriptor for multi-segment packets. But current
implementation didn't set all the fields of TX descriptor, which
will cause descriptors processed now to re-use fields set in last
scroll. If FM10K_TXD_FLAG_LAST bit was set in the last round and
it happened this is not the last descriptor of a multi-segnment
packet, HW will send out the incomplete packet out and leads to
data intergrity issue.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Shaopeng He <shaopeng.he@intel.com>
Tested-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
9 years agofm10k: fix jumbo frame issue
Chen Jing D(Mark) [Fri, 29 May 2015 08:10:40 +0000 (16:10 +0800)]
fm10k: fix jumbo frame issue

fm10k can't receive frame greater than 1536 and Scatter RX
function can't work correctly. The root cause is
SRRCTL.FM10K_SRRCTL_BUFFER_CHAINING_EN bit is not enabled.

Test report: http://dpdk.org/ml/archives/dev/2015-June/019242.html

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Shaopeng He <shaopeng.he@intel.com>
Tested-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
9 years agofm10k: fix Rx buffer size
Chen Jing D(Mark) [Fri, 29 May 2015 08:10:39 +0000 (16:10 +0800)]
fm10k: fix Rx buffer size

As RX buffer is aligned to 512B within mbuf, some bytes are reserved
for this purpose, and the worst case could be 511B. But SRR reg
assumes all buffers have the same size. In order to fill the gap,
we'll have to consider the worst case and assume 512B is reserved.
If we don't do so, it's possible for HW to overwrite data to next
mbuf.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Shaopeng He <shaopeng.he@intel.com>
Tested-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
9 years agofm10k: fix maximum queue number for VF
Chen Jing D(Mark) [Fri, 12 Jun 2015 07:06:29 +0000 (15:06 +0800)]
fm10k: fix maximum queue number for VF

Both PF and VF shared code in function fm10k_stats_get().
The function works well with PF, but has problem with VF since
VF has less queues than PF.

Fixes: a6061d9e7075 ("fm10k: register PF driver")

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
9 years agofm10k: remove mbuf size sanity check
Chen Jing D(Mark) [Fri, 12 Jun 2015 07:06:28 +0000 (15:06 +0800)]
fm10k: remove mbuf size sanity check

Original implementation required mbuf size should be greater than
ETHER_MAX_VLAN_FRAME_LEN, which is not necessary. If it's less
than that value, scatter function will be selected and incoming
packets greater than mbuf size will be filled into several mbufs.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
9 years agofm10k: support promiscuous mode
Chen Jing D(Mark) [Fri, 12 Jun 2015 07:06:27 +0000 (15:06 +0800)]
fm10k: support promiscuous mode

Add functions to support promiscuous/allmulticast enable and
disable.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Tested-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
9 years agoixgbe: fix X550 copper link
Wenzhuo Lu [Tue, 16 Jun 2015 08:07:49 +0000 (16:07 +0800)]
ixgbe: fix X550 copper link

For there're only laser ports on x550 before, we only considered laser
ports for the testpmd CLIs "port start/stop ...". Now we have new x550
devices which have copper ports. Use the API for copper to enable/disable
these ports.

And also let the testpmd CLI "set link-up/down ..." support copper
ports.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoixgbe: fix TSO in IPv6
Didier Pallard [Mon, 22 Jun 2015 14:21:18 +0000 (16:21 +0200)]
ixgbe: fix TSO in IPv6

When TSO is used with IPv6, generated frames are incorrect.
L4 frame is OK, but length field of IPv6 header was not populated correctly.

IXGBE_ADVTXD_TUCMD_IPV6 flag is set for better readability, even if it
does nothing.

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbevf: fix link status for PF up/down events
Sergio Gonzalez Monroy [Tue, 16 Jun 2015 14:38:48 +0000 (15:38 +0100)]
ixgbevf: fix link status for PF up/down events

Current ixgbe VF base driver only really read the status register when:
 - get_link_status is true
 - link reset
 - mailbox timeout.

We only set get_link_status to true when we start the PF/VF, so
following calls to ixgbe_dev_link_update will just keep the old link
status unless the link has been reset.

Because of this behaviour, when the link status of the PF changes after
the VF has been initialized, we do not read the current status register
from the nic and instead we just keep the old link status.

Fix the problem by setting this field to true before calling
ixgbe_check_link function from base driver. We don't need to check after
this call for get_link_status anymore, so remove it.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agoixgbevf: fix Rx function selection
Sergio Gonzalez Monroy [Fri, 12 Jun 2015 15:18:19 +0000 (16:18 +0100)]
ixgbevf: fix Rx function selection

The logic to select ixgbe VF RX function is different than PF side.

There are a few issues with its current state:
 - it does not allow to select ixgbe_recv_pkts_vec among other options.
 - it can cause memory corruption for scatter mode as it does not allocate
   enough entries in sw_ring.
 - when checksum is enabled, incorrect vector RX function is selected.

To solve above issues, change the VF RX function selection logic to
mimic PF side.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoixgbe: fix flow director flexbytes offset
Jingjing Wu [Fri, 19 Jun 2015 06:35:25 +0000 (14:35 +0800)]
ixgbe: fix flow director flexbytes offset

The flexbytes offset can not be set, because the value is over written
when fdir is enabled.
This patch fixes this issue, and also removes some reduplicate lines.

Fixes: d54a9888267c ("ixgbe: support flexpayload configuration of flow director")

Reported-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Tested-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agomempool: fix style
Olivier Matz [Fri, 19 Jun 2015 16:16:39 +0000 (18:16 +0200)]
mempool: fix style

Do some cosmetic clean-up.
Fix typos, indentation, and doxygen style.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
9 years agomempool: add structure for object trailers
Olivier Matz [Fri, 19 Jun 2015 16:16:38 +0000 (18:16 +0200)]
mempool: add structure for object trailers

Each object stored in mempools are suffixed by a trailer, storing
a cookie in debug mode which help to detect memory corruptions.

Like for headers, introduce a structure that materializes the content of
this trailer.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
9 years agomempool: add structure for object headers
Olivier Matz [Fri, 19 Jun 2015 16:16:37 +0000 (18:16 +0200)]
mempool: add structure for object headers

Each object stored in mempools are prefixed by a header, allowing for
instance to retrieve the mempool pointer from the object. When debug is
enabled, a cookie is also added in this header that helps to detect
corruptions and double-frees.

Introduce a structure that materializes the content of this header,
and will simplify future patches adding things in this header.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
9 years agoapp/test: add hash scalability test using HTM lock elision
Roman Dementiev [Fri, 19 Jun 2015 11:08:23 +0000 (13:08 +0200)]
app/test: add hash scalability test using HTM lock elision

This patch adds a new auto-test for testing the scaling
of concurrent inserts into rte_hash when protected by
the normal spinlock vs. the spinlock with HTM lock
elision. The test also benchmarks single-threaded
access without any locks.

Signed-off-by: Roman Dementiev <roman.dementiev@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agorwlock: add HTM lock elision for x86
Roman Dementiev [Fri, 19 Jun 2015 11:08:22 +0000 (13:08 +0200)]
rwlock: add HTM lock elision for x86

This patch adds methods that use hardware memory transactions (HTM) on
fast-path for rwlock (a.k.a. lock elision). Here the methods are implemented
for x86 using Restricted Transactional Memory instructions (Intel(r)
Transactional Synchronization Extensions). The implementation fall-backs to
the normal rwlock if HTM is not available or memory transactions fail. This is
not a replacement for all rwlock usages since not all critical sections
protected by locks are friendly to HTM. For example, an attempt to perform
a HW I/O operation inside a hardware memory transaction always aborts
the transaction since the CPU is not able to roll-back should the transaction
fail. Therefore, hardware transactional locks are not advised to be used around
rte_eth_rx_burst() and rte_eth_tx_burst() calls.

Signed-off-by: Roman Dementiev <roman.dementiev@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agospinlock: add HTM lock elision for x86
Roman Dementiev [Fri, 19 Jun 2015 11:08:21 +0000 (13:08 +0200)]
spinlock: add HTM lock elision for x86

This patch adds methods that use hardware memory transactions (HTM) on fast-path
for spinlocks (a.k.a. lock elision). Here the methods are implemented for x86
using Restricted Transactional Memory instructions (Intel(r) Transactional
Synchronization Extensions). The implementation fall-backs to the normal
spinlock if HTM is not available or memory transactions fail. This is not
a replacement for all spinlock usages since not all critical sections protected
by spinlocks are friendly to HTM. For example, an attempt to perform a HW I/O
operation inside a hardware memory transaction always aborts the transaction
since the CPU is not able to roll-back should the transaction fail.
Therefore, hardware transactional locks are not advised to be used around
rte_eth_rx_burst() and rte_eth_tx_burst() calls.

Signed-off-by: Roman Dementiev <roman.dementiev@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agodoc: fix doxygen warnings
Thomas Monjalon [Thu, 18 Jun 2015 21:43:06 +0000 (23:43 +0200)]
doc: fix doxygen warnings

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agodoc: fix doxygen warnings in vhost API
Ouyang Changchun [Fri, 19 Jun 2015 02:20:42 +0000 (10:20 +0800)]
doc: fix doxygen warnings in vhost API

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
9 years agoacl: add new test cases
Konstantin Ananyev [Mon, 8 Jun 2015 10:41:30 +0000 (11:41 +0100)]
acl: add new test cases

Add several new test cases for ACL to cover different build configurations.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoacl: fix ambiguity between test rules
Konstantin Ananyev [Mon, 8 Jun 2015 10:41:29 +0000 (11:41 +0100)]
acl: fix ambiguity between test rules

Some test rules had equal priority for the same category.
That can cause an ambiguity in build trie and test results.
Specify different priority value for each rule from the same category.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoacl: remove unused code
Konstantin Ananyev [Mon, 8 Jun 2015 10:41:28 +0000 (11:41 +0100)]
acl: remove unused code

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoacl: introduce a macro for bitmask conversion
Konstantin Ananyev [Mon, 8 Jun 2015 10:41:27 +0000 (11:41 +0100)]
acl: introduce a macro for bitmask conversion

Introduce new RTE_ACL_MASKLEN_TO_BITMASK macro, that will be used
in several places inside librte_acl and it's UT.
Simplify and cleanup build_trie() code a bit.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoacl: fix unneeded trie splitting for subset of rules
Konstantin Ananyev [Mon, 8 Jun 2015 10:41:26 +0000 (11:41 +0100)]
acl: fix unneeded trie splitting for subset of rules

When rebuilding a trie for limited rule-set,
don't try to split the rule-set even further.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoacl: add function to check build input parameters
Konstantin Ananyev [Mon, 8 Jun 2015 10:41:25 +0000 (11:41 +0100)]
acl: add function to check build input parameters

Move check for build confg parameter into a separate function.
Simplify acl_calc_wildness() function.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoacl: remove redundant macro
Konstantin Ananyev [Mon, 8 Jun 2015 10:41:24 +0000 (11:41 +0100)]
acl: remove redundant macro

Use global RTE_LEN2MASK macro, instead of local LEN2MASK.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoacl: fix invalid rule wildness calculation for bitmask field type
Konstantin Ananyev [Mon, 8 Jun 2015 10:41:23 +0000 (11:41 +0100)]
acl: fix invalid rule wildness calculation for bitmask field type

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoport: add ring writer nodrop
Maciej Gajdzica [Thu, 21 May 2015 12:28:44 +0000 (14:28 +0200)]
port: add ring writer nodrop

When ring_writer_nodrop port fails to send data, it tries to resend.
Operation is aborted when maximum number of retries is reached.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoport: add ethdev writer nodrop
Maciej Gajdzica [Thu, 21 May 2015 12:28:43 +0000 (14:28 +0200)]
port: add ethdev writer nodrop

When ethdev_writer_nodrop port fails to send data, it tries to resend.
Operation is aborted when maximum number of retries is reached.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoport: new Tx burst implementation of ring writer
Maciej Gajdzica [Thu, 21 May 2015 12:28:42 +0000 (14:28 +0200)]
port: new Tx burst implementation of ring writer

New implementation sends burst without copying data to internal buffer
if it is possible. It is similar to tx_bulk function in ethdev_writer
port.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agoport: remove an ethdev writer implementation
Maciej Gajdzica [Thu, 21 May 2015 12:28:41 +0000 (14:28 +0200)]
port: remove an ethdev writer implementation

There was two implementations of tx_bulk function in ethdev_writer port.
The function to run is chosen with WRITER_APPROACH define. This patch
removes WRITER_APPROACH = 0 implementation, as it seems to be slower.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agodoc: fix doxygen warnings in QoS API
Michal Jastrzebski [Wed, 17 Jun 2015 14:37:02 +0000 (16:37 +0200)]
doc: fix doxygen warnings in QoS API

This patch fix doxygen warnings when generating documentation
for qos_meter and qos_sched.

Signed-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agovhost: remove unnecessary descriptor length updates
Ouyang Changchun [Tue, 9 Jun 2015 01:03:04 +0000 (09:03 +0800)]
vhost: remove unnecessary descriptor length updates

Remove these unnecessary vring descriptor length updating, vhost should
not change them.
virtio in front end should assign value to desc.len for both rx and tx.

Test report: http://dpdk.org/ml/archives/dev/2015-June/018610.html

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agovhost: rework mergeable Rx
Ouyang Changchun [Tue, 9 Jun 2015 01:03:03 +0000 (09:03 +0800)]
vhost: rework mergeable Rx

Extract codes into a function:
update_secure_len which is used to accumulate the buffer len in the
vring descriptors and to fill struct buf_vec.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agovhost: refine code style
Ouyang Changchun [Tue, 9 Jun 2015 01:03:02 +0000 (09:03 +0800)]
vhost: refine code style

Remove unnecessary new line.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agovhost: fix enqueue/dequeue to handle chained vring descriptors
Ouyang Changchun [Tue, 9 Jun 2015 01:03:01 +0000 (09:03 +0800)]
vhost: fix enqueue/dequeue to handle chained vring descriptors

Vring enqueue need consider the 2 cases:
 1. use separate descriptors to contain virtio header and actual data,
    e.g. the first descriptor is for virtio header, and then followed
    by descriptors for actual data.
 2. virtio header and some data are put together in one descriptor,
    e.g. the first descriptor contain both virtio header and part of
    actual data, and then followed by more descriptors for rest of packet
    data, current DPDK based virtio-net pmd implementation is this case;

So does vring dequeue, it should not assume vring descriptor is chained
or not chained, it should use desc->flags to check whether it is chained
or not. This patch also fixes TX corrupt issue when vhost co-work with
virtio-net driver which uses one single vring descriptor (header and data
are in one descriptor) for virtio tx process on default.

Test report: http://dpdk.org/ml/archives/dev/2015-June/018610.html

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agokni: fix ioctl in container
Wenfeng Liu [Mon, 15 Jun 2015 04:07:33 +0000 (00:07 -0400)]
kni: fix ioctl in container

In containers like docker, current->pid returns current process's global
PID instead of its own PID under containers's PID namespace, and
get_net_ns_by_pid() suppose to accept a virtual PID under its own
namespace, so we should use task_pid_vnr(current) to get current process's
virtual PID instead of current->pid.

Signed-off-by: Wenfeng Liu <liuwf@arraynetworks.com.cn>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agokni: fix multicast ioctl handling
Simon Kagstrom [Tue, 2 Jun 2015 07:21:55 +0000 (09:21 +0200)]
kni: fix multicast ioctl handling

We did some (very basic) tests with IGMP, which involves adding
multicast addresses to ETH interfaces. This is done via the ip tool,
an example can be found on e.g.,

  http://superuser.com/questions/324824/linux-built-in-or-open-source-program-to-join-multicast-group

and this will fail on KNI interfaces because of an unimplemented ioctl
SIOCADDMULTI. The patch simply adds an empty callback for set_rx_mode
(typically used for setting up hardware) so that the ioctl succeeds.
This is the same thing as the Linux tap interface does.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Johan Faltstrom <johan.faltstrom@netinsight.net>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agokni: fix Rx loop limit
Jay Rolette [Wed, 3 Jun 2015 19:18:57 +0000 (14:18 -0500)]
kni: fix Rx loop limit

Loop processing packets dequeued from rx_q was using the number of
packets requested, not how many it actually received.

Variable rename to make code a little more clear

Signed-off-by: Jay Rolette <rolette@infiniteio.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agokni: optimize Rx burst size computation
Jay Rolette [Wed, 3 Jun 2015 19:18:56 +0000 (14:18 -0500)]
kni: optimize Rx burst size computation

No reason to check out many entries are in kni->rx_q prior to
actually pulling them from the fifo. You can't dequeue more than
are there anyway. Max entries to dequeue is either the max batch
size or however much space is available on kni->free_q (lesser of the two).

Signed-off-by: Jay Rolette <rolette@infiniteio.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agokni: optimize single thread loop
Jay Rolette [Wed, 3 Jun 2015 19:18:55 +0000 (14:18 -0500)]
kni: optimize single thread loop

Do not need the 'safe' version of list_for_each_entry() if you are
not deleting from the list as you iterate over it.

Signed-off-by: Jay Rolette <rolette@infiniteio.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agokni: add link status update
Vijayakumar Muthuvel Manickam [Tue, 16 Jun 2015 06:39:54 +0000 (02:39 -0400)]
kni: add link status update

Implement .ndo_change_carrier to enable
DPDK applications to propagate link state changes to
kni virtual interfaces through sysfs

Signed-off-by: Vijayakumar Muthuvel Manickam <mmvijay@gmail.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agokni: query the name of an instance
Bruce Richardson [Wed, 27 May 2015 13:47:49 +0000 (14:47 +0100)]
kni: query the name of an instance

When a KNI object is created, a name is assigned to it which is stored
internally. There is also an API function to look up a KNI object by
name, but there is no API to query the current name of an existing
KNI object. This patch adds just such an API.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agohash: fix typo in jhash comments
Thomas Monjalon [Tue, 16 Jun 2015 10:14:48 +0000 (12:14 +0200)]
hash: fix typo in jhash comments

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoapp/test: verify more jhash functions
Pablo de Lara [Wed, 10 Jun 2015 15:25:27 +0000 (16:25 +0100)]
app/test: verify more jhash functions

Added new test that verifies that rte_jhash_1words,
rte_jhash_2words and rte_jhash_3words return the same
values as rte_jhash.

Note that this patch has been added after the update
of the jhash function because these 3 functions did not
return the same values as rte_jhash before

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agohash: rename a jhash function
Pablo de Lara [Wed, 10 Jun 2015 15:25:26 +0000 (16:25 +0100)]
hash: rename a jhash function

Changed name to something more meaningful,
and mark rte_jhash2 as deprecated.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agohash: remove duplicated code
Pablo de Lara [Wed, 10 Jun 2015 15:25:25 +0000 (16:25 +0100)]
hash: remove duplicated code

rte_jhash is basically like __rte_jhash_2hashes but
it returns only 1 hash, instead of 2.
In order to remove duplicated code, rte_jhash calls __rte_jhash_2hashes,
passing 0 as the second seed and returning just the first hash value.
(performance penalty is negligible)

The same is done with rte_jhash2. Also, rte_jhash2 is just an specific case
where keys are multiple of 32 bits, and where no key alignment check is required.
So,to avoid duplicated code, the function calls __rte_jhash_2hashes
with check_align = 0 (to use the optimal path)

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agohash: add new jhash functions
Pablo de Lara [Wed, 10 Jun 2015 15:25:24 +0000 (16:25 +0100)]
hash: add new jhash functions

With the jhash update, two new functions were introduced:

- rte_jhash_2hashes: Same as rte_jhash, but takes two seeds
                     and return two hashes (uint32_ts)

- rte_jhash2_2hashes: Same as rte_jhash2, but takes two seeds
                     and return two hashes (uint32_ts)

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
[Thomas: fix doxygen typos]

9 years agohash: update jhash function with the latest available
Pablo de Lara [Wed, 10 Jun 2015 15:25:23 +0000 (16:25 +0100)]
hash: update jhash function with the latest available

Jenkins hash function was developed originally in 1996,
and was integrated in first versions of DPDK.
The function has been improved in 2006,
achieving up to 35% better performance, compared to the original one.

This patch integrates that code into the rte_jhash library.
It also updates the precalculated hash values in the unit test,
as the code now returns different values (expected).

A final note has been added in release notes for stating
the changes made.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoapp/test: add new functional tests for hash functions
Pablo de Lara [Wed, 10 Jun 2015 15:25:22 +0000 (16:25 +0100)]
app/test: add new functional tests for hash functions

In order to make sure that the hash functions are returning
the correct values, new tests have been added:

- First test compares precalculated hash values with values calculated
from the existing hash functions.
- Second test compares values returned from rte_jhash2 and rte_jhash,
expecting same return (only for multiple of 4 bytes keys)

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoapp/test: change order of loops in hash function tests
Pablo de Lara [Wed, 10 Jun 2015 15:25:21 +0000 (16:25 +0100)]
app/test: change order of loops in hash function tests

In order to see more clearly the performance difference
between different hash functions, order of the loops
have been changed, so it iterates first through initial values,
then key sizes and then the hash functions.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoapp/test: update hash key size range and initial values
Pablo de Lara [Wed, 10 Jun 2015 15:25:20 +0000 (16:25 +0100)]
app/test: update hash key size range and initial values

Previous key sizes used for testing did not have much purpose.
This patch substitutes them with some more meaninful
(standard multiple of 2 key sizes, plus IPv4/v6 tuple and others)

Also an arbitrary initial value has been added to increase
the test coverage, and RTE_DIM macro is used to iterate the loops.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoapp/test: improve accuracy on hash measurements
Pablo de Lara [Wed, 10 Jun 2015 15:25:19 +0000 (16:25 +0100)]
app/test: improve accuracy on hash measurements

Cycles per hash calculation were measured per single operation.
It is much more accurate to run several iterations between measurements
and divide by number of iterations.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoapp/test: move hash performance tests to separate file
Pablo de Lara [Wed, 10 Jun 2015 15:25:18 +0000 (16:25 +0100)]
app/test: move hash performance tests to separate file

This patch moves hash function performance tests to a separate file,
so user can check performance of the existing hash functions quicker,
without having to run all the other hash operation performance tests,
which takes some time.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoixgbe: fix X550 flow director check
Wenzhuo Lu [Mon, 15 Jun 2015 05:59:26 +0000 (13:59 +0800)]
ixgbe: fix X550 flow director check

On x550, flow director doesn't support other IP packets directly.
If we want to monitor IP other packets, the L4 protocol and ports must
be masked. It means, on x550, if we want to add a flow director filter
for other IP packets, a flow director mask must have been configed to
mask L4 protocol and ports.

Return err when the user try to config a flow director filter for other
IP packets without flow director mask configed before. And print err log
for it.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
9 years agoixgbe/base: restrict EEE to X550em KR backplane
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:58 +0000 (13:21 +0800)]
ixgbe/base: restrict EEE to X550em KR backplane

This patch sets the setup_EEE function pointer to NULL for the
interfaces which do not support EEE (Energy Efficient Ethernet).
Currently only the KR backplane interface (0x15AB) supports EEE.
Setting this pointer to NULL prevents EEE registers from being
incorrectly modified and gives base drivers a flag to check for
EEE support.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: add X550em PHY reset
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:57 +0000 (13:21 +0800)]
ixgbe/base: add X550em PHY reset

This patch adds x550em PHY reset function ixgbe_reset_phy_t_X550em.
ixgbe_reset_phy_t_X550em calls the reset PHY generic, and then enables
the x550em PHY LASI(Link Alarm Status Interrupt) interrupts.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: fix lan id before first i2c access
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:56 +0000 (13:21 +0800)]
ixgbe/base: fix lan id before first i2c access

Set the lan_id before the first I2C access. The existing call was
clearly being done after a previous I2C access in the same function
and that can't be right, so call the set_lan_id method earlier. At
this point it probably doesn't matter for this QSFP function, but
it makes sense to do it consistently anyway.

On X550, be sure to set the lan_id before using it to configure the
mux control output, else the mux will not be controlled.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: fix lan id for X550em
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:45 +0000 (13:21 +0800)]
ixgbe/base: fix lan id for X550em

The introduction of ixgbe_get_bus_info_X550em failed to call the
set_lan_id method to set the func and lan_id and deal with port-
swapped configurations. Add the call to resolve the problem.

Fixes: 4cf0bb32a912 ("ixgbe/base: get X550 bus info")

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: add X550em link check
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:55 +0000 (13:21 +0800)]
ixgbe/base: add X550em link check

This patch adds ixgbe_check_link_t_X550em for checking x550em
PHY link. We check that both the MAC and external x550em PHY have link.
This is to avoid a false link up between the internal and external PHY
when the external PHY doesn't have link.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: add X550em PHY interrupt and forced speeds
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:54 +0000 (13:21 +0800)]
ixgbe/base: add X550em PHY interrupt and forced speeds

This patch adds x550em external PHY interrupt and forced 1G/10G
support. Support includes enabling and handling Link Status
Change and Thermal Sensor interrupt. ixgbe_handle_lasi has been added
to the API for handling the interrupts received from x550em PHY.
ixgbe_enable_lasi_ext_t_x550em and ixgbe_get_lasi_ext_t_x550em have been
added to X550em to enable mask and check interrupt flags for x550em PHY.

Forced 1G/10G link speed is handled via ixgbe_setup_mac_link_t_X550em.
ixgbe_setup_mac_link_t_X550em sets up the internal PHY and
external PHY link to either 10G or 1G based on the user selected auto
advertised link speed setting. Then sets up the external PHY auto
advertised link speed.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: add X550em autoneg flow control
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:53 +0000 (13:21 +0800)]
ixgbe/base: add X550em autoneg flow control

This patch adds x550em Auto neg Flow Control support to
ixgbe_device_supports_autoneg_fc and sets the x550em setup_fc function
pointer to ixgbe_setup_fc_generic. ixgbe_setup_fc_generic is used for
x550em because flow control is setup on the external PHY via MDIO, when
ixgbe_setup_fc_X550em sets up flow control on the internal PHY.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: rework X550em PHY setup function
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:52 +0000 (13:21 +0800)]
ixgbe/base: rework X550em PHY setup function

This patch cleans up the ixgbe_setup_internal_phy_ x550em() function as follows:
 - Renames it to ixgbe_setup_internal_phy_t_x550em to clarify that it is
   specific to copper
 - Returns an error if called for non-copper devices
 - Corrects the comments
 - Removed the LASI(Link Alarm Status Interrupt) status register checks as
   this was incorrect and never worked correctly anyway.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: fix init handling of X550em link down
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:51 +0000 (13:21 +0800)]
ixgbe/base: fix init handling of X550em link down

This patch changes the return value for ixgbe_setup_internal_phy_t_x550em
when link is down to IXGBE_SUCCESS.
The driver will call ixgbe_setup_internal_phy_t_x550em when a link status
change is reported. The links status change can occur on link up or link
down, and if the link status change is for link down then there is no iXFI
setup necessary and no error condition needs to be returned.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: move i2c mux function for X550em
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:50 +0000 (13:21 +0800)]
ixgbe/base: move i2c mux function for X550em

The following patch moves the handling of the I2C MUX (which is only
used for x550em SFP+ devices) out of the ixgbe_x540.c file and
into the ixgbe_x550.c file where it belongs.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: new simplified X550em init flow
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:49 +0000 (13:21 +0800)]
ixgbe/base: new simplified X550em init flow

The init flow is simplified. We no longer wait for the PHY FW init
complete bit to be set as this bit is only set once by the PHY at power
on and then cleared on the first read. So only the first instance of
running SW (or possibly MAC FW) needs to initialize the PHY.

The PHY initialization has been simplified and now only requires that
the PHY FW be "un-stalled". SW no longer needs to put the PHY in
low-power mode or enable the transceiver.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: fix X550em flow control for KR backplane
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:48 +0000 (13:21 +0800)]
ixgbe/base: fix X550em flow control for KR backplane

For the KR backplane which is different from other backplane,
in that we can't use auto-negotiation to determine the
mode. Instead, use whatever the user configured.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: add X550em LPLU support
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:47 +0000 (13:21 +0800)]
ixgbe/base: add X550em LPLU support

This patch adds SW Low Power Link Up (LPLU) support for x550em PHY.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: add SFP+ dual-speed support
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:46 +0000 (13:21 +0800)]
ixgbe/base: add SFP+ dual-speed support

This patch adds SFP+ dual-speed support.
82599 fiber link code was moved from ixgbe_82599.c to ixgbe_commom.c
for use by X550em, and the API was updated to support the common code
usage. SFP MAC link code is added to x550em.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: disable X550em FEC to save power
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:44 +0000 (13:21 +0800)]
ixgbe/base: disable X550em FEC to save power

The FEC (Forward Error Correction) feature can improve BER (Bit Error Rate)
but uses more power to do so. It also cannot be used with
EEE (Energy Efficient Ethernet).
EEE is an important feature, and we have no known BER issues, so FEC
is not needed.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: fix X550em mux after MAC reset
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:43 +0000 (13:21 +0800)]
ixgbe/base: fix X550em mux after MAC reset

The I2C mux control relies on the SDP setting in the ESDP register
so it is necessary to restore the value after a MAC reset. So,
put the code in a function so it can be used in more than one place.

Fixes: d2e72774e58c ("ixgbe/base: support X550")

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: reset X550em CS4227 when needed
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:42 +0000 (13:21 +0800)]
ixgbe/base: reset X550em CS4227 when needed

On some hardware platforms, the CS4227 does not initialize properly.
Detect those cases and reset it appropriately.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: issue firmware command when resetting X550em
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:41 +0000 (13:21 +0800)]
ixgbe/base: issue firmware command when resetting X550em

The driver now needs to issue a firmware command to inform the
firmware that a driver is coming up. This prevents the possibility
of the firmware and the driver configuring the PHY at the same
time. Upon completion of the command, the firmware will no longer
be configuring the PHY.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: reduce i2c retry count for X550
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:40 +0000 (13:21 +0800)]
ixgbe/base: reduce i2c retry count for X550

A retry count of 10 is likely to run into problems on X550 devices
that have to detect and reset unresponsive CS4227 devices. So,
reduce the I2C retry count to 3 for X550 and above. This should
avoid any possible regressions in existing devices.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: provide unlocked i2c methods
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:39 +0000 (13:21 +0800)]
ixgbe/base: provide unlocked i2c methods

Most I2C accesses take and release semaphores for each access. It's
also necessary to perform multiple I2C operations under the same
holding of the semaphore, so provide unlocked I2C methods for that
purpose.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: remove useless function
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:38 +0000 (13:21 +0800)]
ixgbe/base: remove useless function

Remove the function which is not called by the drivers.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: fix tunnelled UDP and TCP frames in flow director
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:37 +0000 (13:21 +0800)]
ixgbe/base: fix tunnelled UDP and TCP frames in flow director

All bits in FDIRTCPM and FDIRUDPM are set to 1 when
ixgbe_fdir_set_input_mask_82599 is called. Not settings these bits will cause
TCP and UDP packets to be filtered out when NVGRE or VXLAN mode is enabled.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agoixgbe/base: check return value after calling
Wenzhuo Lu [Fri, 5 Jun 2015 05:21:36 +0000 (13:21 +0800)]
ixgbe/base: check return value after calling

This patch moves the check of the return value from
ixgbe_start_hw_generic after the function is called.
Previously we had the code to disable relaxed ordering in
between, which seems a bit out of place.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>