X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fnfp%2Fnfp_net_pmd.h;h=1295c5959eb0ceb6df027031b12a4a9d1e47777c;hb=02109eaeacceeb8b2ea6fadea33bf334a805fa8e;hp=c6bddaa3a9b54b5b34eee73f4f6f311544c4cc26;hpb=f08d93d4d8659f2d2dc53c9c107758bc724be3c3;p=dpdk.git diff --git a/drivers/net/nfp/nfp_net_pmd.h b/drivers/net/nfp/nfp_net_pmd.h index c6bddaa3a9..1295c5959e 100644 --- a/drivers/net/nfp/nfp_net_pmd.h +++ b/drivers/net/nfp/nfp_net_pmd.h @@ -1,32 +1,6 @@ -/* - * Copyright (c) 2014, 2015 Netronome Systems, Inc. +/* 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. */ /* @@ -34,7 +8,7 @@ * * @file dpdk/pmd/nfp_net_pmd.h * - * Netronome NFP_NET PDM driver + * Netronome NFP_NET PMD driver */ #ifndef _NFP_NET_PMD_H_ @@ -42,6 +16,7 @@ #define NFP_NET_PMD_VERSION "0.1" #define PCI_VENDOR_ID_NETRONOME 0x19ee +#define PCI_DEVICE_ID_NFP4000_PF_NIC 0x4000 #define PCI_DEVICE_ID_NFP6000_PF_NIC 0x6000 #define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003 @@ -58,10 +33,17 @@ 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 #define NFP_NET_RX_BAR 2 +#define NFP_QCP_QUEUE_AREA_SZ 0x80000 /* Macros for accessing the Queue Controller Peripheral 'CSRs' */ #define NFP_QCP_QUEUE_OFF(_x) ((_x) * 0x800) @@ -183,20 +165,30 @@ static inline void nn_writeq(uint64_t val, volatile void *addr) struct nfp_net_tx_desc { union { struct { - uint8_t dma_addr_hi; /* High bits of host buf address */ + uint8_t dma_addr_hi; /* High bits of host buf address */ __le16 dma_len; /* Length to DMA for this desc */ - uint8_t offset_eop; /* Offset in buf where pkt starts + + uint8_t offset_eop; /* Offset in buf where pkt starts + * highest bit is eop flag. */ __le32 dma_addr_lo; /* Low 32bit of host buf addr */ - __le16 lso; /* MSS to be used for LSO */ - uint8_t l4_offset; /* LSO, where the L4 data starts */ - uint8_t flags; /* TX Flags, see @PCIE_DESC_TX_* */ - - __le16 vlan; /* VLAN tag to add if indicated */ + __le16 mss; /* MSS to be used for LSO */ + uint8_t lso_hdrlen; /* LSO, where the data starts */ + uint8_t flags; /* TX Flags, see @PCIE_DESC_TX_* */ + + union { + struct { + /* + * L3 and L4 header offsets required + * for TSOv2 + */ + uint8_t l3_offset; + uint8_t l4_offset; + }; + __le16 vlan; /* VLAN tag to add if indicated */ + }; __le16 data_len; /* Length of frame + meta data */ - } __attribute__((__packed__)); + } __rte_packed; __le32 vals[4]; }; }; @@ -228,7 +220,7 @@ struct nfp_net_txq { uint32_t tx_free_thresh; /* - * For each descriptor keep a reference to the mbuff and + * For each descriptor keep a reference to the mbuf and * DMA address used until completion is signalled. */ struct { @@ -246,20 +238,18 @@ struct nfp_net_txq { /* * At this point 48 bytes have been used for all the fields in the * TX critical path. We have room for 8 bytes and still all placed - * in a cache line. We are not using the threshold values below nor - * the txq_flags but if we need to, we can add the most used in the - * remaining bytes. + * in a cache line. We are not using the threshold values below but + * if we need to, we can add the most used in the remaining bytes. */ uint32_t tx_rs_thresh; /* not used by now. Future? */ uint32_t tx_pthresh; /* not used by now. Future? */ uint32_t tx_hthresh; /* not used by now. Future? */ uint32_t tx_wthresh; /* not used by now. Future? */ - uint32_t txq_flags; /* not used by now. Future? */ - uint8_t port_id; + uint16_t port_id; 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) @@ -283,6 +273,8 @@ struct nfp_net_txq { #define PCIE_DESC_RX_UDP_CSUM_OK (1 << 1) #define PCIE_DESC_RX_VLAN (1 << 0) +#define PCIE_DESC_RX_L4_CSUM_OK (PCIE_DESC_RX_TCP_CSUM_OK | \ + PCIE_DESC_RX_UDP_CSUM_OK) struct nfp_net_rx_desc { union { /* Freelist descriptor */ @@ -292,7 +284,7 @@ struct nfp_net_rx_desc { uint8_t dd; __le32 dma_addr_lo; - } __attribute__((__packed__)) fld; + } __rte_packed fld; /* RX descriptor */ struct { @@ -302,7 +294,7 @@ struct nfp_net_rx_desc { __le16 flags; __le16 vlan; - } __attribute__((__packed__)) rxd; + } __rte_packed rxd; __le32 vals[2]; }; @@ -388,7 +380,7 @@ struct nfp_net_rxq { int qidx; int fl_qcidx; int rx_qcidx; -} __attribute__ ((__aligned__(64))); +} __rte_aligned(64); struct nfp_net_hw { /* Info from the firmware */ @@ -424,18 +416,27 @@ struct nfp_net_hw { #endif #endif - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; /* Records starting point for counters */ struct rte_eth_stats eth_stats_base; -#ifdef NFP_NET_LIBNFP struct nfp_cpp *cpp; struct nfp_cpp_area *ctrl_area; - struct nfp_cpp_area *tx_area; - struct nfp_cpp_area *rx_area; + struct nfp_cpp_area *hwqueues_area; struct nfp_cpp_area *msix_area; -#endif + + uint8_t *hw_queues; + uint8_t is_pf; + uint8_t pf_port_idx; + uint8_t pf_multiport_enabled; + uint8_t total_ports; + + 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_adapter {