/* * Copyright (C) 2015 Cavium, Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License * as published by the Free Software Foundation. */#include<linux/module.h>#include<linux/interrupt.h>#include<linux/pci.h>#include<linux/etherdevice.h>#include<linux/of.h>#include<linux/if_vlan.h>#include"nic_reg.h"#include"nic.h"#include"q_struct.h"#include"thunder_bgx.h"#define DRV_NAME "thunder-nic"#define DRV_VERSION "1.0"structhw_info{u8bgx_cnt;u8chans_per_lmac;u8chans_per_bgx;/* Rx/Tx chans */u8chans_per_rgx;u8chans_per_lbk;u16cpi_cnt;u16rssi_cnt;u16rss_ind_tbl_size;u16tl4_cnt;u16tl3_cnt;u8tl2_cnt;u8tl1_cnt;booltl1_per_bgx;/* TL1 per BGX or per LMAC */};structnicpf{structpci_dev*pdev;structhw_info*hw;u8node;unsignedintflags;u8num_vf_en;/* No of VF enabled */boolvf_enabled[MAX_NUM_VFS_SUPPORTED];void__iomem*reg_base;/* Register start address */u8num_sqs_en;/* Secondary qsets enabled */u64nicvf[MAX_NUM_VFS_SUPPORTED];u8vf_sqs[MAX_NUM_VFS_SUPPORTED][MAX_SQS_PER_VF];u8pqs_vf[MAX_NUM_VFS_SUPPORTED];boolsqs_used[MAX_NUM_VFS_SUPPORTED];structpkind_cfgpkind;#define NIC_SET_VF_LMAC_MAP(bgx, lmac) (((bgx & 0xF) << 4) | (lmac & 0xF))#define NIC_GET_BGX_FROM_VF_LMAC_MAP(map) ((map >> 4) & 0xF)#define NIC_GET_LMAC_FROM_VF_LMAC_MAP(map) (map & 0xF)u8*vf_lmac_map;structdelayed_workdwork;struct