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_RX_H
8 #define HINIC_RX_H
9 
10 #include <linux/types.h>
11 #include <linux/netdevice.h>
12 #include <linux/u64_stats_sync.h>
13 #include <linux/interrupt.h>
14 
15 #include "hinic_hw_qp.h"
16 
17 #define HINIC_RX_CSUM_OFFLOAD_EN	0xFFF
18 #define HINIC_RX_CSUM_HW_CHECK_NONE	BIT(7)
19 #define HINIC_RX_CSUM_IPSU_OTHER_ERR	BIT(8)
20 
21 struct hinic_rxq_stats {
22 	u64                     pkts;
23 	u64                     bytes;
24 
25 	struct u64_stats_sync   syncp;
26 };
27 
28 struct hinic_rxq {
29 	struct net_device       *netdev;
30 	struct hinic_rq         *rq;
31 
32 	struct hinic_rxq_stats  rxq_stats;
33 
34 	char                    *irq_name;
35 
36 	struct napi_struct      napi;
37 };
38 
39 void hinic_rxq_clean_stats(struct hinic_rxq *rxq);
40 
41 void hinic_rxq_get_stats(struct hinic_rxq *rxq, struct hinic_rxq_stats *stats);
42 
43 int hinic_init_rxq(struct hinic_rxq *rxq, struct hinic_rq *rq,
44 		   struct net_device *netdev);
45 
46 void hinic_clean_rxq(struct hinic_rxq *rxq);
47 
48 #endif
49