dpdk.git
8 years agonet/bnxt: add link state operations
Ajit Khaparde [Wed, 15 Jun 2016 21:23:35 +0000 (14:23 -0700)]
net/bnxt: add link state operations

Adds dev_ops to set link Up or Down as appropriate.
Uses the bnxt_set_hwrm_link_config() API added previously.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add MAC address
Ajit Khaparde [Wed, 15 Jun 2016 21:23:34 +0000 (14:23 -0700)]
net/bnxt: add MAC address

This patch adds dev_ops to Add/Remove MAC addresses.
These use the bnxt_hwrm_set_filter() defined previously

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: free memory in close operation
Ajit Khaparde [Wed, 15 Jun 2016 21:23:33 +0000 (14:23 -0700)]
net/bnxt: free memory in close operation

This patch adds code to free all resources except the one corresponding
to HWRM, which are required to notify the HWRM that the driver is unloaded
(these are freed in uninit()).

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add multicast
Ajit Khaparde [Wed, 15 Jun 2016 21:23:32 +0000 (14:23 -0700)]
net/bnxt: add multicast

This patch adds dev_ops to enable/disable multicast traffic.
Uses the bnxt_hwrm_cfa_l2_set_rx_mask() API added earlier.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add promiscuous mode
Ajit Khaparde [Wed, 15 Jun 2016 21:23:31 +0000 (14:23 -0700)]
net/bnxt: add promiscuous mode

This patch adds the promiscuous mode enable and disable dev_ops.
Uses the bnxt_hwrm_cfa_l2_set_rx_mask() API added in an earlier commit.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add start/stop/link update operations
Ajit Khaparde [Wed, 15 Jun 2016 21:23:30 +0000 (14:23 -0700)]
net/bnxt: add start/stop/link update operations

This patch adds code to add the start, stop and link update dev_ops.

Also adds wrapper functions like bnxt_init_chip(), bnxt_init_nic(),
bnxt_alloc_mem(), bnxt_free_mem()

The BNXT driver will now minimally pass traffic with testpmd.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: query PHY configuration
Ajit Khaparde [Wed, 15 Jun 2016 21:23:29 +0000 (14:23 -0700)]
net/bnxt: query PHY configuration

Add HWRM calls to query the port's PHY and link configuration.

New HWRM call:
bnxt_hwrm_port_phy_qcfg
This command queries the PHY configuration for the port

Also adding helper function like bnxt_get_hwrm_link_config()
and bnxt_parse_hw_link_speed() parse the link state.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: allocate rings and groups
Ajit Khaparde [Wed, 15 Jun 2016 21:23:28 +0000 (14:23 -0700)]
net/bnxt: allocate rings and groups

Add a top level functions to initialize ring groups, and functions
to allocate and free all the rings via HWRM.

A ring group is identified by an index. It consists of Rx or Tx ring id,
completion ring id and a statistics context. Once a ring group is
initialized, use this group index while creating the rings in the ASIC
using the appropriate HWRM API added via earlier patches.

Functions added:
bnxt_free_cp_ring
Calls the HWRM function generic ring free with arguments specific
to a completion ring and sanitizes the host completion structure
bnxt_free_all_hwrm_rings
Frees all the HWRM allocated hardware rings
bnxt_free_all_hwrm_resources
Frees all the resources allocated via the HRM in the hardware
bnxt_alloc_hwrm_rings
Allocates all the HWRM rings needed in the current configuration

This should be the last functionality needed to add start/stop
device operations.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: set L2 filters
Ajit Khaparde [Wed, 15 Jun 2016 21:23:27 +0000 (14:23 -0700)]
net/bnxt: set L2 filters

New HWRM call:
bnxt_clear_hwrm_vnic_filters
This patch adds code to set and clear L2 filters from the
corresponding VNIC. These filters will determine the Rx flows

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: free statistics context
Ajit Khaparde [Wed, 15 Jun 2016 21:23:26 +0000 (14:23 -0700)]
net/bnxt: free statistics context

Add function and associated structures and definitions to free
statistics context from the ASIC.

New HWRM call:
bnxt_hwrm_stat_ctx_free
This command is used to free a stat context.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add ring group alloc/free
Ajit Khaparde [Wed, 15 Jun 2016 21:23:25 +0000 (14:23 -0700)]
net/bnxt: add ring group alloc/free

Add HWRM API for ring group alloc/free functions, associated structs and
definitions.
This API allocates and does basic preparation for a ring group in ASIC.
A ring group is identified by an index. It consists of Rx ring id,
completion ring id and a statistics context.

New HWRM calls:
bnxt_hwrm_ring_grp_alloc
Allocates and does basic preparation for a ring group
bnxt_hwrm_ring_grp_free
Frees and does cleanup resources of a ring group

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add ring alloc/free
Ajit Khaparde [Wed, 15 Jun 2016 21:23:24 +0000 (14:23 -0700)]
net/bnxt: add ring alloc/free

Add HWRM API calls to allocate and free TX, RX and Completion rings
in the hardware along with the associated structs and definitions.

This informs the hardware of how the specific rings were set up in the
host and allocates them in the HWRM, setting up the doorbell registers
etc. as needed, returning an ID for the ring.

Basic ring alloc/free calls:
bnxt_hwrm_ring_alloc
This command allocates and does basic preparation for a ring.
bnxt_hwrm_ring_free
This command is used to free a ring and associated resources.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add stats context allocation
Ajit Khaparde [Wed, 15 Jun 2016 21:23:23 +0000 (14:23 -0700)]
net/bnxt: add stats context allocation

Add HWRM API code to allocate a statistics context in the ASIC.
This API will be called by the previously submitted "add statistics
operations patch".

New HWRM call:
bnxt_hwrm_stat_ctx_alloc:
This command allocates and does basic preparation for a stat
context.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: set L2 Rx mask
Ajit Khaparde [Wed, 15 Jun 2016 21:23:22 +0000 (14:23 -0700)]
net/bnxt: set L2 Rx mask

