GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / net / ethernet / huawei / hinic / hinic_rx.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_RX_H
17 #define HINIC_RX_H
18
19 #include <linux/types.h>
20 #include <linux/netdevice.h>
21 #include <linux/u64_stats_sync.h>
22 #include <linux/interrupt.h>
23
24 #include "hinic_hw_qp.h"
25
26 struct hinic_rxq_stats {
27         u64                     pkts;
28         u64                     bytes;
29
30         struct u64_stats_sync   syncp;
31 };
32
33 struct hinic_rxq {
34         struct net_device       *netdev;
35         struct hinic_rq         *rq;
36
37         struct hinic_rxq_stats  rxq_stats;
38
39         char                    *irq_name;
40
41         struct tasklet_struct   rx_task;
42
43         struct napi_struct      napi;
44 };
45
46 void hinic_rxq_clean_stats(struct hinic_rxq *rxq);
47
48 void hinic_rxq_get_stats(struct hinic_rxq *rxq, struct hinic_rxq_stats *stats);
49
50 int hinic_init_rxq(struct hinic_rxq *rxq, struct hinic_rq *rq,
51                    struct net_device *netdev);
52
53 void hinic_clean_rxq(struct hinic_rxq *rxq);
54
55 #endif