18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Huawei HiNIC PCI Express Linux driver
48c2ecf20Sopenharmony_ci * Copyright(c) 2017 Huawei Technologies Co., Ltd
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef HINIC_TX_H
88c2ecf20Sopenharmony_ci#define HINIC_TX_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/types.h>
118c2ecf20Sopenharmony_ci#include <linux/netdevice.h>
128c2ecf20Sopenharmony_ci#include <linux/skbuff.h>
138c2ecf20Sopenharmony_ci#include <linux/u64_stats_sync.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include "hinic_common.h"
168c2ecf20Sopenharmony_ci#include "hinic_hw_qp.h"
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistruct hinic_txq_stats {
198c2ecf20Sopenharmony_ci	u64     pkts;
208c2ecf20Sopenharmony_ci	u64     bytes;
218c2ecf20Sopenharmony_ci	u64     tx_busy;
228c2ecf20Sopenharmony_ci	u64     tx_wake;
238c2ecf20Sopenharmony_ci	u64     tx_dropped;
248c2ecf20Sopenharmony_ci	u64	big_frags_pkts;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	struct u64_stats_sync   syncp;
278c2ecf20Sopenharmony_ci};
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistruct hinic_txq {
308c2ecf20Sopenharmony_ci	struct net_device       *netdev;
318c2ecf20Sopenharmony_ci	struct hinic_sq         *sq;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci	struct hinic_txq_stats  txq_stats;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	int                     max_sges;
368c2ecf20Sopenharmony_ci	struct hinic_sge        *sges;
378c2ecf20Sopenharmony_ci	struct hinic_sge        *free_sges;
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci	char                    *irq_name;
408c2ecf20Sopenharmony_ci	struct napi_struct      napi;
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_civoid hinic_txq_clean_stats(struct hinic_txq *txq);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_civoid hinic_txq_get_stats(struct hinic_txq *txq, struct hinic_txq_stats *stats);
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_cinetdev_tx_t hinic_lb_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_cinetdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciint hinic_init_txq(struct hinic_txq *txq, struct hinic_sq *sq,
528c2ecf20Sopenharmony_ci		   struct net_device *netdev);
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_civoid hinic_clean_txq(struct hinic_txq *txq);
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#endif
57