Add API to set/clear L2 Rx mask.

New HWRM calls:
bnxt_hwrm_cfa_l2_clear_rx_mask
bnxt_hwrm_cfa_l2_set_rx_mask

These HWRM APIs allow setting and clearing of Rx masks in L2 context
per VNIC.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: configure RSS
Ajit Khaparde [Wed, 15 Jun 2016 21:23:21 +0000 (14:23 -0700)]
net/bnxt: configure RSS

New HWRM call:
bnxt_hwrm_vnic_rss_cfg:
Used to enable RSS configuration of the VNIC.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: allow configuration of a VNIC
Ajit Khaparde [Wed, 15 Jun 2016 21:23:20 +0000 (14:23 -0700)]
net/bnxt: allow configuration of a VNIC

This patch adds APIs to allow configuration of a VNIC.
The functions alloc and free the Class of Service or COS and
Load Balance context corresponding to the VNIC in the chip.

New HWRM calls:
bnxt_hwrm_vnic_ctx_alloc:
Used to allocate COS/Load Balance context of VNIC
bnxt_hwrm_vnic_ctx_free:
Used to free COS/Load Balance context of VNIC

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add HWRM VNIC configure
Ajit Khaparde [Wed, 15 Jun 2016 21:23:19 +0000 (14:23 -0700)]
net/bnxt: add HWRM VNIC configure

This patch configures the properties and actions of the VNIC
allocated by vnic_alloc function from the previous patch.

bnxt_hwrm_vnic_cfg:
Configure the VNIC structure in hardware.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add HWRM VNIC free
Ajit Khaparde [Wed, 15 Jun 2016 21:23:18 +0000 (14:23 -0700)]
net/bnxt: add HWRM VNIC free

In this patch we add a new HWRM API to free a VNIC.

New HWRM call:
bnxt_hwrm_vnic_free:
Frees a vnic allocated by the bnxt_hwrm_vnic_alloc() function.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add HWRM VNIC alloc
Ajit Khaparde [Wed, 15 Jun 2016 21:23:17 +0000 (14:23 -0700)]
net/bnxt: add HWRM VNIC alloc

This requires a group info array in struct bnxt, so add that, we can save
the max size from the func_qcap response, and alloc/free in init/uninit

New HWRM call:
bnxt_hwrm_vnic_alloc:
Allocates a VNIC resource in the hardware.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add HWRM function reset command
Ajit Khaparde [Wed, 15 Jun 2016 21:23:16 +0000 (14:23 -0700)]
net/bnxt: add HWRM function reset command

Add bnxt_hwrm_func_reset() function and supporting structs and macros.

New HWRM calls:
bnxt_hwrm_func_reset:
This command puts the function into the reset state.
In the reset state, global and port related features of the
chip are not available.

This command resets a hardware function (PCIe function) and
frees any resources used by the function. This command initiated by
the driver prepare the function for re-use. This command may also be
initiated by a driver prior to doing it's own configuration.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: allocate Rx/Tx and completion rings
Ajit Khaparde [Wed, 15 Jun 2016 21:23:15 +0000 (14:23 -0700)]
net/bnxt: allocate Rx/Tx and completion rings

Perform allocation and free()ing of ring and information structures
for the TX, RX, and completion rings. The previous patches had
so far provided top level stubs and generic ring support, while this
patch does the real allocation and freeing of the memory specific to
each different type of generic ring.

For example bnxt_init_tx_ring_struct() or bnxt_init_rx_ring_struct() is
now allocating memory based on the socked_id being provided.

bnxt_tx_queue_setup_op() or bnxt_rx_queue_setup_op() have gone through
some reformatting to perform a graceful cleanup in case memory
allocation fails.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add initial Rx code
Ajit Khaparde [Wed, 15 Jun 2016 21:23:14 +0000 (14:23 -0700)]
net/bnxt: add initial Rx code

This patch adds initial implementation of rx_pkt_burst() function for Rx.
bnxt_recv_pkts() is the top level function for doing Rx.

This patch also adds code to allocate rings in the ASIC.

For each Rx queue allocated in the PMD driver, a corresponding ring
in hardware will be created. Every time a frame is received a Rx ring
is selected based on the hardware configuration like RSS, MAC or VLAN,
COS and such. The hardware uses a completion ring to indicate the
availability of a packet.

This patch also brings in functions like bnxt_init_one_rx_ring()
bnxt_init_rx_ring_struct() which initializes various structures before
a Rx can begin.

bnxt_init_rxbds() initializes the Rx Buffer Descriptors while
bnxt_alloc_rx_data() allocates a buffer in the host to receive the
incoming packet.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add initial Tx code
Ajit Khaparde [Wed, 15 Jun 2016 21:23:13 +0000 (14:23 -0700)]
net/bnxt: add initial Tx code

Initial implementation of tx_pkt_burst for transmit.
bnxt_xmit_pkts() is the top level function that is called during Tx.

bnxt_handle_tx_cp() is used to check and process the Tx completions
generated for the Tx Buffer Descriptors sent by the hardware.

This patch also adds code to allocate rings in the hardware.
For each Tx queue allocated in the PMD driver, a corresponding ring
in hardware will be created. Every time a Tx request is initiated
via the bnxt_xmit_pkts() call, a Buffer Descriptor is created and
is sent to the hardware via the associated Tx ring.

On completing the Tx operation, the hardware will generates the status
in the form of a completion. This completion is processed by the
bnxt_handle_tx_cp() function.

Functions like bnxt_init_tx_ring_struct() and bnxt_init_one_tx_ring()
are used to initialize various members of the structure before
starting Tx operations.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add statistics
Ajit Khaparde [Wed, 15 Jun 2016 21:23:12 +0000 (14:23 -0700)]
net/bnxt: add statistics

