xref: /linux/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_mqprio.h (revision 906fd46a65383cd639e5eec72a047efc33045d86)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (C) 2019 Chelsio Communications.  All rights reserved. */
3 
4 #ifndef __CXGB4_TC_MQPRIO_H__
5 #define __CXGB4_TC_MQPRIO_H__
6 
7 #include <net/pkt_sched.h>
8 
9 #define CXGB4_EOSW_TXQ_DEFAULT_DESC_NUM 128
10 
11 #define CXGB4_EOHW_TXQ_DEFAULT_DESC_NUM 1024
12 
13 #define CXGB4_EOHW_RXQ_DEFAULT_DESC_NUM 1024
14 #define CXGB4_EOHW_RXQ_DEFAULT_DESC_SIZE 64
15 #define CXGB4_EOHW_RXQ_DEFAULT_INTR_USEC 5
16 #define CXGB4_EOHW_RXQ_DEFAULT_PKT_CNT 8
17 
18 #define CXGB4_EOHW_FLQ_DEFAULT_DESC_NUM 72
19 
20 #define CXGB4_FLOWC_WAIT_TIMEOUT (5 * HZ)
21 
22 enum cxgb4_mqprio_state {
23 	CXGB4_MQPRIO_STATE_DISABLED = 0,
24 	CXGB4_MQPRIO_STATE_ACTIVE,
25 };
26 
27 struct cxgb4_tc_port_mqprio {
28 	enum cxgb4_mqprio_state state; /* Current MQPRIO offload state */
29 	struct tc_mqprio_qopt_offload mqprio; /* MQPRIO offload params */
30 	struct sge_eosw_txq *eosw_txq; /* Netdev SW Tx queue array */
31 	u8 tc_hwtc_map[TC_QOPT_MAX_QUEUE]; /* MQPRIO tc to hardware tc map */
32 };
33 
34 struct cxgb4_tc_mqprio {
35 	refcount_t refcnt; /* Refcount for adapter-wide resources */
36 	struct mutex mqprio_mutex; /* Lock for accessing MQPRIO info */
37 	struct cxgb4_tc_port_mqprio *port_mqprio; /* Per port MQPRIO info */
38 };
39 
40 int cxgb4_setup_tc_mqprio(struct net_device *dev,
41 			  struct tc_mqprio_qopt_offload *mqprio);
42 void cxgb4_mqprio_stop_offload(struct adapter *adap);
43 int cxgb4_init_tc_mqprio(struct adapter *adap);
44 void cxgb4_cleanup_tc_mqprio(struct adapter *adap);
45 #endif /* __CXGB4_TC_MQPRIO_H__ */
46