summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/huawei/hinic3/hinic3_hw_cfg.h
blob: e017b1ae9f0544f088302370822a2f2035344da7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved. */

#ifndef _HINIC3_HW_CFG_H_
#define _HINIC3_HW_CFG_H_

#include <linux/mutex.h>
#include <linux/pci.h>

struct hinic3_hwdev;

struct hinic3_irq {
	u32  irq_id;
	u16  msix_entry_idx;
	bool allocated;
};

struct hinic3_irq_info {
	struct hinic3_irq *irq;
	u16               num_irq;
	/* device max irq number */
	u16               num_irq_hw;
	/* protect irq alloc and free */
	struct mutex      irq_mutex;
};

struct hinic3_nic_service_cap {
	u16 max_sqs;
};

/* Device capabilities */
struct hinic3_dev_cap {
	/* Bitmasks of services supported by device */
	u16                           supp_svcs_bitmap;
	/* Physical port */
	u8                            port_id;
	struct hinic3_nic_service_cap nic_svc_cap;
};

struct hinic3_cfg_mgmt_info {
	struct hinic3_irq_info irq_info;
	struct hinic3_dev_cap  cap;
};

int hinic3_alloc_irqs(struct hinic3_hwdev *hwdev, u16 num,
		      struct msix_entry *alloc_arr, u16 *act_num);
void hinic3_free_irq(struct hinic3_hwdev *hwdev, u32 irq_id);

bool hinic3_support_nic(struct hinic3_hwdev *hwdev);
u16 hinic3_func_max_qnum(struct hinic3_hwdev *hwdev);
u8 hinic3_physical_port_id(struct hinic3_hwdev *hwdev);

#endif