Add the bnxt_stats_get_op() and bnxt_stats_reset_op() dev_ops to
get and reset statistics. It also brings in the associated HWRM calls
to handle the requests appropriately.

We also have the bnxt_free_stats() function which will be used in the
follow on patches to free the memory allocated by the driver for
statistics.

New HWRM calls:
bnxt_hwrm_stat_clear:
This command clears statistics of a context

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add Rx queue create/destroy
Ajit Khaparde [Wed, 15 Jun 2016 21:23:11 +0000 (14:23 -0700)]
net/bnxt: add Rx queue create/destroy

In this patch we are adding the bnxt_rx_queue_setup_op() and
bnxt_rx_queue_release_op() functions. These will be tied to the
rx_queue_setup and rx_queue_release dev_ops in a subsequent patch.
In these functions we allocate/free memory for the RX queues.

This still requires support to create a RX ring in the ASIC which
will be completed in a future commit. Each Rx queue created via the
rx_queue_setup dev_op will have an associated Rx ring in the hardware.

The Rx logic in the hardware picks a Rx ring for each Rx frame received
by the hardware depending on the properties like RSS, MAC and VLAN
settings configured in the hardware. These packets in the end arrive
on the Rx queue corresponding to the Rx ring in the hardware.

We are also adding some functions like bnxt_mq_rx_configure()
bnxt_free_rx_mbufs() and bnxt_free_rxq_stats() which will be used in
subsequent patches.

We are also adding hwrm_vnic_rss_cfg_* structures, which will be used
in subsequent patches to enable RSS configuration.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add Tx queue create/destroy
Ajit Khaparde [Wed, 15 Jun 2016 21:23:10 +0000 (14:23 -0700)]
net/bnxt: add Tx queue create/destroy

In this patch we are adding the bnxt_tx_queue_setup_op() and
bnxt_tx_queue_release_op() functions. These will be tied to the
tx_queue_setup and tx_queue_release dev_ops in a subsequent patch.
In these functions we allocate/free memory for the TX queues.

This still requires support to create a TX ring in the ASIC which
will be completed in a future commit. Each Tx queue created via the
tx_queue_setup dev_op will have an associated Tx ring in the hardware.

A Tx request coming on the Tx queue gets sent to the corresponding
Tx ring in the ASIC for subsequent transmission.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add L2 filter alloc/init/free
Ajit Khaparde [Wed, 15 Jun 2016 21:23:09 +0000 (14:23 -0700)]
net/bnxt: add L2 filter alloc/init/free

Add the L2 filter structure and the alloc/init/free functions for
dealing with them.

A filter is used to identify traffic that contains a matching set of
parameters like unicast or broadcast MAC address or a VLAN tag amongst
other things which then allows the ASIC to direct the  incoming traffic
to an appropriate VNIC or Rx ring.

New HWRM calls:
bnxt_hwrm_clear_filter:
Free a L2 filter.

bnxt_hwrm_set_filter
Allocate an An L2 filter or a L2 context.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add completion ring
Ajit Khaparde [Wed, 15 Jun 2016 21:23:08 +0000 (14:23 -0700)]
net/bnxt: add completion ring

Structures, macros, and functions for working with completion rings
in the driver.

Completion Ring is used by the Ethernet controller to provide the
status of transmitted & received packets, report errors, report
status changes to the host software, and inter-function forwarding
requests.  In addition to the generic ring features, a completion ring
can have a statistics context that has statistics periodically DMAed
to host memory, along with a consumer index.

bnxt_handle_async_event() handles completions not related to a specific
transmit or receive ring such as link status changes which arrive on
the default completion ring.

Other physical or virtual functions on the same device may send an HWRM
command forward request.  In this case, we will pass it through
unvalidated. In the future, we will be able to have the PF monitor and
control VF access to the HWRM interface if needed.

New HWRM Calls:
bnxt_hwrm_exec_fwd_resp:
Execute an encapsulated command and forward the response.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: declare generic ring structs
Ajit Khaparde [Wed, 15 Jun 2016 21:23:07 +0000 (14:23 -0700)]
net/bnxt: declare generic ring structs

Declare generic ring structures and a free() function. These are
generic ring management functions which will be used to create Tx,
Rx and Completion rings in the subsequent patches, and tie them to
the HWRM managed ring resources.

This generic ring structure is shared all the ring types and tracks
the the host Buffer Descriptors (BDs) and the HWRM assigned ID.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add VNIC functions and structs
Ajit Khaparde [Wed, 15 Jun 2016 21:23:06 +0000 (14:23 -0700)]
net/bnxt: add VNIC functions and structs

Add functions to allocate, initialize, and free vnics.

A VNIC represents a virtual interface. It is a resource in the RX path
of the chip and is used to setup various target actions such as RSS,
MAC filtering etc. for the physical function in use.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add device configure operation
Ajit Khaparde [Wed, 15 Jun 2016 21:23:05 +0000 (14:23 -0700)]
net/bnxt: add device configure operation

The dev_configure_op function calls bnxt_set_hwrm_link_config() to
setup the PHY.  This calls the new  bnxt_parse_eth_link_*() functions
to translate from the DPDK macro values to those used by HWRM calls,
then calls bnxt_hwrm_port_phy_cfg() to issue the HWRM call.

New HWRM calls:
bnxt_hwrm_port_phy_cfg:
This command configures the PHY device for the port.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: get device infos
Ajit Khaparde [Wed, 15 Jun 2016 21:23:04 +0000 (14:23 -0700)]
net/bnxt: get device infos

Gets device info from the bp structure filled in the init() function.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add driver register/unregister
Ajit Khaparde [Wed, 15 Jun 2016 21:23:03 +0000 (14:23 -0700)]
net/bnxt: add driver register/unregister

Move init() cleanup into uninit() function
Fix .dev_private_size

