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 #define HINIC_RX_CSUM_OFFLOAD_EN	0xFFF
27 #define HINIC_RX_CSUM_HW_CHECK_NONE	BIT(7)
28 #define HINIC_RX_CSUM_IPSU_OTHER_ERR	BIT(8)
29 
30 struct hinic_rxq_stats {
31 	u64                     pkts;
32 	u64                     bytes;
33 
34 	struct u64_stats_sync   syncp;
35 };
36 
37 struct hinic_rxq {
38 	struct net_device       *netdev;
39 	struct hinic_rq         *rq;
40 
41 	struct hinic_rxq_stats  rxq_stats;
42 
43 	char                    *irq_name;
44 
45 	struct napi_struct      napi;
46 };
47 
48 void hinic_rxq_clean_stats(struct hinic_rxq *rxq);
49 
50 void hinic_rxq_get_stats(struct hinic_rxq *rxq, struct hinic_rxq_stats *stats);
51 
52 int hinic_init_rxq(struct hinic_rxq *rxq, struct hinic_rq *rq,
53 		   struct net_device *netdev);
54 
55 void hinic_clean_rxq(struct hinic_rxq *rxq);
56 
57 #endif
58