New upstream version 18.08
[deb_dpdk.git] / drivers / net / cxgbe / cxgbe.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2018 Chelsio Communications.
3  * All rights reserved.
4  */
5
6 #ifndef _CXGBE_H_
7 #define _CXGBE_H_
8
9 #include "common.h"
10 #include "t4_regs.h"
11
12 #define CXGBE_MIN_RING_DESC_SIZE      128  /* Min TX/RX descriptor ring size */
13 #define CXGBE_MAX_RING_DESC_SIZE      4096 /* Max TX/RX descriptor ring size */
14
15 #define CXGBE_DEFAULT_TX_DESC_SIZE    1024 /* Default TX ring size */
16 #define CXGBE_DEFAULT_RX_DESC_SIZE    1024 /* Default RX ring size */
17
18 #define CXGBE_MIN_RX_BUFSIZE ETHER_MIN_MTU /* min buf size */
19 #define CXGBE_MAX_RX_PKTLEN (9000 + ETHER_HDR_LEN + ETHER_CRC_LEN) /* max pkt */
20
21 /* Max poll time is 100 * 100msec = 10 sec */
22 #define CXGBE_LINK_STATUS_POLL_MS 100 /* 100ms */
23 #define CXGBE_LINK_STATUS_POLL_CNT 100 /* Max number of times to poll */
24
25 #define CXGBE_DEFAULT_RSS_KEY_LEN     40 /* 320-bits */
26 #define CXGBE_RSS_HF_IPV4_MASK (ETH_RSS_IPV4 | ETH_RSS_FRAG_IPV4 | \
27                                 ETH_RSS_NONFRAG_IPV4_OTHER)
28 #define CXGBE_RSS_HF_IPV6_MASK (ETH_RSS_IPV6 | ETH_RSS_FRAG_IPV6 | \
29                                 ETH_RSS_NONFRAG_IPV6_OTHER | \
30                                 ETH_RSS_IPV6_EX)
31 #define CXGBE_RSS_HF_TCP_IPV6_MASK (ETH_RSS_NONFRAG_IPV6_TCP | \
32                                     ETH_RSS_IPV6_TCP_EX)
33 #define CXGBE_RSS_HF_UDP_IPV6_MASK (ETH_RSS_NONFRAG_IPV6_UDP | \
34                                     ETH_RSS_IPV6_UDP_EX)
35 #define CXGBE_RSS_HF_ALL (ETH_RSS_IP | ETH_RSS_TCP | ETH_RSS_UDP)
36
37 #define CXGBE_DEVARG_KEEP_OVLAN "keep_ovlan"
38 #define CXGBE_DEVARG_FORCE_LINK_UP "force_link_up"
39
40 bool force_linkup(struct adapter *adap);
41 int cxgbe_probe(struct adapter *adapter);
42 int cxgbevf_probe(struct adapter *adapter);
43 void cxgbe_get_speed_caps(struct port_info *pi, u32 *speed_caps);
44 int cxgbe_set_link_status(struct port_info *pi, bool status);
45 int cxgbe_up(struct adapter *adap);
46 int cxgbe_down(struct port_info *pi);
47 void cxgbe_close(struct adapter *adapter);
48 void cxgbe_stats_get(struct port_info *pi, struct port_stats *stats);
49 void cxgbevf_stats_get(struct port_info *pi, struct port_stats *stats);
50 void cxgbe_stats_reset(struct port_info *pi);
51 int cxgbe_poll_for_completion(struct sge_rspq *q, unsigned int us,
52                               unsigned int cnt, struct t4_completion *c);
53 int link_start(struct port_info *pi);
54 void init_rspq(struct adapter *adap, struct sge_rspq *q, unsigned int us,
55                unsigned int cnt, unsigned int size, unsigned int iqe_size);
56 int setup_sge_fwevtq(struct adapter *adapter);
57 int setup_sge_ctrl_txq(struct adapter *adapter);
58 void cfg_queues(struct rte_eth_dev *eth_dev);
59 int cfg_queue_count(struct rte_eth_dev *eth_dev);
60 int init_rss(struct adapter *adap);
61 int setup_rss(struct port_info *pi);
62 void cxgbe_enable_rx_queues(struct port_info *pi);
63 void print_port_info(struct adapter *adap);
64 void print_adapter_info(struct adapter *adap);
65 int cxgbe_get_devargs(struct rte_devargs *devargs, const char *key);
66 void configure_max_ethqsets(struct adapter *adapter);
67
68 #endif /* _CXGBE_H_ */