mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-01 06:39:05 +00:00

This is [1/3] part of hinic3 Ethernet driver initial submission. With this patch hinic3 is a valid kernel module but non-functional driver. The driver parts contained in this patch: Module initialization. PCI driver registration but with empty id_table. Auxiliary driver registration. Net device_ops registration but open/stop are empty stubs. tx/rx logic. All major data structures of the driver are fully introduced with the code that uses them but without their initialization code that requires management interface with the hw. Co-developed-by: Xin Guo <guoxin09@huawei.com> Signed-off-by: Xin Guo <guoxin09@huawei.com> Signed-off-by: Fan Gong <gongfan1@huawei.com> Co-developed-by: Gur Stavi <gur.stavi@huawei.com> Signed-off-by: Gur Stavi <gur.stavi@huawei.com> Link: https://patch.msgid.link/76a137ffdfe115c737c2c224f0c93b60ba53cc16.1747736586.git.gur.stavi@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
59 lines
1.4 KiB
C
59 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved. */
|
|
|
|
#ifndef _HINIC3_HWIF_H_
|
|
#define _HINIC3_HWIF_H_
|
|
|
|
#include <linux/build_bug.h>
|
|
#include <linux/spinlock_types.h>
|
|
|
|
struct hinic3_hwdev;
|
|
|
|
enum hinic3_func_type {
|
|
HINIC3_FUNC_TYPE_VF = 1,
|
|
};
|
|
|
|
struct hinic3_db_area {
|
|
unsigned long *db_bitmap_array;
|
|
u32 db_max_areas;
|
|
/* protect doorbell area alloc and free */
|
|
spinlock_t idx_lock;
|
|
};
|
|
|
|
struct hinic3_func_attr {
|
|
enum hinic3_func_type func_type;
|
|
u16 func_global_idx;
|
|
u16 global_vf_id_of_pf;
|
|
u16 num_irqs;
|
|
u16 num_sq;
|
|
u8 port_to_port_idx;
|
|
u8 pci_intf_idx;
|
|
u8 ppf_idx;
|
|
u8 num_aeqs;
|
|
u8 num_ceqs;
|
|
u8 msix_flex_en;
|
|
};
|
|
|
|
static_assert(sizeof(struct hinic3_func_attr) == 20);
|
|
|
|
struct hinic3_hwif {
|
|
u8 __iomem *cfg_regs_base;
|
|
u64 db_base_phy;
|
|
u64 db_dwqe_len;
|
|
u8 __iomem *db_base;
|
|
struct hinic3_db_area db_area;
|
|
struct hinic3_func_attr attr;
|
|
};
|
|
|
|
enum hinic3_msix_state {
|
|
HINIC3_MSIX_ENABLE,
|
|
HINIC3_MSIX_DISABLE,
|
|
};
|
|
|
|
void hinic3_set_msix_state(struct hinic3_hwdev *hwdev, u16 msix_idx,
|
|
enum hinic3_msix_state flag);
|
|
|
|
u16 hinic3_global_func_id(struct hinic3_hwdev *hwdev);
|
|
|
|
#endif
|