Commit Graph

51 Commits

Author SHA1 Message Date
Ajit Khaparde
eba852e23e net/bnxt: refactor for 1.5.1 HWRM API
Update the PMD to use the 1.5.1 HWRM API.
Most of the changes in this patch and the following patches are
white spaces and rearrangement of the lines - hopefully a onetime change
owing to the usage of a different auto generated file.

Other than that, the following fields have been renamed:
1) rx_err_pkts and tx_err_pkts are now rx_discard_pkts and tx_discard_pkts
in struct ctx_hw_stats64
2) the perm_mac_addr field in the response of bnxt_hwrm_func_qcaps has
changed to mac_addr.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2016-09-30 12:27:18 +02:00
Ajit Khaparde
6ca3a5e722 net/bnxt: support hotplug
This patch adds support for port hotplug framework.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2016-09-30 12:27:18 +02:00
Ajit Khaparde
f86febfb46 net/bnxt: support VF
Add support to the bnxt PMD to load on a PCI VF.
1) VF cannot change parameters like - speed, autoneg and pause
2) If the VF MAC address shows up as all 0's it has to be provisioned
by the PF in the hypervisor.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
2016-09-30 12:27:18 +02:00
Ajit Khaparde
9dcf8c7d6e net/bnxt: add new device IDs
More PCI Device IDs for Cumulus, Cumulus+ and Whitney, Whitney+ SKUs.

The NPAR model supported by firmware has been altered. It now allocates a
unique Device ID for each NPAR partition for each device.  In addition,
ASIC's that are capable of supporting dual media have a unique DID
depending whether they are configured in copper or fiber mode.
This patch adds the necessary DIDs.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
2016-09-30 12:27:18 +02:00
Ajit Khaparde
5cd0e2889c net/bnxt: support NIC Partitioning
Adding code to enable support for NIC Partitioning or NPAR 1.0
As a part of NPAR, we don't allow port settings like speed or flow
control to be changed.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
2016-09-30 12:27:18 +02:00
Ajit Khaparde
1fe1aaf207 net/bnxt: support Broadcom StrataGX
This patch adds support for the Broadcom StrataGX® BCM5871X
series of Communications Processors.

These ARM based processors target a broad range of networking
applications including virtual CPE (vCPE) and NFV appliances,
10G service routers and gateways, control plane processing for
Ethernet switches, and network attached storage (NAS).

Other than adding the PCI Id for supporting the device,
the patch also adds a memory barrier before the Tx doorbell
and Completing ring doorbell is written to. Since ARM has a
weakly ordered memory model this enforces a strict ordering
of the descriptor writes before the doorbell writes happen.

Signed-off-by: John Carney <john.carney@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2016-09-30 12:27:18 +02:00
Jan Viktorin
2f3193cf0f pci: inherit common driver in PCI driver
Remove the 'name' member from rte_pci_driver and move to generic
rte_driver.

Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
as well as assigning a name to eth_driver.pci_drv.name member.
In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has
been populated into the rte_driver.name member - assignments through
eth_driver has been removed.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Rebase and expand changes to newly added files]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
2016-10-03 16:33:55 +02:00
David Marchand
c830cb2954 drivers: use PCI registration macro
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.

Exceptions:
- virtio and mlx* use RTE_INIT directly as they have custom initialization
  steps.
- VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.

Update documentation for replacing an example referring to
PMD_REGISTER_DRIVER.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-10-03 16:33:23 +02:00
Pablo de Lara
2f45703c17 drivers: make driver names consistent
As discussed in the past release, driver names are modified
to be more consistent, and the future driver should follow
this new convention.

Driver names consist of:
"driver category"_"driver folder name"_"optional extra name".

For example:
- Crypto null driver       -> "crypto_null"
- Network IXGBE VF driver  -> "net_ixgbe_vf"

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-09-16 11:55:59 +02:00
David Marchand
882aa9c6e2 net/bnxt: move PCI device ids to the driver
Moved defines since the driver had no such information.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.