New HWRM calls:
bnxt_hwrm_func_driver_register:
This command is used by the function driver to register
its information with the HWRM.

bnxt_hwrm_func_driver_unregister:
This command is used by the function driver to unregister
with the HWRM.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add hardware resource manager init code
Ajit Khaparde [Wed, 15 Jun 2016 21:23:02 +0000 (14:23 -0700)]
net/bnxt: add hardware resource manager init code

Start adding support to use the HWRM API.
Hardware Resource Manager or HWRM in short, is a set of API provided
by the firmware running in the ASIC to manage the various resources.

Initial commit just performs necessary HWRM queries for init, then
fails as before.

Now that struct bnxt is non-zero size, we can set dev_private_size
correctly.

The used HWRM calls so far:
bnxt_hwrm_func_qcaps:
This command returns capabilities of a function.

bnxt_hwrm_ver_get:
This function is called by a driver to determine the HWRM
interface version supported by the HWRM firmware, the
version of HWRM firmware implementation, the name of HWRM
firmware, the versions of other embedded firmwares, and
the names of other embedded firmwares, etc.  Gets the
firmware version and interface specifications.  Returns
an error if the firmware on the device is not supported
by the driver and ensures the response space is large
enough for the largest possible response.

bnxt_hwrm_queue_qportcfg:
This function is called by a driver to query queue
configuration of a port.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
8 years agonet/bnxt: add driver for Broadcom NetXtreme-C devices
Ajit Khaparde [Wed, 15 Jun 2016 21:23:01 +0000 (14:23 -0700)]
net/bnxt: add driver for Broadcom NetXtreme-C devices

This patch adds the initial skeleton for bnxt driver along with the
nic guide, and ties the driver into the build system.
At this point, the driver simply fails init.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
[Release Note Addition]
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/igb: support VF mailbox interrupt for link up/down
Wenzhuo Lu [Wed, 1 Jun 2016 01:53:09 +0000 (09:53 +0800)]
net/igb: support VF mailbox interrupt for link up/down

When using kernel PF and DPDK VF, when the PF driver finds the link
state changes, up -> down or down -> up, the driver will send a
message to VF by mailbox. This link state change may be
triggered by PHY disconnection/reconnection, user config change
like *ifconfig down/up* or interface parameter, like MTU change.

This patch enables the support of the mailbox interrupt,
so VF driver can receive the message for link up/down.
After VF receives this message, VF port need to be reset to
recover. This needs to be handled by the application so this patch
allows the app to register a reset callback so it can reset the VF port.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
8 years agonet/ixgbe: support VF mailbox interrupt for link up/down
Wenzhuo Lu [Wed, 1 Jun 2016 01:53:08 +0000 (09:53 +0800)]
net/ixgbe: support VF mailbox interrupt for link up/down

When using kernel PF and DPDK VF, when the PF driver finds the link
state changes, up -> down or down -> up, the driver will send a
message to VF by mailbox. This link state change may be
triggered by PHY disconnection/reconnection, user config change
like *ifconfig down/up* or interface parameter, like MTU change.

This patch enables the support of the mailbox interrupt,
so VF driver can receive the message for link up/down.
After VF receives this message, VF port need to be reset to
recover. This needs to be handled by the application so this patch
allows the app to register a reset callback so it can reset the VF port.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
8 years agonet/i40e/base: document latest base code version
Helin Zhang [Tue, 14 Jun 2016 13:56:37 +0000 (14:56 +0100)]
net/i40e/base: document latest base code version

Update the documentation and comments with brief details on the base
code version included in this release.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/i40e/base: support disabling links on all ports
Helin Zhang [Tue, 14 Jun 2016 13:53:07 +0000 (14:53 +0100)]
net/i40e/base: support disabling links on all ports

Add a flag which can be used to tell the firmware to disable the link on
all ports.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/i40e/base: allow PF to configure RSS for VF
Helin Zhang [Tue, 24 May 2016 06:23:08 +0000 (14:23 +0800)]
net/i40e/base: allow PF to configure RSS for VF

Add opcodes and structures to support RSS configuration
by PF driver on behalf of the VF drivers.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: add input set mask definitions
Helin Zhang [Tue, 24 May 2016 06:23:07 +0000 (14:23 +0800)]
net/i40e/base: add input set mask definitions

Adds input set mask definitions for RSS, flow director
and flex bytes.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: increase supported AQ API version
Helin Zhang [Tue, 24 May 2016 06:23:06 +0000 (14:23 +0800)]
net/i40e/base: increase supported AQ API version

Increase the supported AQ API version to 1.5

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: add more device capabilities for NVM mgmt
Helin Zhang [Tue, 24 May 2016 06:23:05 +0000 (14:23 +0800)]
net/i40e/base: add more device capabilities for NVM mgmt

Adds more device capabilities for NVM management.
- if update is available
- if security check is needed

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: fix debug output of adminq commands
Helin Zhang [Tue, 24 May 2016 06:23:04 +0000 (14:23 +0800)]
net/i40e/base: fix debug output of adminq commands

Fixes hex printout in the debug output

Fixes: f388b435bc33 ("i40e/base: clean adminq debug")

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: fix printing the number of MSIX vectors
Helin Zhang [Tue, 24 May 2016 06:23:03 +0000 (14:23 +0800)]
net/i40e/base: fix printing the number of MSIX vectors

Correct the number of MSIX vector in debug info.

Fixes: 889bc9f0cd3a ("i40e/base: unify the capability function")

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: support new devices
Helin Zhang [Tue, 24 May 2016 06:23:02 +0000 (14:23 +0800)]
net/i40e/base: support new devices

Add new device IDs and PHY types.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: fix error with mirror rule ID 0
Helin Zhang [Tue, 24 May 2016 06:23:01 +0000 (14:23 +0800)]
net/i40e/base: fix error with mirror rule ID 0

