X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fnfp%2Fnfp_net_pmd.h;h=b1303b13f57fda69243f6cef9191fd4cbbccd7b9;hb=2fced8a1c1f3b88d7f4d7cc59423110ef8ae6063;hp=bc288bed695d1ca9a140e82d3ce3c99ebec46be8;hpb=35b2d13fd6fdcbd191f2a30d74648faeb1186c65;p=dpdk.git diff --git a/drivers/net/nfp/nfp_net_pmd.h b/drivers/net/nfp/nfp_net_pmd.h index bc288bed69..b1303b13f5 100644 --- a/drivers/net/nfp/nfp_net_pmd.h +++ b/drivers/net/nfp/nfp_net_pmd.h @@ -1,32 +1,6 @@ -/* +/* SPDX-License-Identifier: BSD-3-Clause * Copyright (c) 2014-2018 Netronome Systems, Inc. * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. */ /* @@ -59,6 +33,12 @@ struct nfp_net_adapter; #define NFP_NET_MAX_RX_DESC (32 * 1024) #define NFP_NET_MIN_RX_DESC 64 +/* Descriptor alignment */ +#define NFP_ALIGN_RING_DESC 128 + +#define NFP_TX_MAX_SEG UINT8_MAX +#define NFP_TX_MAX_MTU_SEG 8 + /* Bar allocation */ #define NFP_NET_CRTL_BAR 0 #define NFP_NET_TX_BAR 2 @@ -122,6 +102,9 @@ struct nfp_net_adapter; #define NFD_CFG_MINOR_VERSION(x) (((x) & 0xff) << 0) #define NFD_CFG_MINOR_VERSION_of(x) (((x) >> 0) & 0xff) +/* Number of supported physical ports */ +#define NFP_MAX_PHYPORTS 12 + #include #include @@ -208,7 +191,7 @@ struct nfp_net_tx_desc { __le16 vlan; /* VLAN tag to add if indicated */ }; __le16 data_len; /* Length of frame + meta data */ - } __attribute__((__packed__)); + } __rte_packed; __le32 vals[4]; }; }; @@ -269,7 +252,7 @@ struct nfp_net_txq { int qidx; int tx_qcidx; __le64 dma; -} __attribute__ ((__aligned__(64))); +} __rte_aligned(64); /* RX and freelist descriptor format */ #define PCIE_DESC_RX_DD (1 << 7) @@ -304,7 +287,7 @@ struct nfp_net_rx_desc { uint8_t dd; __le32 dma_addr_lo; - } __attribute__((__packed__)) fld; + } __rte_packed fld; /* RX descriptor */ struct { @@ -314,7 +297,7 @@ struct nfp_net_rx_desc { __le16 flags; __le16 vlan; - } __attribute__((__packed__)) rxd; + } __rte_packed rxd; __le32 vals[2]; }; @@ -400,9 +383,62 @@ struct nfp_net_rxq { int qidx; int fl_qcidx; int rx_qcidx; -} __attribute__ ((__aligned__(64))); +} __rte_aligned(64); + +struct nfp_pf_dev { + /* Backpointer to associated pci device */ + struct rte_pci_device *pci_dev; + + /* First physical port's eth device */ + struct rte_eth_dev *eth_dev; + + /* Array of physical ports belonging to this PF */ + struct nfp_net_hw *ports[NFP_MAX_PHYPORTS]; + + /* Current values for control */ + uint32_t ctrl; + + uint8_t *ctrl_bar; + uint8_t *tx_bar; + uint8_t *rx_bar; + + uint8_t *qcp_cfg; + rte_spinlock_t reconfig_lock; + + uint16_t flbufsz; + uint16_t device_id; + uint16_t vendor_id; + uint16_t subsystem_device_id; + uint16_t subsystem_vendor_id; +#if defined(DSTQ_SELECTION) +#if DSTQ_SELECTION + uint16_t device_function; +#endif +#endif + + struct nfp_cpp *cpp; + struct nfp_cpp_area *ctrl_area; + struct nfp_cpp_area *hwqueues_area; + struct nfp_cpp_area *msix_area; + + uint8_t *hw_queues; + uint8_t total_phyports; + bool multiport; + + union eth_table_entry *eth_table; + + struct nfp_hwinfo *hwinfo; + struct nfp_rtsym_table *sym_tbl; + uint32_t nfp_cpp_service_id; +}; struct nfp_net_hw { + /* Backpointer to the PF this port belongs to */ + struct nfp_pf_dev *pf_dev; + + /* Backpointer to the eth_dev of this port*/ + struct rte_eth_dev *eth_dev; + /* Info from the firmware */ uint32_t ver; uint32_t cap; @@ -447,15 +483,14 @@ struct nfp_net_hw { struct nfp_cpp_area *msix_area; uint8_t *hw_queues; - uint8_t is_pf; - uint8_t pf_port_idx; - uint8_t pf_multiport_enabled; - uint8_t total_ports; + /* Sequential physical port number */ + uint8_t idx; + /* Internal port number as seen from NFP */ + uint8_t nfp_idx; + bool is_phyport; union eth_table_entry *eth_table; - struct nfp_hwinfo *hwinfo; - struct nfp_rtsym_table *sym_tbl; uint32_t nfp_cpp_service_id; }; @@ -466,6 +501,9 @@ struct nfp_net_adapter { #define NFP_NET_DEV_PRIVATE_TO_HW(adapter)\ (&((struct nfp_net_adapter *)adapter)->hw) +#define NFP_NET_DEV_PRIVATE_TO_PF(dev_priv)\ + (((struct nfp_net_hw *)dev_priv)->pf_dev) + #endif /* _NFP_NET_PMD_H_ */ /* * Local variables: