[go: nahoru, domu]

17daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/*******************************************************************************
27daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg *
37daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * Intel Ethernet Controller XL710 Family Linux Driver
4dc641b7319f19a17639ed7d36aaddbf090206644Greg Rose * Copyright(c) 2013 - 2014 Intel Corporation.
57daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg *
67daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * This program is free software; you can redistribute it and/or modify it
77daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * under the terms and conditions of the GNU General Public License,
87daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * version 2, as published by the Free Software Foundation.
97daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg *
107daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * This program is distributed in the hope it will be useful, but WITHOUT
117daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
127daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
137daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * more details.
147daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg *
15dc641b7319f19a17639ed7d36aaddbf090206644Greg Rose * You should have received a copy of the GNU General Public License along
16dc641b7319f19a17639ed7d36aaddbf090206644Greg Rose * with this program.  If not, see <http://www.gnu.org/licenses/>.
177daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg *
187daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * The full GNU General Public License is included in this distribution in
197daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * the file called "COPYING".
207daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg *
217daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * Contact Information:
227daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
237daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
247daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg *
257daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg ******************************************************************************/
267daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
277daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#ifndef _I40E_H_
287daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define _I40E_H_
297daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
307daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <net/tcp.h>
318144f0f7e91ea9e2cbe11202a5ba14601b046d1dJoseph Gasparakis#include <net/udp.h>
327daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/types.h>
337daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/errno.h>
347daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/module.h>
357daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/pci.h>
367daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/aer.h>
377daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/netdevice.h>
387daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/ioport.h>
397daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/slab.h>
407daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/list.h>
417daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/string.h>
427daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/in.h>
437daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/ip.h>
447daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/tcp.h>
457daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/sctp.h>
467daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/pkt_sched.h>
477daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/ipv6.h>
487daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <net/checksum.h>
497daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <net/ip6_checksum.h>
507daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/ethtool.h>
517daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include <linux/if_vlan.h>
52beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller#include <linux/clocksource.h>
53beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller#include <linux/net_tstamp.h>
54beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller#include <linux/ptp_clock_kernel.h>
557daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include "i40e_type.h"
567daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include "i40e_prototype.h"
5738e004388692f049908636a7944f6cd57d28bd77Vasu Dev#ifdef I40E_FCOE
5838e004388692f049908636a7944f6cd57d28bd77Vasu Dev#include "i40e_fcoe.h"
5938e004388692f049908636a7944f6cd57d28bd77Vasu Dev#endif
607daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include "i40e_virtchnl.h"
617daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include "i40e_virtchnl_pf.h"
627daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#include "i40e_txrx.h"
634e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikh#include "i40e_dcb.h"
647daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
657daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/* Useful i40e defaults */
667daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_BASE_PF_SEID     16
677daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_BASE_VSI_SEID    512
687daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_BASE_VEB_SEID    288
697daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_MAX_VEB          16
707daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
717daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_MAX_NUM_DESCRIPTORS      4096
72a45e88c9db90c869365d8e258989639a09cf19dcAnjali Singhai Jain#define I40E_MAX_REGISTER     0x800000
737daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_DEFAULT_NUM_DESCRIPTORS  512
747daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_REQ_DESCRIPTOR_MULTIPLE  32
757daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_MIN_NUM_DESCRIPTORS      64
767daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_MIN_MSIX                 2
777daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_DEFAULT_NUM_VMDQ_VSI     8 /* max 256 VSIs */
78505682cd7baba79b52f6c9df49224307fb6d34efMitch Williams#define I40E_MIN_VSI_ALLOC            51 /* LAN, ATR, FCOE, 32 VF, 16 VMDQ */
797daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_DEFAULT_QUEUES_PER_VMDQ  2 /* max 16 qps */
807daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_DEFAULT_QUEUES_PER_VF    4
817daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_DEFAULT_QUEUES_PER_TC    1 /* should be a power of 2 */
824e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikh#define I40E_MAX_QUEUES_PER_TC        64 /* should be a power of 2 */
837daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_FDIR_RING                0
847daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_FDIR_RING_COUNT          32
8538e004388692f049908636a7944f6cd57d28bd77Vasu Dev#ifdef I40E_FCOE
8638e004388692f049908636a7944f6cd57d28bd77Vasu Dev#define I40E_DEFAULT_FCOE             8 /* default number of QPs for FCoE */
8738e004388692f049908636a7944f6cd57d28bd77Vasu Dev#define I40E_MINIMUM_FCOE             1 /* minimum number of QPs for FCoE */
8838e004388692f049908636a7944f6cd57d28bd77Vasu Dev#endif /* I40E_FCOE */
897daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_MAX_AQ_BUF_SIZE          4096
907daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_AQ_LEN                   32
917daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_AQ_WORK_LIMIT            16
927daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_MAX_USER_PRIORITY        8
937daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_DEFAULT_MSG_ENABLE       4
9423527308d6519c551c8296146f3edf3ad1cd123aNeerav Parikh#define I40E_QUEUE_WAIT_RETRY_LIMIT   10
957daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
967daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_NVM_VERSION_LO_SHIFT  0
97fe31070444268e7b70279bd4a1403625820793b0Anjali Singhai jain#define I40E_NVM_VERSION_LO_MASK   (0xff << I40E_NVM_VERSION_LO_SHIFT)
98ff80301efad4818938470326b9879bb960f5e66cJesse Brandeburg#define I40E_NVM_VERSION_HI_SHIFT  12
99ff80301efad4818938470326b9879bb960f5e66cJesse Brandeburg#define I40E_NVM_VERSION_HI_MASK   (0xf << I40E_NVM_VERSION_HI_SHIFT)
100fe31070444268e7b70279bd4a1403625820793b0Anjali Singhai jain
101fe31070444268e7b70279bd4a1403625820793b0Anjali Singhai jain/* The values in here are decimal coded as hex as is the case in the NVM map*/
102fe31070444268e7b70279bd4a1403625820793b0Anjali Singhai jain#define I40E_CURRENT_NVM_VERSION_HI 0x2
103ff80301efad4818938470326b9879bb960f5e66cJesse Brandeburg#define I40E_CURRENT_NVM_VERSION_LO 0x40
104fe31070444268e7b70279bd4a1403625820793b0Anjali Singhai jain
1057daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/* magic for getting defines into strings */
1067daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define STRINGIFY(foo)  #foo
1077daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define XSTRINGIFY(bar) STRINGIFY(bar)
1087daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
1097daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_RX_DESC(R, i)			\
1107daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	((ring_is_16byte_desc_enabled(R))	\
1117daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg		? (union i40e_32byte_rx_desc *)	\
1127daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg			(&(((union i40e_16byte_rx_desc *)((R)->desc))[i])) \
1137daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg		: (&(((union i40e_32byte_rx_desc *)((R)->desc))[i])))
1147daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_TX_DESC(R, i)			\
1157daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	(&(((struct i40e_tx_desc *)((R)->desc))[i]))
1167daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_TX_CTXTDESC(R, i)			\
1177daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	(&(((struct i40e_tx_context_desc *)((R)->desc))[i]))
1187daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_TX_FDIRDESC(R, i)			\
1197daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	(&(((struct i40e_filter_program_desc *)((R)->desc))[i]))
1207daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
1217daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/* default to trying for four seconds */
1227daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_TRY_LINK_TIMEOUT (4 * HZ)
1237daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
1247daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/* driver state flags */
1257daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgenum i40e_state_t {
1267daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_TESTING,
1277daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_CONFIG_BUSY,
1287daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_CONFIG_DONE,
1297daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_DOWN,
1307daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_NEEDS_RESTART,
1317daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_SERVICE_SCHED,
1327daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_ADMINQ_EVENT_PENDING,
1337daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_MDD_EVENT_PENDING,
1347daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_VFLR_EVENT_PENDING,
1357daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_RESET_RECOVERY_PENDING,
1367daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_RESET_INTR_RECEIVED,
1377daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_REINIT_REQUESTED,
1387daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_PF_RESET_REQUESTED,
1397daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_CORE_RESET_REQUESTED,
1407daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_GLOBAL_RESET_REQUESTED,
1417823fe341da4660c9aab9fec8fbff94e3070ceafShannon Nelson	__I40E_EMP_RESET_REQUESTED,
1427daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	__I40E_FILTER_OVERFLOW_PROMISC,
1439007bccd306956280448fd16fc8e6c65ff4d5337Shannon Nelson	__I40E_SUSPENDED,
1449ce34f023d6025af89087472f0327e0a81073167Jakub Kicinski	__I40E_PTP_TX_IN_PROGRESS,
1454eb3f7685fd6ffbe28a0a4ff10cced2acda5f7ecShannon Nelson	__I40E_BAD_EEPROM,
146b5d06f058b0bb52c39e4f1a32584dda712e0398fNeerav Parikh	__I40E_DOWN_REQUESTED,
1471e1be8f622ee3d01acdbf5f4e00fbdd53ff950c9Anjali Singhai Jain	__I40E_FD_FLUSH_REQUESTED,
148a316f651c73f782ff7c6df623a69b67f8f464856Anjali Singhai Jain	__I40E_RESET_FAILED,
1497daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg};
1507daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
1517daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgenum i40e_interrupt_policy {
1527daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	I40E_INTERRUPT_BEST_CASE,
1537daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	I40E_INTERRUPT_MEDIUM,
1547daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	I40E_INTERRUPT_LOWEST
1557daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg};
1567daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
1577daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_lump_tracking {
1587daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 num_entries;
1597daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 search_hint;
1607daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 list[0];
1617daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_PILE_VALID_BIT  0x8000
1627daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg};
1637daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
1647daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_DEFAULT_ATR_SAMPLE_RATE	20
16555a5e60b9f583f64a6c95cfe869dd2d65ae53a95Anjali Singhai Jain#define I40E_FDIR_MAX_RAW_PACKET_SIZE	512
16655a5e60b9f583f64a6c95cfe869dd2d65ae53a95Anjali Singhai Jain#define I40E_FDIR_BUFFER_FULL_MARGIN	10
167129573883c5b39d978c4a7fbe513f8e54898e27eAnjali Singhai Jain#define I40E_FDIR_BUFFER_HEAD_ROOM	32
16855a5e60b9f583f64a6c95cfe869dd2d65ae53a95Anjali Singhai Jain
169433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jainenum i40e_fd_stat_idx {
170433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain	I40E_FD_STAT_ATR,
171433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain	I40E_FD_STAT_SB,
172433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain	I40E_FD_STAT_PF_COUNT
173433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain};
174433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain#define I40E_FD_STAT_PF_IDX(pf_id) ((pf_id) * I40E_FD_STAT_PF_COUNT)
175433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain#define I40E_FD_ATR_STAT_IDX(pf_id) \
176433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain			(I40E_FD_STAT_PF_IDX(pf_id) + I40E_FD_STAT_ATR)
177433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain#define I40E_FD_SB_STAT_IDX(pf_id)  \
178433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain			(I40E_FD_STAT_PF_IDX(pf_id) + I40E_FD_STAT_SB)
179433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain
18017a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakisstruct i40e_fdir_filter {
18117a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	struct hlist_node fdir_node;
18217a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	/* filter ipnut set */
18317a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	u8 flow_type;
18417a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	u8 ip4_proto;
18504b73bd7a46b0294456301e237041cca5adb33d7Anjali Singhai Jain	/* TX packet view of src and dst */
18617a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	__be32 dst_ip[4];
18717a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	__be32 src_ip[4];
18817a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	__be16 src_port;
18917a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	__be16 dst_port;
19017a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	__be32 sctp_v_tag;
19117a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	/* filter control */
1927daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 q_index;
1937daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  flex_off;
1947daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  pctype;
1957daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 dest_vsi;
1967daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  dest_ctl;
1977daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  fd_status;
1987daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 cnt_index;
1997daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32 fd_id;
2007daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg};
2017daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
2024e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikh#define I40E_ETH_P_LLDP			0x88cc
2034e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikh
2047daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_DCB_PRIO_TYPE_STRICT	0
2057daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_DCB_PRIO_TYPE_ETS		1
2067daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_DCB_STRICT_PRIO_CREDITS	127
2077daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_MAX_USER_PRIORITY	8
2087daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/* DCB per TC information data structure */
2097daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_tc_info {
2107daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16	qoffset;	/* Queue offset from base queue */
2117daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16	qcount;		/* Total Queues */
2127daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8	netdev_tc;	/* Netdev TC index if netdev associated */
2137daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg};
2147daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
2157daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/* TC configuration data structure */
2167daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_tc_configuration {
2177daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8	numtc;		/* Total number of enabled TCs */
2187daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8	enabled_tc;	/* TC map */
2197daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_tc_info tc_info[I40E_MAX_TRAFFIC_CLASS];
2207daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg};
2217daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
2227daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/* struct that defines the Ethernet device */
2237daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_pf {
2247daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct pci_dev *pdev;
2257daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_hw hw;
2267daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	unsigned long state;
2277daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	unsigned long link_check_timeout;
2287daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct msix_entry *msix_entries;
2297daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	bool fc_autoneg_status;
2307daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
2317daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 eeprom_version;
2326c167f582ea93d0b66a187ec06a7c015fecd723aElizabeth Kappler	u16 num_vmdq_vsis;         /* num vmdq vsis this pf has set up */
2337daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 num_vmdq_qps;          /* num queue pairs per vmdq pool */
2347daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 num_vmdq_msix;         /* num queue vectors per vmdq pool */
2357daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 num_req_vfs;           /* num vfs requested for this vf */
2367daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 num_vf_qps;            /* num queue pairs per vf */
23738e004388692f049908636a7944f6cd57d28bd77Vasu Dev#ifdef I40E_FCOE
23838e004388692f049908636a7944f6cd57d28bd77Vasu Dev	u16 num_fcoe_qps;          /* num fcoe queues this pf has set up */
23938e004388692f049908636a7944f6cd57d28bd77Vasu Dev	u16 num_fcoe_msix;         /* num queue vectors per fcoe pool */
24038e004388692f049908636a7944f6cd57d28bd77Vasu Dev#endif /* I40E_FCOE */
2417daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 num_lan_qps;           /* num lan queues this pf has set up */
2427daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 num_lan_msix;          /* num queue vectors for the base pf vsi */
243f8ff14640a72dd35da0fa5fb84b0ef61610f2c3aAnjali Singhai Jain	int queues_left;           /* queues left unclaimed */
2447daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 rss_size;              /* num queues in the RSS array */
2457daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 rss_size_max;          /* HW defined max RSS queues */
2467daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 fdir_pf_filter_count;  /* num of guaranteed filters for this PF */
247505682cd7baba79b52f6c9df49224307fb6d34efMitch Williams	u16 num_alloc_vsi;         /* num VSIs this driver supports */
2487daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8 atr_sample_rate;
2498e2773ae3558d69ebba48df2c52111d975db6afaShannon Nelson	bool wol_en;
2507daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
25117a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	struct hlist_head fdir_filter_list;
25217a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis	u16 fdir_pf_active_filters;
253433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain	u16 fd_sb_cnt_idx;
254433c47de1368cf07a7cb8d9148a4d36d824b89f8Anjali Singhai Jain	u16 fd_atr_cnt_idx;
2551e1be8f622ee3d01acdbf5f4e00fbdd53ff950c9Anjali Singhai Jain	unsigned long fd_flush_timestamp;
25660793f4ab541f9c279f823e42dc8053341cc7547Anjali Singhai Jain	u32 fd_flush_cnt;
2571e1be8f622ee3d01acdbf5f4e00fbdd53ff950c9Anjali Singhai Jain	u32 fd_add_err;
2581e1be8f622ee3d01acdbf5f4e00fbdd53ff950c9Anjali Singhai Jain	u32 fd_atr_cnt;
2591e1be8f622ee3d01acdbf5f4e00fbdd53ff950c9Anjali Singhai Jain	u32 fd_tcp_rule;
26017a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis
261a1c9a9d9984d9acf276089525b43a6528feab29bJeff Kirsher#ifdef CONFIG_I40E_VXLAN
262a1c9a9d9984d9acf276089525b43a6528feab29bJeff Kirsher	__be16  vxlan_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
263a1c9a9d9984d9acf276089525b43a6528feab29bJeff Kirsher	u16 pending_vxlan_bitmap;
264a1c9a9d9984d9acf276089525b43a6528feab29bJeff Kirsher
265a1c9a9d9984d9acf276089525b43a6528feab29bJeff Kirsher#endif
2667daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	enum i40e_interrupt_policy int_policy;
2677daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 rx_itr_default;
2687daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 tx_itr_default;
2697daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 msg_enable;
2707daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	char misc_int_name[IFNAMSIZ + 9];
2717daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 adminq_work_limit; /* num of admin receive queue desc to process */
2727daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	int service_timer_period;
2737daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct timer_list service_timer;
2747daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct work_struct service_task;
2757daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
2767daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u64 flags;
2777daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_FLAG_RX_CSUM_ENABLED              (u64)(1 << 1)
2787daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_FLAG_MSI_ENABLED                  (u64)(1 << 2)
2797daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_FLAG_MSIX_ENABLED                 (u64)(1 << 3)
2807daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_FLAG_RX_1BUF_ENABLED              (u64)(1 << 4)
2817daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_FLAG_RX_PS_ENABLED                (u64)(1 << 5)
2827daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_FLAG_RSS_ENABLED                  (u64)(1 << 6)
2839f52987b0508c9162ef9861b2e82d7a82992162eNeerav Parikh#define I40E_FLAG_VMDQ_ENABLED                 (u64)(1 << 7)
2849f52987b0508c9162ef9861b2e82d7a82992162eNeerav Parikh#define I40E_FLAG_FDIR_REQUIRES_REINIT         (u64)(1 << 8)
2859f52987b0508c9162ef9861b2e82d7a82992162eNeerav Parikh#define I40E_FLAG_NEED_LINK_UPDATE             (u64)(1 << 9)
28638e004388692f049908636a7944f6cd57d28bd77Vasu Dev#ifdef I40E_FCOE
28738e004388692f049908636a7944f6cd57d28bd77Vasu Dev#define I40E_FLAG_FCOE_ENABLED                 (u64)(1 << 11)
28838e004388692f049908636a7944f6cd57d28bd77Vasu Dev#endif /* I40E_FCOE */
2899f52987b0508c9162ef9861b2e82d7a82992162eNeerav Parikh#define I40E_FLAG_IN_NETPOLL                   (u64)(1 << 12)
2909f52987b0508c9162ef9861b2e82d7a82992162eNeerav Parikh#define I40E_FLAG_16BYTE_RX_DESC_ENABLED       (u64)(1 << 13)
2919f52987b0508c9162ef9861b2e82d7a82992162eNeerav Parikh#define I40E_FLAG_CLEAN_ADMINQ                 (u64)(1 << 14)
2929f52987b0508c9162ef9861b2e82d7a82992162eNeerav Parikh#define I40E_FLAG_FILTER_SYNC                  (u64)(1 << 15)
2939f52987b0508c9162ef9861b2e82d7a82992162eNeerav Parikh#define I40E_FLAG_PROCESS_MDD_EVENT            (u64)(1 << 17)
2949f52987b0508c9162ef9861b2e82d7a82992162eNeerav Parikh#define I40E_FLAG_PROCESS_VFLR_EVENT           (u64)(1 << 18)
2959f52987b0508c9162ef9861b2e82d7a82992162eNeerav Parikh#define I40E_FLAG_SRIOV_ENABLED                (u64)(1 << 19)
2969f52987b0508c9162ef9861b2e82d7a82992162eNeerav Parikh#define I40E_FLAG_DCB_ENABLED                  (u64)(1 << 20)
29760ea5f83cddf538a4509f2214ffd50d8d69952a5Jesse Brandeburg#define I40E_FLAG_FD_SB_ENABLED                (u64)(1 << 21)
29860ea5f83cddf538a4509f2214ffd50d8d69952a5Jesse Brandeburg#define I40E_FLAG_FD_ATR_ENABLED               (u64)(1 << 22)
299beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller#define I40E_FLAG_PTP                          (u64)(1 << 25)
300a1c9a9d9984d9acf276089525b43a6528feab29bJeff Kirsher#define I40E_FLAG_MFP_ENABLED                  (u64)(1 << 26)
301a1c9a9d9984d9acf276089525b43a6528feab29bJeff Kirsher#ifdef CONFIG_I40E_VXLAN
302a1c9a9d9984d9acf276089525b43a6528feab29bJeff Kirsher#define I40E_FLAG_VXLAN_FILTER_SYNC            (u64)(1 << 27)
303a1c9a9d9984d9acf276089525b43a6528feab29bJeff Kirsher#endif
3041f224ad2f760288dcc58b26546892a6b200b2af2Neerav Parikh#define I40E_FLAG_PORT_ID_VALID                (u64)(1 << 28)
3054d9b604353e65824e49a01ecf2b3f3bf329e6048Neerav Parikh#define I40E_FLAG_DCB_CAPABLE                  (u64)(1 << 29)
3067daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
30761dade7e9201162cba683cff103cebbdf06655d4Anjali Singhai Jain	/* tracks features that get auto disabled by errors */
30861dade7e9201162cba683cff103cebbdf06655d4Anjali Singhai Jain	u64 auto_disable_flags;
30961dade7e9201162cba683cff103cebbdf06655d4Anjali Singhai Jain
31038e004388692f049908636a7944f6cd57d28bd77Vasu Dev#ifdef I40E_FCOE
31138e004388692f049908636a7944f6cd57d28bd77Vasu Dev	struct i40e_fcoe fcoe;
31238e004388692f049908636a7944f6cd57d28bd77Vasu Dev
31338e004388692f049908636a7944f6cd57d28bd77Vasu Dev#endif /* I40E_FCOE */
3147daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	bool stat_offsets_loaded;
3157daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_hw_port_stats stats;
3167daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_hw_port_stats stats_offsets;
3177daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32 tx_timeout_count;
3187daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32 tx_timeout_recovery_level;
3197daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	unsigned long tx_timeout_last_recovery;
320810b3ae42f5a6d1ddb17bb20eb69046de08ab1efAnjali Singhai Jain	u32 tx_sluggish_count;
3217daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32 hw_csum_rx_error;
3227daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32 led_status;
3237daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 corer_count; /* Core reset count */
3247daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 globr_count; /* Global reset count */
3257daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 empr_count; /* EMP reset count */
3267daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 pfr_count; /* PF reset count */
327cd92e72f2d0a5b576f025f693cfd306cebd8b84aShannon Nelson	u16 sw_int_count; /* SW interrupt count */
3287daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
3297daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct mutex switch_mutex;
3307daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 lan_vsi;       /* our default LAN VSI */
3317daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 lan_veb;       /* initial relay, if exists */
3327daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_NO_VEB   0xffff
3337daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_NO_VSI   0xffff
3347daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 next_vsi;      /* Next unallocated VSI - 0-based! */
3357daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_vsi **vsi;
3367daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_veb *veb[I40E_MAX_VEB];
3377daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
3387daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_lump_tracking *qp_pile;
3397daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_lump_tracking *irq_pile;
3407daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
3417daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	/* switch config info */
3427daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 pf_seid;
3437daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 main_vsi_seid;
3447daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 mac_seid;
3457daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct kobject *switch_kobj;
3467daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#ifdef CONFIG_DEBUG_FS
3477daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct dentry *i40e_dbg_pf;
3487daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#endif /* CONFIG_DEBUG_FS */
3497daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
35093cd765bb27365e7be92c510c73b017426eb490dAnjali Singhai Jain	u16 instance; /* A unique number per i40e_pf instance in the system */
35193cd765bb27365e7be92c510c73b017426eb490dAnjali Singhai Jain
3527daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	/* sr-iov config info */
3537daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_vf *vf;
3547daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	int num_alloc_vfs;	/* actual number of VFs allocated */
3557daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32 vf_aq_requests;
3567daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
3577daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	/* DCBx/DCBNL capability for PF that indicates
3587daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	 * whether DCBx is managed by firmware or host
3597daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	 * based agent (LLDPAD). Also, indicates what
3607daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	 * flavor of DCBx protocol (IEEE/CEE) is supported
3617daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	 * by the device. For now we're supporting IEEE
3627daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	 * mode only.
3637daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	 */
3647daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 dcbx_cap;
3657daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
3667daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32	fcoe_hmc_filt_num;
3677daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32	fcoe_hmc_cntx_num;
3687daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_filter_control_settings filter_settings;
369beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller
370beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller	struct ptp_clock *ptp_clock;
371beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller	struct ptp_clock_info ptp_caps;
372beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller	struct sk_buff *ptp_tx_skb;
373beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller	struct hwtstamp_config tstamp_config;
374beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller	unsigned long last_rx_ptp_check;
375beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller	spinlock_t tmreg_lock; /* Used to protect the device time registers. */
376beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller	u64 ptp_base_adj;
377beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller	u32 tx_hwtstamp_timeouts;
378beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller	u32 rx_hwtstamp_cleared;
379beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller	bool ptp_tx;
380beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Keller	bool ptp_rx;
381e157ea30606743f2bfa2ec445a0bb0839e17271bCarolyn Wyborny	u16 rss_table_size;
3827daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg};
3837daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
3847daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_mac_filter {
3857daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct list_head list;
3867daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8 macaddr[ETH_ALEN];
3877daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_VLAN_ANY -1
3887daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	s16 vlan;
3897daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8 counter;		/* number of instances of this filter */
3907daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	bool is_vf;		/* filter belongs to a VF */
3917daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	bool is_netdev;		/* filter belongs to a netdev */
3927daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	bool changed;		/* filter needs to be sync'd to the HW */
3936252c7e4ee48f016dd075168df9fabc7197f38e5Shannon Nelson	bool is_laa;		/* filter is a Locally Administered Address */
3947daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg};
3957daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
3967daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_veb {
3977daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_pf *pf;
3987daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 idx;
3997daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 veb_idx;           /* index of VEB parent */
4007daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 seid;
4017daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 uplink_seid;
4027daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 stats_idx;           /* index of VEB parent */
4037daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  enabled_tc;
4047daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 flags;
4057daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 bw_limit;
4067daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  bw_max_quanta;
4077daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	bool is_abs_credits;
4087daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  bw_tc_share_credits[I40E_MAX_TRAFFIC_CLASS];
4097daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 bw_tc_limit_credits[I40E_MAX_TRAFFIC_CLASS];
4107daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  bw_tc_max_quanta[I40E_MAX_TRAFFIC_CLASS];
4117daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct kobject *kobj;
4127daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	bool stat_offsets_loaded;
4137daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_eth_stats stats;
4147daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_eth_stats stats_offsets;
4157daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg};
4167daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4177daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/* struct that defines a VSI, associated with a dev */
4187daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_vsi {
4197daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct net_device *netdev;
4207daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
4217daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	bool netdev_registered;
4227daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	bool stat_offsets_loaded;
4237daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4247daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32 current_netdev_flags;
4257daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	unsigned long state;
4267daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_VSI_FLAG_FILTER_CHANGED  (1<<0)
4277daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#define I40E_VSI_FLAG_VEB_OWNER       (1<<1)
4287daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	unsigned long flags;
4297daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4307daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct list_head mac_filter_list;
4317daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4327daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	/* VSI stats */
4337daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct rtnl_link_stats64 net_stats;
4347daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct rtnl_link_stats64 net_stats_offsets;
4357daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_eth_stats eth_stats;
4367daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_eth_stats eth_stats_offsets;
43738e004388692f049908636a7944f6cd57d28bd77Vasu Dev#ifdef I40E_FCOE
43838e004388692f049908636a7944f6cd57d28bd77Vasu Dev	struct i40e_fcoe_stats fcoe_stats;
43938e004388692f049908636a7944f6cd57d28bd77Vasu Dev	struct i40e_fcoe_stats fcoe_stats_offsets;
44038e004388692f049908636a7944f6cd57d28bd77Vasu Dev	bool fcoe_stat_offsets_loaded;
44138e004388692f049908636a7944f6cd57d28bd77Vasu Dev#endif
4427daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32 tx_restart;
4437daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32 tx_busy;
4447daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32 rx_buf_failed;
4457daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u32 rx_page_failed;
4467daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4479f65e15b4f982391eef795a74adcc6580f0d7c53Alexander Duyck	/* These are containers of ring pointers, allocated at run-time */
4489f65e15b4f982391eef795a74adcc6580f0d7c53Alexander Duyck	struct i40e_ring **rx_rings;
4499f65e15b4f982391eef795a74adcc6580f0d7c53Alexander Duyck	struct i40e_ring **tx_rings;
4507daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4517daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 work_limit;
4527daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	/* high bit set means dynamic, use accessor routines to read/write.
4537daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	 * hardware only supports 2us resolution for the ITR registers.
4547daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	 * these values always store the USER setting, and must be converted
4557daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	 * before programming to a register.
4567daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	 */
4577daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 rx_itr_setting;
4587daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 tx_itr_setting;
4597daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4607daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 max_frame;
4617daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 rx_hdr_len;
4627daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 rx_buf_len;
4637daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  dtype;
4647daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4657daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	/* List of q_vectors allocated to this VSI */
466493fb30011b3ab5173cef96f1d1ce126da051792Alexander Duyck	struct i40e_q_vector **q_vectors;
4677daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	int num_q_vectors;
4687daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	int base_vector;
4696374184672c8e405640ab57ea9ad1cb7ed4fa669Shannon Nelson	bool irqs_ready;
4707daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4717daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 seid;            /* HW index of this VSI (absolute index) */
4727daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 id;              /* VSI number */
4737daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 uplink_seid;
4747daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4757daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 base_queue;      /* vsi's first queue in hw array */
4767daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 alloc_queue_pairs; /* Allocated Tx/Rx queues */
4777daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 num_queue_pairs; /* Used tx and rx pairs */
4787daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 num_desc;
4797daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	enum i40e_vsi_type type;  /* VSI type, e.g., LAN, FCoE, etc */
4807daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 vf_id;		/* Virtual function ID for SRIOV VSIs */
4817daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4827daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_tc_configuration tc_config;
4837daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_aqc_vsi_properties_data info;
4847daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4857daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	/* VSI BW limit (absolute across all TCs) */
4867daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 bw_limit;		/* VSI BW Limit (0 = disabled) */
4877daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  bw_max_quanta;	/* Max Quanta when BW limit is enabled */
4887daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4897daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	/* Relative TC credits across VSIs */
4907daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
4917daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	/* TC BW limit credits within VSI */
4927daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16  bw_ets_limit_credits[I40E_MAX_TRAFFIC_CLASS];
4937daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	/* TC BW limit max quanta within VSI */
4947daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8  bw_ets_max_quanta[I40E_MAX_TRAFFIC_CLASS];
4957daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
4967daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_pf *back;  /* Backreference to associated PF */
4977daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 idx;               /* index in pf->vsi[] */
4987daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 veb_idx;           /* index of VEB parent */
4997daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct kobject *kobj;  /* sysfs object */
5007daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5017daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	/* VSI specific handlers */
5027daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	irqreturn_t (*irq_handler)(int irq, void *data);
5037daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg} ____cacheline_internodealigned_in_smp;
5047daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5057daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_netdev_priv {
5067daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_vsi *vsi;
5077daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg};
5087daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5097daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/* struct that defines an interrupt vector */
5107daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_q_vector {
5117daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_vsi *vsi;
5127daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5137daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 v_idx;		/* index in the vsi->q_vector array. */
5147daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u16 reg_idx;		/* register index of the interrupt */
5157daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5167daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct napi_struct napi;
5177daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5187daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_ring_container rx;
5197daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_ring_container tx;
5207daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5217daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	u8 num_ringpairs;	/* total number of ring pairs in vector */
5227daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5237daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	cpumask_t affinity_mask;
524493fb30011b3ab5173cef96f1d1ce126da051792Alexander Duyck	struct rcu_head rcu;	/* to avoid race with update stats on free */
525493fb30011b3ab5173cef96f1d1ce126da051792Alexander Duyck	char name[IFNAMSIZ + 9];
5267daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg} ____cacheline_internodealigned_in_smp;
5277daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5287daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/* lan device */
5297daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_device {
5307daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct list_head list;
5317daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_pf *pf;
5327daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg};
5337daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5347daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/**
5357daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * i40e_fw_version_str - format the FW and NVM version strings
5367daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * @hw: ptr to the hardware info
5377daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg **/
5387daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstatic inline char *i40e_fw_version_str(struct i40e_hw *hw)
5397daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg{
5407daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	static char buf[32];
5417daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5427daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	snprintf(buf, sizeof(buf),
543fe31070444268e7b70279bd4a1403625820793b0Anjali Singhai jain		 "f%d.%d a%d.%d n%02x.%02x e%08x",
5447daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg		 hw->aq.fw_maj_ver, hw->aq.fw_min_ver,
5457daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg		 hw->aq.api_maj_ver, hw->aq.api_min_ver,
546ff80301efad4818938470326b9879bb960f5e66cJesse Brandeburg		 (hw->nvm.version & I40E_NVM_VERSION_HI_MASK) >>
547ff80301efad4818938470326b9879bb960f5e66cJesse Brandeburg			I40E_NVM_VERSION_HI_SHIFT,
548ff80301efad4818938470326b9879bb960f5e66cJesse Brandeburg		 (hw->nvm.version & I40E_NVM_VERSION_LO_MASK) >>
549ff80301efad4818938470326b9879bb960f5e66cJesse Brandeburg			I40E_NVM_VERSION_LO_SHIFT,
5507daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg		 hw->nvm.eetrack);
5517daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5527daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	return buf;
5537daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg}
5547daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5557daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/**
5567daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * i40e_netdev_to_pf: Retrieve the PF struct for given netdev
5577daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * @netdev: the corresponding netdev
5587daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg *
5597daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * Return the PF struct for the given netdev
5607daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg **/
5617daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstatic inline struct i40e_pf *i40e_netdev_to_pf(struct net_device *netdev)
5627daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg{
5637daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_netdev_priv *np = netdev_priv(netdev);
5647daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	struct i40e_vsi *vsi = np->vsi;
5657daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5667daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	return vsi->back;
5677daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg}
5687daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5697daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstatic inline void i40e_vsi_setup_irqhandler(struct i40e_vsi *vsi,
5707daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg				irqreturn_t (*irq_handler)(int, void *))
5717daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg{
5727daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	vsi->irq_handler = irq_handler;
5737daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg}
5747daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
5757daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/**
5767daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * i40e_rx_is_programming_status - check for programming status descriptor
5777daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * @qw: the first quad word of the program status descriptor
5787daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg *
5797daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * The value of in the descriptor length field indicate if this
5807daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * is a programming status descriptor for flow director or FCoE
5817daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * by the value of I40E_RX_PROG_STATUS_DESC_LENGTH, otherwise
5827daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg * it is a packet descriptor.
5837daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg **/
5847daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstatic inline bool i40e_rx_is_programming_status(u64 qw)
5857daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg{
5867daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg	return I40E_RX_PROG_STATUS_DESC_LENGTH ==
5877daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg		(qw >> I40E_RX_PROG_STATUS_DESC_LENGTH_SHIFT);
5887daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg}
5897daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
590082def103dd18350eb9a5c911465666606485404Anjali Singhai Jain/**
591082def103dd18350eb9a5c911465666606485404Anjali Singhai Jain * i40e_get_fd_cnt_all - get the total FD filter space available
592082def103dd18350eb9a5c911465666606485404Anjali Singhai Jain * @pf: pointer to the pf struct
593082def103dd18350eb9a5c911465666606485404Anjali Singhai Jain **/
594082def103dd18350eb9a5c911465666606485404Anjali Singhai Jainstatic inline int i40e_get_fd_cnt_all(struct i40e_pf *pf)
595082def103dd18350eb9a5c911465666606485404Anjali Singhai Jain{
596082def103dd18350eb9a5c911465666606485404Anjali Singhai Jain	return pf->hw.fdir_shared_filter_count + pf->fdir_pf_filter_count;
597082def103dd18350eb9a5c911465666606485404Anjali Singhai Jain}
598082def103dd18350eb9a5c911465666606485404Anjali Singhai Jain
5997daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg/* needed by i40e_ethtool.c */
6007daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgint i40e_up(struct i40e_vsi *vsi);
6017daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_down(struct i40e_vsi *vsi);
6027daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgextern const char i40e_driver_name[];
6037daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgextern const char i40e_driver_version_str[];
604233261867fc62276d6a4099519f81dcd10bd7297Anjali Singhai Jainvoid i40e_do_reset_safe(struct i40e_pf *pf, u32 reset_flags);
6057daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_do_reset(struct i40e_pf *pf, u32 reset_flags);
6067daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_update_stats(struct i40e_vsi *vsi);
6077daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_update_eth_stats(struct i40e_vsi *vsi);
6087daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct rtnl_link_stats64 *i40e_get_vsi_stats_struct(struct i40e_vsi *vsi);
6097daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgint i40e_fetch_switch_configuration(struct i40e_pf *pf,
6107daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg				    bool printconfig);
6117daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
61217a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakisint i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
6137daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg			     struct i40e_pf *pf, bool add);
61417a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakisint i40e_add_del_fdir(struct i40e_vsi *vsi,
61517a73f6b14010d4516a05f52e3c87431e86edebbJoseph Gasparakis		      struct i40e_fdir_filter *input, bool add);
61655a5e60b9f583f64a6c95cfe869dd2d65ae53a95Anjali Singhai Jainvoid i40e_fdir_check_and_reenable(struct i40e_pf *pf);
61755a5e60b9f583f64a6c95cfe869dd2d65ae53a95Anjali Singhai Jainint i40e_get_current_fd_count(struct i40e_pf *pf);
618129573883c5b39d978c4a7fbe513f8e54898e27eAnjali Singhai Jainint i40e_get_cur_guaranteed_fd_count(struct i40e_pf *pf);
6191e1be8f622ee3d01acdbf5f4e00fbdd53ff950c9Anjali Singhai Jainint i40e_get_current_atr_cnt(struct i40e_pf *pf);
6207c3c288bcf95ebfc970c508821dd950876422280Anjali Singhai Jainbool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features);
6217daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_set_ethtool_ops(struct net_device *netdev);
6227daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,
6237daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg					u8 *macaddr, s16 vlan,
6247daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg					bool is_vf, bool is_netdev);
6257daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_del_filter(struct i40e_vsi *vsi, u8 *macaddr, s16 vlan,
6267daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg		     bool is_vf, bool is_netdev);
6277daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgint i40e_sync_vsi_filters(struct i40e_vsi *vsi);
6287daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
6297daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg				u16 uplink, u32 param1);
6307daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgint i40e_vsi_release(struct i40e_vsi *vsi);
6317daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_vsi *i40e_vsi_lookup(struct i40e_pf *pf, enum i40e_vsi_type type,
6327daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg				 struct i40e_vsi *start_vsi);
63338e004388692f049908636a7944f6cd57d28bd77Vasu Dev#ifdef I40E_FCOE
63438e004388692f049908636a7944f6cd57d28bd77Vasu Devvoid i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,
63538e004388692f049908636a7944f6cd57d28bd77Vasu Dev			      struct i40e_vsi_context *ctxt,
63638e004388692f049908636a7944f6cd57d28bd77Vasu Dev			      u8 enabled_tc, bool is_add);
63738e004388692f049908636a7944f6cd57d28bd77Vasu Dev#endif
638fc18eaa073e5a35aa21038c0c69a5a646195a58bMitch Williamsint i40e_vsi_control_rings(struct i40e_vsi *vsi, bool enable);
639f8ff14640a72dd35da0fa5fb84b0ef61610f2c3aAnjali Singhai Jainint i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count);
6407daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_veb *i40e_veb_setup(struct i40e_pf *pf, u16 flags, u16 uplink_seid,
6417daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg				u16 downlink_seid, u8 enabled_tc);
6427daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_veb_release(struct i40e_veb *veb);
6437daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg
6444e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikhint i40e_veb_config_tc(struct i40e_veb *veb, u8 enabled_tc);
6457daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgi40e_status i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid);
6467daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_vsi_remove_pvid(struct i40e_vsi *vsi);
6477daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_vsi_reset_stats(struct i40e_vsi *vsi);
6487daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_pf_reset_stats(struct i40e_pf *pf);
6497daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#ifdef CONFIG_DEBUG_FS
6507daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_dbg_pf_init(struct i40e_pf *pf);
6517daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_dbg_pf_exit(struct i40e_pf *pf);
6527daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_dbg_init(void);
6537daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_dbg_exit(void);
6547daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#else
6557daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstatic inline void i40e_dbg_pf_init(struct i40e_pf *pf) {}
6567daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstatic inline void i40e_dbg_pf_exit(struct i40e_pf *pf) {}
6577daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstatic inline void i40e_dbg_init(void) {}
6587daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstatic inline void i40e_dbg_exit(void) {}
6597daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#endif /* CONFIG_DEBUG_FS*/
6607daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_irq_dynamic_enable(struct i40e_vsi *vsi, int vector);
6615c2cebda438b888147f6dfd6d1423432d837c0eaCarolyn Wybornyvoid i40e_irq_dynamic_disable(struct i40e_vsi *vsi, int vector);
6622ef28cfb098914f1b8e74807e0cbca2e89262d97Mitch Williamsvoid i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf);
663116a57d4ae92729b343d6ebb4a1eec24672022abShannon Nelsonvoid i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf);
66438e004388692f049908636a7944f6cd57d28bd77Vasu Dev#ifdef I40E_FCOE
66538e004388692f049908636a7944f6cd57d28bd77Vasu Devstruct rtnl_link_stats64 *i40e_get_netdev_stats_struct(
66638e004388692f049908636a7944f6cd57d28bd77Vasu Dev					     struct net_device *netdev,
66738e004388692f049908636a7944f6cd57d28bd77Vasu Dev					     struct rtnl_link_stats64 *storage);
66838e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_set_mac(struct net_device *netdev, void *p);
66938e004388692f049908636a7944f6cd57d28bd77Vasu Devvoid i40e_set_rx_mode(struct net_device *netdev);
67038e004388692f049908636a7944f6cd57d28bd77Vasu Dev#endif
6717daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgint i40e_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
67238e004388692f049908636a7944f6cd57d28bd77Vasu Dev#ifdef I40E_FCOE
67338e004388692f049908636a7944f6cd57d28bd77Vasu Devvoid i40e_tx_timeout(struct net_device *netdev);
67438e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_vlan_rx_add_vid(struct net_device *netdev,
67538e004388692f049908636a7944f6cd57d28bd77Vasu Dev			 __always_unused __be16 proto, u16 vid);
67638e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_vlan_rx_kill_vid(struct net_device *netdev,
67738e004388692f049908636a7944f6cd57d28bd77Vasu Dev			  __always_unused __be16 proto, u16 vid);
67838e004388692f049908636a7944f6cd57d28bd77Vasu Dev#endif
6796c167f582ea93d0b66a187ec06a7c015fecd723aElizabeth Kapplerint i40e_vsi_open(struct i40e_vsi *vsi);
6807daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_vlan_stripping_disable(struct i40e_vsi *vsi);
6817daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgint i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid);
6827daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgint i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid);
6837daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi, u8 *macaddr,
6847daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg					     bool is_vf, bool is_netdev);
6857daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgbool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi);
6867daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgstruct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, u8 *macaddr,
6877daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg				      bool is_vf, bool is_netdev);
68838e004388692f049908636a7944f6cd57d28bd77Vasu Dev#ifdef I40E_FCOE
68938e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_open(struct net_device *netdev);
69038e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_close(struct net_device *netdev);
69138e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_setup_tc(struct net_device *netdev, u8 tc);
69238e004388692f049908636a7944f6cd57d28bd77Vasu Devvoid i40e_netpoll(struct net_device *netdev);
69338e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_fcoe_enable(struct net_device *netdev);
69438e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_fcoe_disable(struct net_device *netdev);
69538e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_fcoe_vsi_init(struct i40e_vsi *vsi, struct i40e_vsi_context *ctxt);
69638e004388692f049908636a7944f6cd57d28bd77Vasu Devu8 i40e_get_fcoe_tc_map(struct i40e_pf *pf);
69738e004388692f049908636a7944f6cd57d28bd77Vasu Devvoid i40e_fcoe_config_netdev(struct net_device *netdev, struct i40e_vsi *vsi);
69838e004388692f049908636a7944f6cd57d28bd77Vasu Devvoid i40e_fcoe_vsi_setup(struct i40e_pf *pf);
69938e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_init_pf_fcoe(struct i40e_pf *pf);
70038e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_fcoe_setup_ddp_resources(struct i40e_vsi *vsi);
70138e004388692f049908636a7944f6cd57d28bd77Vasu Devvoid i40e_fcoe_free_ddp_resources(struct i40e_vsi *vsi);
70238e004388692f049908636a7944f6cd57d28bd77Vasu Devint i40e_fcoe_handle_offload(struct i40e_ring *rx_ring,
70338e004388692f049908636a7944f6cd57d28bd77Vasu Dev			     union i40e_rx_desc *rx_desc,
70438e004388692f049908636a7944f6cd57d28bd77Vasu Dev			     struct sk_buff *skb);
70538e004388692f049908636a7944f6cd57d28bd77Vasu Devvoid i40e_fcoe_handle_status(struct i40e_ring *rx_ring,
70638e004388692f049908636a7944f6cd57d28bd77Vasu Dev			     union i40e_rx_desc *rx_desc, u8 prog_id);
70738e004388692f049908636a7944f6cd57d28bd77Vasu Dev#endif /* I40E_FCOE */
7087daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburgvoid i40e_vlan_stripping_enable(struct i40e_vsi *vsi);
7094e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikh#ifdef CONFIG_I40E_DCB
7104e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikhvoid i40e_dcbnl_flush_apps(struct i40e_pf *pf,
7114e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikh			   struct i40e_dcbx_config *new_cfg);
7124e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikhvoid i40e_dcbnl_set_all(struct i40e_vsi *vsi);
7134e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikhvoid i40e_dcbnl_setup(struct i40e_vsi *vsi);
7144e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikhbool i40e_dcb_need_reconfig(struct i40e_pf *pf,
7154e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikh			    struct i40e_dcbx_config *old_cfg,
7164e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikh			    struct i40e_dcbx_config *new_cfg);
7174e3b35b044ea511184ad4c5eff32e05011310ec1Neerav Parikh#endif /* CONFIG_I40E_DCB */
718beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Kellervoid i40e_ptp_rx_hang(struct i40e_vsi *vsi);
719beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Kellervoid i40e_ptp_tx_hwtstamp(struct i40e_pf *pf);
720beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Kellervoid i40e_ptp_rx_hwtstamp(struct i40e_pf *pf, struct sk_buff *skb, u8 index);
721beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Kellervoid i40e_ptp_set_increment(struct i40e_pf *pf);
722beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Kellerint i40e_ptp_set_ts_config(struct i40e_pf *pf, struct ifreq *ifr);
723beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Kellerint i40e_ptp_get_ts_config(struct i40e_pf *pf, struct ifreq *ifr);
724beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Kellervoid i40e_ptp_init(struct i40e_pf *pf);
725beb0dff1251db5214889ea8a122049ec3ae25e41Jacob Kellervoid i40e_ptp_stop(struct i40e_pf *pf);
7267daa6bf3294e518cf939830c1a8ec2a6a96204acJesse Brandeburg#endif /* _I40E_H_ */
727