Remove a problematic mirror rule ID check. The check
returned an error if the mirror rule ID is 0, which is
a valid value.

Fixes: 0bf2dbbe077c ("i40e/base: support mirroring rules")

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: allow egress traffic mirroring
Helin Zhang [Tue, 24 May 2016 06:23:00 +0000 (14:23 +0800)]
net/i40e/base: allow egress traffic mirroring

Allow egress traffic to be mirrored to VSIs in promiscuous mode, as latest
firmware supports that from API version 1.5.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: fix Geneve VNI for HW use
Helin Zhang [Tue, 24 May 2016 06:22:59 +0000 (14:22 +0800)]
net/i40e/base: fix Geneve VNI for HW use

The hardware doesn't layout the Geneve VNI (Virtual Network
Identifier) quite the same as the VxLAN VNI, so it needs to
adjust it before sending through the Admin Queue commands as the
workaround.

Fixes: 8db9e2a1b232 ("i40e: base driver")

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: limit PF/VF specific code to that driver only
Helin Zhang [Tue, 24 May 2016 06:22:58 +0000 (14:22 +0800)]
net/i40e/base: limit PF/VF specific code to that driver only

This patch trims the source code, with limiting pieces of code for
PF or VF driver only, code style fixes, and annotation
rewording.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: refactor NVM update command processing
Helin Zhang [Tue, 24 May 2016 06:22:57 +0000 (14:22 +0800)]
net/i40e/base: refactor NVM update command processing

This patch refactors the NVM update command processing, with adding
a new element of nvm_wait_opcode in struct i40e_hw to indicate
the opcode it waits on, and putting the wait event check into
a function. In addition, that element needs to be initialized
or updated properly.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: move NVM update status field to HW struct
Helin Zhang [Tue, 24 May 2016 06:22:56 +0000 (14:22 +0800)]
net/i40e/base: move NVM update status field to HW struct

This patch centralizes all NVM update status info into a single
structure, by moving nvm_release_on_done from struct
i40e_adminq_info to struct i40e_hw, for better management.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/i40e/base: remove HMC admin queue functions
Helin Zhang [Tue, 24 May 2016 06:22:55 +0000 (14:22 +0800)]
net/i40e/base: remove HMC admin queue functions

Host Memory Cache(HMC) admin queue APIs were removed from the latest
datasheet, and hence remove its implementation.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agodoc: update mlx5 features and limitations
NĆ©lio Laranjeiro [Wed, 8 Jun 2016 09:43:31 +0000 (11:43 +0200)]
doc: update mlx5 features and limitations

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agonet/mlx5: enhance SR-IOV detection
NĆ©lio Laranjeiro [Wed, 8 Jun 2016 09:43:30 +0000 (11:43 +0200)]
net/mlx5: enhance SR-IOV detection

SR-IOV mode is currently set when dealing with VF devices. PF devices must
be taken into account as well if they have active VFs.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx5: cosmetic changes
Adrien Mazarguil [Wed, 8 Jun 2016 09:43:29 +0000 (11:43 +0200)]
net/mlx5: cosmetic changes

Add consistency to mlx5_rxtx.h.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx5: fix Rx VLAN stripping capability check
Adrien Mazarguil [Wed, 8 Jun 2016 09:43:28 +0000 (11:43 +0200)]
net/mlx5: fix Rx VLAN stripping capability check

A hardware capability check is missing before enabling RX VLAN stripping
during queue setup.

Also, while dev_conf.rxmode.hw_vlan_strip is currently a single bit that
can be stored in priv->hw_vlan_strip directly, it should be interpreted as
a boolean value for safety.

Fixes: f3db9489188a ("mlx5: support Rx VLAN stripping")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx: retrieve mbuf size through proper function
Adrien Mazarguil [Wed, 8 Jun 2016 09:43:27 +0000 (11:43 +0200)]
net/mlx: retrieve mbuf size through proper function

No need to allocate a mbuf for that.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx: ensure MTU update is effective
Adrien Mazarguil [Wed, 8 Jun 2016 09:43:26 +0000 (11:43 +0200)]
net/mlx: ensure MTU update is effective

There is no guarantee that the new MTU is effective after writing its value
to sysfs. Retrieve it to be sure.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx: remove unused memory region property
NĆ©lio Laranjeiro [Wed, 8 Jun 2016 09:43:25 +0000 (11:43 +0200)]
net/mlx: remove unused memory region property

Memory regions are always local with raw Ethernet queues, drop the remote
property as it adds extra processing on the hardware side.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/enic: improve out of resources error handling
John Daley [Sat, 11 Jun 2016 17:27:05 +0000 (10:27 -0700)]
net/enic: improve out of resources error handling

If configuration fails due to lack of resources, be more specific
about which resources are lacking - work queues, read queues or
completion queues. Return -EINVAL instead of -1 if more queeues
are requested than are available.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: fix crash when releasing queues
John Daley [Sat, 11 Jun 2016 17:27:04 +0000 (10:27 -0700)]
net/enic: fix crash when releasing queues

If device configuration failed due to a lack of resources, such as
if more queues are requested than are available, the queue release
functions are called with NULL pointers which were being dereferenced.

Skip releasing queues if they are NULL pointers.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/mbuf: remove unused Rx error flags
Olivier Matz [Mon, 23 May 2016 07:56:11 +0000 (09:56 +0200)]
net/mbuf: remove unused Rx error flags

Following the discussions from:
http://dpdk.org/ml/archives/dev/2015-July/021721.html
http://dpdk.org/ml/archives/dev/2016-April/038143.html

The value of these flags is 0, making them useless. Today, no example
application checks them on Rx, and only few drivers sets them and
silently give wrong packets to the application, which should not happen.

This patch removes the unused flags from rte_mbuf and their use in the
drivers. The i40e and fm10k are kept as they are today and should be
fixed to drop bad packets. The enic driver is managed by its maintainer
in another patch.

