GNU Linux-libre 4.19.286-gnu1
[releases.git] / drivers / net / ethernet / huawei / hinic / hinic_common.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_COMMON_H
17 #define HINIC_COMMON_H
18
19 #include <linux/types.h>
20
21 #define UPPER_8_BITS(data)      (((data) >> 8) & 0xFF)
22 #define LOWER_8_BITS(data)      ((data) & 0xFF)
23
24 struct hinic_sge {
25         u32             hi_addr;
26         u32             lo_addr;
27         u32             len;
28 };
29
30 void hinic_cpu_to_be32(void *data, int len);
31
32 void hinic_be32_to_cpu(void *data, int len);
33
34 void hinic_set_sge(struct hinic_sge *sge, dma_addr_t addr, int len);
35
36 dma_addr_t hinic_sge_to_dma(struct hinic_sge *sge);
37
38 #endif