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>
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
/* 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
|