Fixes: c22265f6 ("mbuf: add new packet flags for i40e")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agonet/bonding: replace panic with errno code return
Michal Jastrzebski [Fri, 27 May 2016 15:20:53 +0000 (17:20 +0200)]
net/bonding: replace panic with errno code return

This patch modifies bond_mode_alb_enable function.
When mempool allocation fails errno code is returned
instead of rte_panic. This allow to decide on application level
if it should quit or retry for mempool allocation.

Signed-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
8 years agonet/null: set port id in received mbufs
Sean Harte [Fri, 27 May 2016 12:26:35 +0000 (13:26 +0100)]
net/null: set port id in received mbufs

Ensure that the port field is set in mbufs received from the null PMD.

Signed-off-by: Sean Harte <sean.harte@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Tetsuya Mukawa <mukawa@igel.co.jp>
8 years agonet/mlx: regenerate autoconf file automatically
Adrien Mazarguil [Fri, 10 Jun 2016 15:09:32 +0000 (17:09 +0200)]
net/mlx: regenerate autoconf file automatically

Mellanox PMDs must be rebuilt if a Verbs update would cause the autoconf
file to differ.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx: fix compilation with glibc 2.20
Adrien Mazarguil [Mon, 20 Jun 2016 13:31:46 +0000 (15:31 +0200)]
net/mlx: fix compilation with glibc 2.20

Since _BSD_SOURCE was deprecated in favor of _DEFAULT_SOURCE in Glibc 2.19
and entirely removed in 2.20, various BSD ioctl macros are not exposed
anymore when _XOPEN_SOURCE is defined, and linux/if.h now conflicts with
net/if.h.

Add _DEFAULT_SOURCE and keep _BSD_SOURCE for compatibility with older
versions.

Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/pcap: fix crash on close
Reshma Pattan [Fri, 27 May 2016 12:06:20 +0000 (13:06 +0100)]
net/pcap: fix crash on close

Testpmd application will crash in fclose() upon quit after running
the below command.

"sudo gdb --args ./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf0 -n 4
          --vdev 'eth_pcap0,tx_iface=enp1s0f1,rx_pcap=/tmp/test.pcap' --
          --port-topology=chained -i"

The reason is, pcap vdev creation with tx stream type as "iface"
as in above command doesn't need member "dumpers" of
"struct tx_pcaps", hence will not have memory allocated for it.
It contains a garbage values, as local object of struct tx_pcaps
is not initialized to 0 inside rte_pmd_pcap_dev_init().
So calling pcap_dump_close() on dumper as part of eth_dev_stop()
is causing segfault in fclose().

Fix is to initialize local object of struct tx_pcaps to 0.
Also initialize local object of struct rx_pcaps to 0.
So during eth_dev_stop(), pcap_dump_close() will not be called if dumper
is NULL.

Fixes: 4c173302c307 ("pcap: add new driver")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agonet/enic: fix Tx IP and UDP/TCP checksum offload
John Daley [Fri, 3 Jun 2016 00:22:57 +0000 (17:22 -0700)]
net/enic: fix Tx IP and UDP/TCP checksum offload

Private/conflicting ol_flags where used to enable UDP/TCP Tx
offloads. Use the common flags in PKT_TX_L4_MASK to support them.
When updating flags, also do some minor code rearranging for
slightly better performane.

Fixes: fefed3d1e62c ("enic: new driver")
Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: expand local Tx mbuf flags variable to 64-bits
John Daley [Fri, 3 Jun 2016 00:22:56 +0000 (17:22 -0700)]
net/enic: expand local Tx mbuf flags variable to 64-bits

The offload flags variable (ol_flags) in rte_mbuf structure is 64-bits,
so local copy of it must be 64-bits too. Moreover bit comparison between
16-bits variable and 64-bits value make no sense. This breaks Tx vlan
IP and L4 offloads.

Coverity issue: 13218
Fixes: fefed3d1e62c ("enic: new driver")

Suggested-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Signed-off-by: John Daley <johndale@cisco.com>
Acked-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
8 years agonet/enic: add an assert macro
John Daley [Fri, 3 Jun 2016 00:22:55 +0000 (17:22 -0700)]
net/enic: add an assert macro

Add an ASSERT macro for the enic driver which is enabled when the log
level is >= RTE_LOG_DEBUG. Assert that number of mbufs to return to
the pool in the Tx function is never greater than the max allowed.

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: remove unused code
John Daley [Fri, 3 Jun 2016 00:22:54 +0000 (17:22 -0700)]
net/enic: remove unused code

Remove some files, functions and variables left unused after
Tx performance improvements.

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: optimize the Tx function
John Daley [Fri, 3 Jun 2016 00:22:53 +0000 (17:22 -0700)]
net/enic: optimize the Tx function

Reduce host CPU overhead of Tx packet processing:
* Use local variables inside per-packet loop instead of fields in structs.
* Factor book keeping and conditionals out of the per-packet loop where
  possible.
* Post buffers to the nic at a maximum of every 64 packets

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: refactor Tx mbuf recycling
John Daley [Fri, 3 Jun 2016 00:22:52 +0000 (17:22 -0700)]
net/enic: refactor Tx mbuf recycling

Mbufs were returned to the pool one at a time. Use rte_mempool_put_bulk
instead. There were multiple function calls for each buffer returned.
Refactor this code into just 2 functions.

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: use Tx completion index instead of messages
John Daley [Fri, 3 Jun 2016 00:22:51 +0000 (17:22 -0700)]
net/enic: use Tx completion index instead of messages

The NIC can either DMA a separate completion message for each completed
send or periodically just DMA the index of the last completed send.
Switch to the latter method which improves cache locality and performance.

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: streamline mbuf handling in Tx path
John Daley [Fri, 3 Jun 2016 00:22:50 +0000 (17:22 -0700)]
net/enic: streamline mbuf handling in Tx path