Signed-off-by: David Marchand <david.marchand@6wind.com>
2016-07-11 17:47:20 +02:00
Ajit Khaparde
0bd7e8d5dc net/bnxt: fix broadcast/multicast Rx
Currently we are wrongly setting HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST
flag in bnxt_hwrm_cfa_l2_set_rx_mask() which is preventing promiscuous
and multicast promiscuous settings from working correctly.
This patch fixes it.

Fixes: 244bc98b0d ("net/bnxt: set L2 Rx mask")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2016-07-08 22:50:41 +02:00
Pablo de Lara
bae696ebd4 drivers: remove static driver names
Since now the PMD_REGISTER_DRIVER macro sets the driver names,
there is no need to have the rte_driver structure setting it
statically, as it will get overridden.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2016-07-10 14:51:09 +02:00
Neil Horman
cb6696d220 drivers: update registration macro usage
Modify the PMD_REGISTER_DRIVER macro, adding a name argument to it.  The
addition of a name argument creates a token that can be used for subsequent
macros in the creation of unique symbol names to export additional bits of
information for use by the pmdinfogen tool.  For example:

PMD_REGISTER_DRIVER(ena_driver, ena);

registers the ena_driver struct as it always did, and creates a symbol
const char this_pmd_name0[] __attribute__((used)) = "ena";

which pmdinfogen can search for and extract.  The subsequent macro

DRIVER_REGISTER_PCI_TABLE(ena, ena_pci_id_map);

creates a symbol const char ena_pci_tbl_export[] __attribute__((used)) =
"ena_pci_id_map";

Which allows pmdinfogen to find the pci table of this driver

Using this pattern, we can export arbitrary bits of information.

pmdinfo uses this information to extract hardware support from an object
file and create a json string to make hardware support info discoverable
later.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
2016-07-06 23:21:40 +02:00
Ajit Khaparde
8aaf473bbe net/bnxt: add flow control operations
Add flow_ctrl_get and flow_ctrl_set dev_ops.
Uses the bnxt_set_hwrm_link_config() HWRM API added in earlier patch.

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>
2016-06-20 17:21:53 +02:00
Ajit Khaparde
fcc0aa1edc net/bnxt: add RSS hash configuration
Add rss_hash_update and rss_hash_conf_get dev_ops
Uses the bnxt_hwrm_vnic_rss_cfg() HWRM API added in the previous patch.

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>
2016-06-20 17:21:53 +02:00
Ajit Khaparde
d819382543 net/bnxt: add RSS redirection table operations
Add code to Update/query reta dev_ops
Uses the bnxt_hwrm_vnic_rss_cfg() HWRM 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>
2016-06-20 17:21:53 +02:00
Ajit Khaparde
5c206086fe 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>
2016-06-20 17:21:53 +02:00
Ajit Khaparde
778b759ba1 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>
2016-06-20 17:21:53 +02:00
Ajit Khaparde
8930749513 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>
2016-06-20 17:21:53 +02:00
Ajit Khaparde
1b48824135 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>
2016-06-20 17:21:53 +02:00
Ajit Khaparde
aeafecd1c1 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>
2016-06-20 17:21:53 +02:00
Ajit Khaparde
c09f57b49c 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>
2016-06-20 17:21:53 +02:00
Ajit Khaparde
27722883de 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
4ace85a7da 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
20ef524432 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
200b64ba0b 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
37d6161a68 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
6371b91fb6 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
ec77c62983 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
244bc98b0d 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
bcd4bcc442 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
de43e76640 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
db678d5c2b 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
b7390d4388 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
2691827e82 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
2523b1584c 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
2bb1d5db43 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>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
2eb53b134a 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
6eb3cc2294 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
57d5e5bc86 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
6133f20797 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
51c87ebafc 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
f92735db1e 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
f2a768d4d1 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
8e7405f7e4 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
9738793f28 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
1d0704f4d7 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
0a6d2a7200 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
beb3087f50 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>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
804e746c7b 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>
2016-06-20 17:21:51 +02:00