GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / net / ethernet / huawei / hinic / hinic_tx.h
1 /*
2  * Huawei HiNIC PCI Express Linux driver
3  * Copyright(c) 2017 Huawei Technologies Co., Ltd
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * for more details.
13  *
14  */
15
16 #ifndef HINIC_TX_H
17 #define HINIC_TX_H
18
19 #include <linux/types.h>
20 #include <linux/netdevice.h>
21 #include <linux/skbuff.h>
22 #include <linux/u64_stats_sync.h>
23
24 #include "hinic_common.h"
25 #include "hinic_hw_qp.h"
26
27 struct hinic_txq_stats {
28         u64     pkts;
29         u64     bytes;
30         u64     tx_busy;
31         u64     tx_wake;
32         u64     tx_dropped;
33
34         struct u64_stats_sync   syncp;
35 };
36
37 struct hinic_txq {
38         struct net_device       *netdev;
39         struct hinic_sq         *sq;
40
41         struct hinic_txq_stats  txq_stats;
42
43         int                     max_sges;
44         struct hinic_sge        *sges;
45         struct hinic_sge        *free_sges;
46
47         char                    *irq_name;
48         struct napi_struct      napi;
49 };
50
51 void hinic_txq_clean_stats(struct hinic_txq *txq);
52
53 void hinic_txq_get_stats(struct hinic_txq *txq, struct hinic_txq_stats *stats);
54
55 netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
56
57 int hinic_init_txq(struct hinic_txq *txq, struct hinic_sq *sq,
58                    struct net_device *netdev);
59
60 void hinic_clean_txq(struct hinic_txq *txq);
61
62 #endif