The list of mbufs held by the driver on Tx was allocated in chunks
(a hold-over from the enic kernel mode driver). The structure used
next pointers across chunks which led to cache misses.

Allocate the array used to hold mbufs in flight on Tx with
rte_zmalloc_socket(). Remove unnecessary fields from the structure
and use head and tail pointers instead of next pointers.

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: remove unused functions in Tx path
John Daley [Fri, 3 Jun 2016 00:22:49 +0000 (17:22 -0700)]
net/enic: remove unused functions in Tx path

Functions existed which were never called. Removed them. Also
rename the 'pmd' from the name of the Tx function to improve clarity.

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: put Tx and Rx functions into same file
John Daley [Fri, 3 Jun 2016 00:22:48 +0000 (17:22 -0700)]
net/enic: put Tx and Rx functions into same file

The Tx functions were in enic_ethdev.c and enic_main.c - files in which
they did not logically belong.  To make things consistent with most
other drivers, we therefore extract them and place them with the equivalent
Rx functions into a file called enic_rxtx.c.

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: count truncated packets
John Daley [Fri, 3 Jun 2016 00:22:47 +0000 (17:22 -0700)]
net/enic: count truncated packets

Truncated packets occur on enic if an mbuf is not big enough to
receive it or there aren't enough mbufs if rx scatter is in use.
They show up as error packets but unlike other error packets (like
packets bad FCS) there are no nic drop counts incremented for them.
Truncated packets are calculated by subtracting hardware errors from
software errors. Note: this causes transient inaccuracies in the
ipackets count. Also, the length of truncated packets are counted
in ibytes even though truncated packets are dropped which can make
ibytes be slightly higher than it should be.

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: fix bad packet handling on Rx
John Daley [Fri, 3 Jun 2016 00:22:46 +0000 (17:22 -0700)]
net/enic: fix bad packet handling on Rx

Following the discussions from:
http://dpdk.org/ml/archives/dev/2015-July/021721.html
http://dpdk.org/ml/archives/dev/2016-April/038143.html

Remove the unused flag from enic driver. Also, the enic driver is
now modified to drop bad packets instead of using a non-existent
flag to try and identify them as bad.

Fixes: 947d860c821f ("enic: improve Rx performance")
Fixes: 5776c30293bb ("enic: fix error packets handling")
Fixes: 50765c820e98 ("enic: remove packet error conditional")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: fix Rx drop counters
John Daley [Fri, 3 Jun 2016 00:22:45 +0000 (17:22 -0700)]
net/enic: fix Rx drop counters

rx_no_bufs is a hardware counter of packets dropped on the
interface due to no host buffers and should be used to update
r_stats->imissed counter instead of rx_nombuf.

Include rx_drop in ierrors. rx_drop is incremented if packets
arrive when the receive queue is disabled.

Add a structure and functions for initializing and clearing
software counters. Add count of Rx mbuf allocation failures
(rx_nombuf) as the first counter.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/e1000: fix build with clang
Hiroyuki Mikita [Thu, 26 May 2016 11:36:39 +0000 (20:36 +0900)]
net/e1000: fix build with clang

GCC_VERSION is empty in case of clang:
/bin/sh: line 0: test: -ge: unary operator expected

It is the same issue as http://dpdk.org/dev/patchwork/patch/5994/

Fixes: 366113dbfb69 ("e1000: suppress misleading indentation warning")

Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/af_packet: add byte counters
Rich Lane [Wed, 25 May 2016 21:03:20 +0000 (14:03 -0700)]
net/af_packet: add byte counters

Signed-off-by: Rich Lane <rich.lane@bigswitch.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: John W. Linville <linville@tuxdriver.com>
8 years agonet/i40e: fix unintended sign extension
Slawomir Mrozowicz [Fri, 20 May 2016 13:03:36 +0000 (15:03 +0200)]
net/i40e: fix unintended sign extension

Suspicious implicit sign extension: pf->fdir.match_counter_index
with type unsigned short (16 bits, unsigned) is promoted in
"pf->fdir.match_counter_index << 20" to type int (32 bits, signed),
then sign-extended to type unsigned long (64 bits, unsigned).
If "pf->fdir.match_counter_index << 20" is greater than 0x7FFFFFFF,
the upper bits of the result will all be 1.

To fix the issue explicitly cast pf->fdir.match_counter_index to uint32_t.

Coverity issue: 13315
Fixes: 05999aab4ca6 ("i40e: add or delete flow director")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/i40e: support MTU configuration
Beilei Xing [Fri, 20 May 2016 15:17:04 +0000 (23:17 +0800)]
net/i40e: support MTU configuration

This patch enables configuring MTU for i40e.
Since changing MTU needs to reconfigure queue, the port must be
stopped before configuring MTU.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
8 years agonet/i40e: fix disabling flex payload selection rule
Jingjing Wu [Thu, 12 May 2016 08:11:40 +0000 (16:11 +0800)]
net/i40e: fix disabling flex payload selection rule

When setting up the flexible paylaod selection rules, the value
NONUSE_FLX_PIT_DEST_OFF (== 63) is meant to disable the rule.
However, since the MK_FLX_PIT macro always added on an additional
offset of I40E_FLX_OFFSET_IN_FIELD_VECTOR (== 50) to the value passed
the functionality to disable the rule was broken.
This patch fixes this by checking for the disable value and not adding
the offset in that case.

Fixes: d8b90c4eabe9 ("i40e: take flow director flexible payload configuration")

Reported-by: Michael Habibi <mikehabibi@gmail.com>
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Zhe Tao <zhe.tao@intel.com>
8 years agonet/i40e: fix link management
Jingjing Wu [Thu, 12 May 2016 07:21:04 +0000 (15:21 +0800)]
net/i40e: fix link management

Previously, there was a known issue "On IntelĀ® 40G Ethernet
Controller stopping the port does not really down the port link."

