提交 6cb2e756 编写于 作者: X Xue 提交者: Xie XiuQi

net: hinic: Add NIC Layer

driver inclusion
category:feature
bugzilla:4472
CVE:NA
------------------------------------------------------------------

Add NIC Layer support, include:
1. register net device to the kernel
2. implement all the hooks of the 'struct net_device_ops'
3. etc.
Reviewed-by: NChiqijun <chiqijun@huawei.com>
Signed-off-by: NXue <xuechaojing@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 746ea359
...@@ -6,4 +6,6 @@ hinic-y := hinic_nic_cfg.o hinic_nic_io.o hinic_nic_dbg.o \ ...@@ -6,4 +6,6 @@ hinic-y := hinic_nic_cfg.o hinic_nic_io.o hinic_nic_dbg.o \
hinic_wq.o hinic_cmdq.o hinic_hwdev.o hinic_cfg.o \ hinic_wq.o hinic_cmdq.o hinic_hwdev.o hinic_cfg.o \
ossl_knl_linux.o \ ossl_knl_linux.o \
hinic_sml_counter.o hinic_sml_lt.o \ hinic_sml_counter.o hinic_sml_lt.o \
hinic_multi_host_mgmt.o hinic_multi_host_mgmt.o hinic_main.o hinic_lld.o \
hinic_qp.o hinic_rx.o hinic_tx.o hinic_dbgtool_knl.o \
hinic_nictool.o hinic_sriov.o hinic_dcb.o
此差异已折叠。
/* SPDX-License-Identifier: GPL-2.0*/
/* Huawei HiNIC PCI Express Linux driver
* Copyright(c) 2017 Huawei Technologies Co., Ltd
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
*/
#ifndef __DBGTOOL_KNL_H__
#define __DBGTOOL_KNL_H__
#define DBG_TOOL_MAGIC 'w'
/* dbgtool command type */
/* You can add the required dbgtool through these commands
* can invoke all X86 kernel mode driver interface
*/
typedef enum {
DBGTOOL_CMD_API_RD = 0,
DBGTOOL_CMD_API_WR,
DBGTOOL_CMD_FFM_RD,
DBGTOOL_CMD_FFM_CLR,
DBGTOOL_CMD_PF_DEV_INFO_GET,
DBGTOOL_CMD_MSG_2_UP,
DBGTOOL_CMD_FREE_MEM,
DBGTOOL_CMD_NUM
} dbgtool_cmd;
struct api_cmd_rd {
u32 pf_id;
u8 dest;
u8 *cmd;
u16 size;
void *ack;
u16 ack_size;
};
struct api_cmd_wr {
u32 pf_id;
u8 dest;
u8 *cmd;
u16 size;
};
struct pf_dev_info {
u64 bar0_size;
u8 bus;
u8 slot;
u8 func;
u64 phy_addr;
};
/* Interrupt at most records, interrupt will be recorded in the FFM*/
#define FFM_RECORD_NUM_MAX 64
struct ffm_intr_tm_info {
u8 node_id;
/* error level of the interrupt source */
u8 err_level;
/* Classification by interrupt source properties */
u16 err_type;
u32 err_csr_addr;
u32 err_csr_value;
u8 sec; /* second*/
u8 min; /* minute */
u8 hour; /* hour */
u8 mday; /* day */
u8 mon; /* month */
u16 year; /* year */
};
struct ffm_record_info {
u32 ffm_num;
struct ffm_intr_tm_info ffm[FFM_RECORD_NUM_MAX];
};
struct msg_2_up {
u8 pf_id; /* which pf sends messages to the up*/
u8 mod;
u8 cmd;
void *buf_in;
u16 in_size;
void *buf_out;
u16 *out_size;
};
struct dbgtool_param {
union {
struct api_cmd_rd api_rd;
struct api_cmd_wr api_wr;
struct pf_dev_info *dev_info;
struct ffm_record_info *ffm_rd;
struct msg_2_up msg2up;
} param;
char chip_name[16];
};
#ifndef MAX_CARD_NUM
#define MAX_CARD_NUM 64
#endif
#define DBGTOOL_PAGE_ORDER 10
int dbgtool_knl_init(void *vhwdev, void *chip_node);
void dbgtool_knl_deinit(void *vhwdev, void *chip_node);
int hinic_mem_mmap(struct file *filp, struct vm_area_struct *vma);
void chipif_get_all_pf_dev_info(struct pf_dev_info *dev_info, int card_id,
void **g_func_handle_array);
long dbgtool_knl_free_mem(int id);
#endif
此差异已折叠。
/* SPDX-License-Identifier: GPL-2.0*/
/* Huawei HiNIC PCI Express Linux driver
* Copyright(c) 2017 Huawei Technologies Co., Ltd
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
*/
#ifndef HINIC_DCB_H_
#define HINIC_DCB_H_
#define HINIC_DCB_CFG_TX 0
#define HINIC_DCB_CFG_RX 1
enum HINIC_DCB_FLAGS {
HINIC_DCB_UP_COS_SETTING,
HINIC_DCB_TRAFFIC_STOPPED,
};
extern const struct dcbnl_rtnl_ops hinic_dcbnl_ops;
u8 hinic_dcb_get_tc(struct hinic_dcb_config *dcb_cfg, int dir, u8 up);
int hinic_dcb_init(struct hinic_nic_dev *nic_dev);
int hinic_dcb_reset_hw_config(struct hinic_nic_dev *nic_dev);
int hinic_setup_tc(struct net_device *netdev, u8 tc);
void hinic_configure_dcb(struct net_device *netdev);
int hinic_set_cos_up_map(struct hinic_nic_dev *nic_dev, u8 *cos_up);
int hinic_get_num_cos(struct hinic_nic_dev *nic_dev, u8 *num_cos);
int hinic_get_cos_up_map(struct hinic_nic_dev *nic_dev,
u8 *num_cos, u8 *cos_up);
#endif
...@@ -1880,7 +1880,7 @@ static int mapping_bar(struct pci_dev *pdev, struct hinic_pcidev *pci_adapter) ...@@ -1880,7 +1880,7 @@ static int mapping_bar(struct pci_dev *pdev, struct hinic_pcidev *pci_adapter)
/* arm do not support call ioremap_wc(), refer to */ /* arm do not support call ioremap_wc(), refer to */
pci_adapter->dwqe_mapping = __ioremap(dwqe_addr, HINIC_DB_DWQE_SIZE, pci_adapter->dwqe_mapping = __ioremap(dwqe_addr, HINIC_DB_DWQE_SIZE,
__pgprot(PROT_DEVICE_NGNRNE)); __pgprot(PROT_DEVICE_nGnRnE));
if (!pci_adapter->dwqe_mapping) { if (!pci_adapter->dwqe_mapping) {
sdk_err(&pci_adapter->pcidev->dev, "Failed to io_mapping_create_wc\n"); sdk_err(&pci_adapter->pcidev->dev, "Failed to io_mapping_create_wc\n");
goto mapping_dwqe_err; goto mapping_dwqe_err;
......
/* SPDX-License-Identifier: GPL-2.0*/
/* Huawei HiNIC PCI Express Linux driver
* Copyright(c) 2017 Huawei Technologies Co., Ltd
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
*/
#ifndef HINIC_NIC_DEV_H
#define HINIC_NIC_DEV_H
#include <linux/netdevice.h>
#include <linux/semaphore.h>
#include <linux/types.h>
#include <linux/bitops.h>
#include "ossl_knl.h"
#include "hinic_nic_io.h"
#include "hinic_nic_cfg.h"
#include "hinic_tx.h"
#include "hinic_rx.h"
#define HINIC_DRV_NAME "hinic"
#define HINIC_CHIP_NAME "hinic"
#define HINIC_DRV_VERSION "1.6.2.2"
struct vf_data_storage;
#define HINIC_FUNC_IS_VF(hwdev) (hinic_func_type(hwdev) == TYPE_VF)
enum hinic_flags {
HINIC_INTF_UP,
HINIC_MAC_FILTER_CHANGED,
HINIC_LP_TEST,
HINIC_RSS_ENABLE,
HINIC_DCB_ENABLE,
HINIC_BP_ENABLE,
HINIC_SAME_RXTX,
HINIC_INTR_ADAPT,
};
#define RX_BUFF_NUM_PER_PAGE 2
#define HINIC_MAX_MAC_NUM 3
#define LP_PKT_CNT 64
struct hinic_mac_addr {
u8 addr[ETH_ALEN];
u16 state;
};
enum hinic_rx_mode_state {
HINIC_HW_PROMISC_ON,
HINIC_HW_ALLMULTI_ON,
HINIC_PROMISC_FORCE_ON,
HINIC_ALLMULTI_FORCE_ON,
};
enum mac_filter_state {
HINIC_MAC_WAIT_HW_SYNC,
HINIC_MAC_HW_SYNCED,
HINIC_MAC_WAIT_HW_UNSYNC,
HINIC_MAC_HW_UNSYNCED,
};
struct hinic_mac_filter {
struct list_head list;
u8 addr[ETH_ALEN];
unsigned long state;
};
/* TC bandwidth allocation per direction */
struct hinic_tc_attr {
u8 pg_id; /* Priority Group(PG) ID */
u8 bw_pct; /* % of PG's bandwidth */
u8 up_map; /* User Priority to Traffic Class mapping */
u8 prio_type;
};
/* User priority configuration */
struct hinic_tc_cfg {
struct hinic_tc_attr path[2]; /* One each for Tx/Rx */
bool pfc_en;
};
struct hinic_dcb_config {
u8 pg_tcs;
u8 pfc_tcs;
bool pfc_state;
struct hinic_tc_cfg tc_cfg[HINIC_DCB_TC_MAX];
u8 bw_pct[2][HINIC_DCB_PG_MAX]; /* One each for Tx/Rx */
};
enum hinic_intr_flags {
HINIC_INTR_ON,
};
struct hinic_irq {
struct net_device *netdev;
/* IRQ corresponding index number */
u16 msix_entry_idx;
u32 irq_id; /* The IRQ number from OS */
char irq_name[IFNAMSIZ + 16];
struct napi_struct napi;
cpumask_t affinity_mask;
struct hinic_txq *txq;
struct hinic_rxq *rxq;
unsigned long intr_flag;
};
struct hinic_intr_coal_info {
u8 pending_limt;
u8 coalesce_timer_cfg;
u8 resend_timer_cfg;
u64 pkt_rate_low;
u8 rx_usecs_low;
u8 rx_pending_limt_low;
u64 pkt_rate_high;
u8 rx_usecs_high;
u8 rx_pending_limt_high;
u8 user_set_intr_coal_flag;
};
#define HINIC_NIC_STATS_INC(nic_dev, field) \
{ \
u64_stats_update_begin(&(nic_dev)->stats.syncp); \
(nic_dev)->stats.field++; \
u64_stats_update_end(&(nic_dev)->stats.syncp); \
}
struct hinic_nic_stats {
u64 netdev_tx_timeout;
/* Subdivision statistics show in private tool */
u64 tx_carrier_off_drop;
u64 tx_invalid_qid;
#ifdef HAVE_NDO_GET_STATS64
struct u64_stats_sync syncp;
#else
struct u64_stats_sync_empty syncp;
#endif
};
struct hinic_nic_dev {
struct pci_dev *pdev;
struct net_device *netdev;
void *hwdev;
int poll_weight;
unsigned long *vlan_bitmap;
u16 num_qps;
u16 max_qps;
u32 msg_enable;
unsigned long flags;
u16 sq_depth;
u16 rq_depth;
/* mapping from priority */
u8 sq_cos_mapping[HINIC_DCB_UP_MAX];
u8 default_cos_id;
struct hinic_txq *txqs;
struct hinic_rxq *rxqs;
struct nic_service_cap nic_cap;
struct irq_info *qps_irq_info;
struct hinic_irq *irq_cfg;
struct work_struct rx_mode_work;
struct delayed_work moderation_task;
struct workqueue_struct *workq;
struct list_head uc_filter_list;
struct list_head mc_filter_list;
unsigned long rx_mod_state;
int netdev_uc_cnt;
int netdev_mc_cnt;
int lb_test_rx_idx;
int lb_pkt_len;
u8 *lb_test_rx_buf;
u8 rss_tmpl_idx;
u16 num_rss;
u16 rss_limit;
u8 rss_hash_engine;
struct nic_rss_type rss_type;
u8 *rss_hkey_user;
/* hkey in big endian */
u32 *rss_hkey_user_be;
u32 *rss_indir_user;
u8 dcbx_cap;
u32 dcb_changes;
u8 max_cos;
u8 up_valid_bitmap;
u8 up_cos[HINIC_DCB_UP_MAX];
struct hinic_dcb_config dcb_cfg;
struct hinic_dcb_config tmp_dcb_cfg;
struct hinic_dcb_config save_dcb_cfg;
unsigned long dcb_flags;
int disable_port_cnt;
/* lock for disable or enable traffic flow */
struct semaphore dcb_sem;
u16 bp_lower_thd;
u16 bp_upper_thd;
bool heart_status;
struct hinic_intr_coal_info *intr_coalesce;
unsigned long last_moder_jiffies;
u32 adaptive_rx_coal;
u8 intr_coal_set_flag;
u32 his_link_speed;
/* interrupt coalesce must be different in virtual machine */
bool in_vm;
#ifndef HAVE_NETDEV_STATS_IN_NETDEV
struct net_device_stats net_stats;
#endif
struct hinic_nic_stats stats;
/* lock for nic resource */
struct mutex nic_mutex;
bool force_port_disable;
struct semaphore port_state_sem;
u8 link_status;
struct hinic_environment_info env_info;
struct hinic_adaptive_cfg adaptive_cfg;
/* pangea cpu affinity setting */
bool force_affinity;
cpumask_t affinity_mask;
u32 lro_replenish_thld;
u16 rx_buff_len;
u32 page_order;
};
extern struct hinic_uld_info nic_uld_info;
int hinic_open(struct net_device *netdev);
int hinic_close(struct net_device *netdev);
int nic_ioctl(void *uld_dev, u32 cmd, void *buf_in,
u32 in_size, void *buf_out, u32 *out_size);
int hinic_force_port_disable(struct hinic_nic_dev *nic_dev);
int hinic_force_set_port_state(struct hinic_nic_dev *nic_dev, bool enable);
int hinic_maybe_set_port_state(struct hinic_nic_dev *nic_dev, bool enable);
void hinic_link_status_change(struct hinic_nic_dev *nic_dev, bool status);
int hinic_disable_func_rss(struct hinic_nic_dev *nic_dev);
int hinic_enable_func_rss(struct hinic_nic_dev *nic_dev);
#define hinic_msg(level, nic_dev, msglvl, format, arg...) \
do { \
if ((nic_dev)->netdev && (nic_dev)->netdev->reg_state \
== NETREG_REGISTERED) \
nicif_##level((nic_dev), msglvl, (nic_dev)->netdev, \
format, ## arg); \
else \
nic_##level(&(nic_dev)->pdev->dev, \
format, ## arg); \
} while (0)
#define hinic_info(nic_dev, msglvl, format, arg...) \
hinic_msg(info, nic_dev, msglvl, format, ## arg)
#define hinic_warn(nic_dev, msglvl, format, arg...) \
hinic_msg(warn, nic_dev, msglvl, format, ## arg)
#define hinic_err(nic_dev, msglvl, format, arg...) \
hinic_msg(err, nic_dev, msglvl, format, ## arg)
#endif
此差异已折叠。
/* SPDX-License-Identifier: GPL-2.0*/
/* Huawei HiNIC PCI Express Linux driver
* Copyright(c) 2017 Huawei Technologies Co., Ltd
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
*/
#ifndef HINIC_NICTOOL_H_
#define HINIC_NICTOOL_H_
#include "hinic_dfx_def.h"
#ifndef IFNAMSIZ
#define IFNAMSIZ 16
#endif
/* completion timeout interval, unit is jiffies*/
#define UP_COMP_TIME_OUT_VAL 10000U
struct sm_in_st {
int node;
int id;
int instance;
};
struct sm_out_st {
u64 val1;
u64 val2;
};
struct up_log_msg_st {
u32 rd_len;
u32 addr;
};
struct csr_write_st {
u32 rd_len;
u32 addr;
u8 *data;
};
struct ipsurx_stats_info {
u32 addr;
u32 rd_cnt;
};
struct ucode_cmd_st {
union {
struct {
u32 comm_mod_type:8;
u32 ucode_cmd_type:4;
u32 cmdq_ack_type:3;
u32 ucode_imm:1;
u32 len:16;
} ucode_db;
u32 value;
};
};
struct up_cmd_st {
union {
struct {
u32 comm_mod_type:8;
u32 chipif_cmd:8;
u32 up_api_type:16;
} up_db;
u32 value;
};
};
#define API_CMD 0x1
#define API_CHAIN 0x2
struct msg_module {
char device_name[IFNAMSIZ];
unsigned int module;
union {
u32 msg_formate;
struct ucode_cmd_st ucode_cmd;
struct up_cmd_st up_cmd;
};
struct {
u32 inBuffLen;
u32 outBuffLen;
} lenInfo;
u32 res;
void *in_buff;
void *out_buf;
};
#define MAX_VER_INFO_LEN 128
struct drv_version_info {
char ver[MAX_VER_INFO_LEN];
};
struct chip_fault_stats {
int offset;
u8 chip_faults[MAX_DRV_BUF_SIZE];
};
struct hinic_wqe_info {
int q_id;
void *slq_handle;
unsigned int wqe_id;
};
struct hinic_cos_up_map {
u8 cos_up[HINIC_DCB_UP_MAX];
u8 num_cos;
};
struct hinic_tx_hw_page {
u64 phy_addr;
u64 *map_addr;
};
struct hinic_dbg_sq_info {
u16 q_id;
u16 pi;
u16 ci;/* sw_ci */
u16 fi;/* hw_ci */
u32 q_depth;
u16 pi_reverse;/* TODO: what is this? */
u16 weqbb_size;
u8 priority;
u16 *ci_addr;
u64 cla_addr;
void *slq_handle;
/* TODO: NIC don't use direct wqe */
struct hinic_tx_hw_page direct_wqe;
struct hinic_tx_hw_page db_addr;
u32 pg_idx;
u32 glb_sq_id;
};
struct hinic_dbg_rq_info {
u16 q_id;
u16 glb_rq_id;
u16 hw_pi;
u16 ci; /* sw_ci */
u16 sw_pi;
u16 wqebb_size;
u16 q_depth;
u16 buf_len;
void *slq_handle;
u64 ci_wqe_page_addr;
u64 ci_cla_tbl_addr;
u16 msix_idx;
u32 msix_vector;
};
#ifndef BUSINFO_LEN
#define BUSINFO_LEN (32)
#endif
struct pf_info {
char name[IFNAMSIZ];
char bus_info[BUSINFO_LEN];
u32 pf_type;
};
#ifndef MAX_SIZE
#define MAX_SIZE (16)
#endif
struct card_info {
struct pf_info pf[MAX_SIZE];
u32 pf_num;
};
struct nic_card_id {
u32 id[MAX_SIZE];
u32 num;
};
struct func_pdev_info {
u64 bar0_phy_addr;
u64 bar0_size;
u64 rsvd1[4];
};
struct hinic_card_func_info {
u32 num_pf;
u32 rsvd0;
u64 usr_api_phy_addr;
struct func_pdev_info pdev_info[MAX_SIZE];
};
#ifndef NIC_UP_CMD_UPDATE_FW
#define NIC_UP_CMD_UPDATE_FW (114)
#endif
#ifndef MAX_CARD_NUM
#define MAX_CARD_NUM (64)
#endif
extern void *g_card_node_array[MAX_CARD_NUM];
extern void *g_card_vir_addr[MAX_CARD_NUM];
extern u64 g_card_phy_addr[MAX_CARD_NUM];
extern int card_id;
struct hinic_nic_loop_mode {
u32 loop_mode;
u32 loop_ctrl;
};
struct hinic_nic_poll_weight {
int poll_weight;
};
enum hinic_homologues_state {
HINIC_HOMOLOGUES_OFF = 0,
HINIC_HOMOLOGUES_ON = 1,
};
struct hinic_homologues {
enum hinic_homologues_state homo_state;
};
struct hinic_pf_info {
u32 isvalid;
u32 pf_id;
};
int nictool_k_init(void);
void nictool_k_uninit(void);
#endif
/* SPDX-License-Identifier: GPL-2.0*/
/* Huawei HiNIC PCI Express Linux driver
* Copyright(c) 2017 Huawei Technologies Co., Ltd
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
*/
#ifndef HINIC_PCI_ID_TBL_H
#define HINIC_PCI_ID_TBL_H
#define PCI_VENDOR_ID_HUAWEI 0x19e5
#define HINIC_DEV_ID_1822_PF 0x1822
#define HINIC_DEV_ID_1822_VF 0x375E
#define HINIC_DEV_ID_1822_VF_HV 0x379E
#define HINIC_DEV_ID_1822_SMTIO 0x020B
#define HINIC_DEV_ID_1822_PANGEA_100GE 0x0208
#define HINIC_DEV_ID_1822_PANGEA_TP_10GE 0x0204
#define HINIC_DEV_ID_1822_KR_40GE 0x020D
#define HINIC_DEV_ID_1822_KR_100GE 0x0205
#define HINIC_DEV_ID_1822_KR_25GE 0x0210
#define HINIC_DEV_ID_1822_MULTI_HOST 0x0211
#define HINIC_DEV_ID_1822_100GE 0x0200
#define HINIC_DEV_ID_1822_100GE_MULTI_HOST 0x0201
#define HIFC_DEV_ID_1822_8G 0x0212
#define HIFC_DEV_ID_1822_16G 0x0203
#define HIFC_DEV_ID_1822_32G 0x0202
#define HIFC_DEV_ID_1822_SMTIO 0x020C
#endif
此差异已折叠。
此差异已折叠。
此差异已折叠。
/* SPDX-License-Identifier: GPL-2.0*/
/* Huawei HiNIC PCI Express Linux driver
* Copyright(c) 2017 Huawei Technologies Co., Ltd
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
*/
#ifndef HINIC_SRIOV_H
#define HINIC_SRIOV_H
#if !(defined(HAVE_SRIOV_CONFIGURE) || defined(HAVE_RHEL6_SRIOV_CONFIGURE))
ssize_t hinic_sriov_totalvfs_show(struct device *dev,
struct device_attribute *attr, char *buf);
ssize_t hinic_sriov_numvfs_show(struct device *dev,
struct device_attribute *attr, char *buf);
ssize_t hinic_sriov_numvfs_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count);
#endif /* !(HAVE_SRIOV_CONFIGURE || HAVE_RHEL6_SRIOV_CONFIGURE) */
enum hinic_sriov_state {
HINIC_SRIOV_DISABLE,
HINIC_SRIOV_ENABLE,
HINIC_FUNC_REMOVE,
};
struct hinic_sriov_info {
struct pci_dev *pdev;
void *hwdev;
bool sriov_enabled;
unsigned int num_vfs;
unsigned long state;
};
int hinic_pci_sriov_disable(struct pci_dev *dev);
int hinic_pci_sriov_enable(struct pci_dev *dev, int num_vfs);
int hinic_pci_sriov_configure(struct pci_dev *dev, int num_vfs);
#ifdef IFLA_VF_MAX
int hinic_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac);
#ifdef IFLA_VF_VLAN_INFO_MAX
int hinic_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos,
__be16 vlan_proto);
#else
int hinic_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos);
#endif
int hinic_ndo_get_vf_config(struct net_device *netdev, int vf,
struct ifla_vf_info *ivi);
int hinic_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link);
#ifdef HAVE_NDO_SET_VF_MIN_MAX_TX_RATE
int hinic_ndo_set_vf_bw(struct net_device *netdev,
int vf, int min_tx_rate, int max_tx_rate);
#else
int hinic_ndo_set_vf_bw(struct net_device *netdev, int vf, int max_tx_rate);
#endif /* HAVE_NDO_SET_VF_MIN_MAX_TX_RATE */
#endif
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册