1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Huawei HiNIC PCI Express Linux driver
4  * Copyright(c) 2017 Huawei Technologies Co., Ltd
5  */
6 
7 #ifndef HINIC_TX_H
8 #define HINIC_TX_H
9 
10 #include <linux/types.h>
11 #include <linux/netdevice.h>
12 #include <linux/skbuff.h>
13 #include <linux/u64_stats_sync.h>
14 
15 #include "hinic_common.h"
16 #include "hinic_hw_qp.h"
17 
18 struct hinic_txq_stats {
19 	u64     pkts;
20 	u64     bytes;
21 	u64     tx_busy;
22 	u64     tx_wake;
23 	u64     tx_dropped;
24 
25 	struct u64_stats_sync   syncp;
26 };
27 
28 struct hinic_txq {
29 	struct net_device       *netdev;
30 	struct hinic_sq         *sq;
31 
32 	struct hinic_txq_stats  txq_stats;
33 
34 	int                     max_sges;
35 	struct hinic_sge        *sges;
36 	struct hinic_sge        *free_sges;
37 
38 	char                    *irq_name;
39 	struct napi_struct      napi;
40 };
41 
42 void hinic_txq_clean_stats(struct hinic_txq *txq);
43 
44 void hinic_txq_get_stats(struct hinic_txq *txq, struct hinic_txq_stats *stats);
45 
46 netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
47 
48 int hinic_init_txq(struct hinic_txq *txq, struct hinic_sq *sq,
49 		   struct net_device *netdev);
50 
51 void hinic_clean_txq(struct hinic_txq *txq);
52 
53 #endif
54