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
18struct hinic_txq_stats {
19	u64     pkts;
20	u64     bytes;
21	u64     tx_busy;
22	u64     tx_wake;
23	u64     tx_dropped;
24	u64	big_frags_pkts;
25
26	struct u64_stats_sync   syncp;
27};
28
29struct hinic_txq {
30	struct net_device       *netdev;
31	struct hinic_sq         *sq;
32
33	struct hinic_txq_stats  txq_stats;
34
35	int                     max_sges;
36	struct hinic_sge        *sges;
37	struct hinic_sge        *free_sges;
38
39	char                    *irq_name;
40	struct napi_struct      napi;
41};
42
43void hinic_txq_get_stats(struct hinic_txq *txq, struct hinic_txq_stats *stats);
44
45netdev_tx_t hinic_lb_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
46
47netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
48
49int hinic_init_txq(struct hinic_txq *txq, struct hinic_sq *sq,
50		   struct net_device *netdev);
51
52void hinic_clean_txq(struct hinic_txq *txq);
53
54#endif
55