There were two reasons why the port was always kept up.
1. Old firmware versions had issues when "Set PHY config command"
   was used on 40G NICs.
2. The kernel i40e driver didn't call "Set PHY config command" when
   ifconfig up/down was used, it assumes the link is always up. But
   in DPDK, ports are forced down when an applications quits. So if
   the port is then switched to being controlled by kernel the driver,
   the port can not be brought up through "ifconfig <ethx> up".

This patch fixes this issue by adding in "Set PHY config command"
into our driver. This is now possible because with newer firmware
there is no longer a problem using this command.

With this fix, after DPDK quit, if the port is switched to being used
by the kernel driver, "ethtool -s <ethx> autoneg on" can be used to
turn on the auto negotiation, and then port can be brought up through
"ifconfig <ethx> up".
NOTE: requires kernel i40e driver version >= 1.4.X

Fixes: 2f1e22817420 ("i40e: skip link control as firmware workaround")
Fixes: 16c979f9adf2 ("i40e: disable setting of PHY configuration")

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
8 years agonet/bnx2x: update driver version to 1.0.1.1
Rasesh Mody [Thu, 12 May 2016 00:06:25 +0000 (17:06 -0700)]
net/bnx2x: update driver version to 1.0.1.1

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Harish Patil <harish.patil@qlogic.com>
8 years agonet/bnx2x: use single doorbell for Tx
Rasesh Mody [Thu, 12 May 2016 00:06:24 +0000 (17:06 -0700)]
net/bnx2x: use single doorbell for Tx

Change the Tx routine to ring the doorbell once per burst
and not on every Tx packet. This driver-level optimization
is necessary to achieve line rates for larger frame
sizes (1k or more).

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Harish Patil <harish.patil@qlogic.com>
8 years agonet/bnx2x: restructure Tx routine
Rasesh Mody [Thu, 12 May 2016 00:06:23 +0000 (17:06 -0700)]
net/bnx2x: restructure Tx routine

- Process Tx completions based on configured Tx free threshold and
  determine how much TX BDs are required before invoking bnx2x_tx_encap()
- Change bnx2x_tx_encap() to void function as it can now never fail

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Harish Patil <harish.patil@qlogic.com>
8 years agonet/bnx2x: fix dropped packet count in stats
Rasesh Mody [Thu, 12 May 2016 00:06:21 +0000 (17:06 -0700)]
net/bnx2x: fix dropped packet count in stats

Fix stats_get() routine to display drop counters under imissed counter.

Fixes: 540a211084a7 ("bnx2x: driver core")

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Harish Patil <harish.patil@qlogic.com>
8 years agonet/qede: allow firmware to query LAN stats
Harish Patil [Sat, 7 May 2016 04:21:31 +0000 (21:21 -0700)]
net/qede: allow firmware to query LAN stats

Under certain scenarios, management firmware (MFW) periodically polls
the driver for LAN statistics. This patch implements the osal hook to
fill in the stats.

Fixes: ec94dbc57362 ("qede: add base driver")

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
8 years agonet/qede: rename debug option
Rasesh Mody [Sat, 7 May 2016 04:21:30 +0000 (21:21 -0700)]
net/qede: rename debug option

Rename RTE_LIBRTE_QEDE_DEBUG_DRV to RTE_LIBRTE_QEDE_DEBUG_DRIVER
for consistency with other drivers.

Fixes: 3eae93a9bfd5 ("qede: enable PMD build")
Fixes: 2ea6f76aff40 ("qede: add core driver")

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
8 years agonet/cxgbe: support register dump
Rahul Lakkireddy [Fri, 6 May 2016 07:43:19 +0000 (13:13 +0530)]
net/cxgbe: support register dump

Add operations to get register dump.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
8 years agonet/cxgbe: support EEPROM access
Rahul Lakkireddy [Fri, 6 May 2016 07:43:18 +0000 (13:13 +0530)]
net/cxgbe: support EEPROM access

Add operations to get/set EEPROM data.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
8 years agonet/cxgbe: set default PCIe completion timeout
Rahul Lakkireddy [Fri, 6 May 2016 07:43:17 +0000 (13:13 +0530)]
net/cxgbe: set default PCIe completion timeout

Program the PCIe completion timeout to 4 sec to give enough time
to allow completions to be received successfully in some older systems.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
8 years agonet/cxgbe: access to PCI config space
Rahul Lakkireddy [Fri, 6 May 2016 07:43:16 +0000 (13:13 +0530)]
net/cxgbe: access to PCI config space

Add helper functions to read/write PCI config space.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
8 years agopci: fix config space access on FreeBSD
Rahul Lakkireddy [Fri, 6 May 2016 07:43:15 +0000 (13:13 +0530)]
pci: fix config space access on FreeBSD

PCIOCREAD and PCIOCWRITE ioctls to read/write PCI config space fail
with EPERM due to missing write permission.  Fix by opening /dev/pci/
with O_RDWR instead.

Fixes: 632b2d1deeed ("eal: provide functions to access PCI config")

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
8 years agonet/ixgbe: rename x86 vector driver file
Jianbo Liu [Wed, 11 May 2016 03:45:09 +0000 (09:15 +0530)]
net/ixgbe: rename x86 vector driver file

To be consistent with the naming for ARM NEON implementation,
ixgbe_rxtx_vec.c is renamed to ixgbe_rxtx_vec_sse.c.

Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/i40evf: fix return value if admin queue command fails
Jingjing Wu [Tue, 10 May 2016 02:51:59 +0000 (10:51 +0800)]
net/i40evf: fix return value if admin queue command fails

Previously, if an adminq message is sent successfully, but no response is
received, function "i40evf_execute_vf_cmd" will return without error.
The root cause is value "err" is overwritten. This patch fixes this by
ensuring the value of err is set appropriately for each cmd.

Fixes: ae19955e7c86 ("i40evf: support reporting PF reset")

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>