xref: /linux/drivers/net/ethernet/huawei/hinic/hinic_rx.h (revision 58f6259b7a08f8d47d4629609703d358b042f0fd)
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 	u64			errors;
25 	u64			csum_errors;
26 	u64			other_errors;
27 	u64			alloc_skb_err;
28 	struct u64_stats_sync   syncp;
29 };
30 
31 struct hinic_rxq {
32 	struct net_device       *netdev;
33 	struct hinic_rq         *rq;
34 
35 	struct hinic_rxq_stats  rxq_stats;
36 
37 	char                    *irq_name;
38 	u16			buf_len;
39 	u32			rx_buff_shift;
40 
41 	struct napi_struct      napi;
42 };
43 
44 void hinic_rxq_get_stats(struct hinic_rxq *rxq, struct hinic_rxq_stats *stats);
45 
46 int hinic_init_rxq(struct hinic_rxq *rxq, struct hinic_rq *rq,
47 		   struct net_device *netdev);
48 
49 void hinic_clean_rxq(struct hinic_rxq *rxq);
50 
51 #endif
52