Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== i40e: House-keeping and clean-up Ivan Vecera says: The series makes some house-keeping tasks on i40e driver: Patch 1: Removes unnecessary back pointer from i40e_hw Patch 2: Moves I40E_MASK macro to i40e_register.h where is used Patch 3: Refactors I40E_MDIO_CLAUSE* to use the common macro Patch 4: Add header dependencies to <linux/avf/virtchnl.h> Patch 5: Simplifies memory alloction functions Patch 6: Moves mem alloc structures to i40e_alloc.h Patch 7: Splits i40e_osdep.h to i40e_debug.h and i40e_io.h Patch 8: Removes circular header deps, fixes and cleans headers Patch 9: Moves DDP specific macros and structs to i40e_ddp.c * '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue: i40e: Move DDP specific macros and structures to i40e_ddp.c i40e: Remove circular header dependencies and fix headers i40e: Split i40e_osdep.h i40e: Move memory allocation structures to i40e_alloc.h i40e: Simplify memory allocation functions virtchnl: Add header dependencies i40e: Refactor I40E_MDIO_CLAUSE* macros i40e: Move I40E_MASK macro to i40e_register.h i40e: Remove back pointer from i40e_hw structure ==================== Link: https://lore.kernel.org/r/20231005162850.3218594-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
e075838734
@ -4,47 +4,19 @@
|
||||
#ifndef _I40E_H_
|
||||
#define _I40E_H_
|
||||
|
||||
#include <net/tcp.h>
|
||||
#include <net/udp.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/iommu.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/hashtable.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/sctp.h>
|
||||
#include <linux/pkt_sched.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <net/checksum.h>
|
||||
#include <net/ip6_checksum.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/if_macvlan.h>
|
||||
#include <linux/if_bridge.h>
|
||||
#include <linux/clocksource.h>
|
||||
#include <linux/net_tstamp.h>
|
||||
#include <linux/ptp_clock_kernel.h>
|
||||
#include <net/pkt_cls.h>
|
||||
#include <net/pkt_sched.h>
|
||||
#include <net/tc_act/tc_gact.h>
|
||||
#include <net/tc_act/tc_mirred.h>
|
||||
#include <net/udp_tunnel.h>
|
||||
#include <net/xdp_sock.h>
|
||||
#include <linux/bitfield.h>
|
||||
#include "i40e_type.h"
|
||||
#include "i40e_prototype.h"
|
||||
#include <linux/net/intel/i40e_client.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/avf/virtchnl.h>
|
||||
#include "i40e_virtchnl_pf.h"
|
||||
#include "i40e_txrx.h"
|
||||
#include <linux/net/intel/i40e_client.h>
|
||||
#include <net/pkt_cls.h>
|
||||
#include <net/udp_tunnel.h>
|
||||
#include "i40e_dcb.h"
|
||||
#include "i40e_debug.h"
|
||||
#include "i40e_io.h"
|
||||
#include "i40e_prototype.h"
|
||||
#include "i40e_register.h"
|
||||
#include "i40e_txrx.h"
|
||||
|
||||
/* Useful i40e defaults */
|
||||
#define I40E_MAX_VEB 16
|
||||
@ -323,29 +295,6 @@ struct i40e_udp_port_config {
|
||||
u8 filter_index;
|
||||
};
|
||||
|
||||
#define I40_DDP_FLASH_REGION 100
|
||||
#define I40E_PROFILE_INFO_SIZE 48
|
||||
#define I40E_MAX_PROFILE_NUM 16
|
||||
#define I40E_PROFILE_LIST_SIZE \
|
||||
(I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM + 4)
|
||||
#define I40E_DDP_PROFILE_PATH "intel/i40e/ddp/"
|
||||
#define I40E_DDP_PROFILE_NAME_MAX 64
|
||||
|
||||
int i40e_ddp_load(struct net_device *netdev, const u8 *data, size_t size,
|
||||
bool is_add);
|
||||
int i40e_ddp_flash(struct net_device *netdev, struct ethtool_flash *flash);
|
||||
|
||||
struct i40e_ddp_profile_list {
|
||||
u32 p_count;
|
||||
struct i40e_profile_info p_info[];
|
||||
};
|
||||
|
||||
struct i40e_ddp_old_profile_list {
|
||||
struct list_head list;
|
||||
size_t old_ddp_size;
|
||||
u8 old_ddp_buf[];
|
||||
};
|
||||
|
||||
/* macros related to FLX_PIT */
|
||||
#define I40E_FLEX_SET_FSIZE(fsize) (((fsize) << \
|
||||
I40E_PRTQF_FLX_PIT_FSIZE_SHIFT) & \
|
||||
@ -1321,4 +1270,15 @@ static inline u32 i40e_is_tc_mqprio_enabled(struct i40e_pf *pf)
|
||||
return pf->flags & I40E_FLAG_TC_MQPRIO;
|
||||
}
|
||||
|
||||
/**
|
||||
* i40e_hw_to_pf - get pf pointer from the hardware structure
|
||||
* @hw: pointer to the device HW structure
|
||||
**/
|
||||
static inline struct i40e_pf *i40e_hw_to_pf(struct i40e_hw *hw)
|
||||
{
|
||||
return container_of(hw, struct i40e_pf, hw);
|
||||
}
|
||||
|
||||
struct device *i40e_hw_to_dev(struct i40e_hw *hw);
|
||||
|
||||
#endif /* _I40E_H_ */
|
||||
|
@ -1,9 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
||||
|
||||
#include "i40e_type.h"
|
||||
#include <linux/delay.h>
|
||||
#include "i40e_alloc.h"
|
||||
#include "i40e_register.h"
|
||||
#include "i40e_adminq.h"
|
||||
#include "i40e_prototype.h"
|
||||
|
||||
static void i40e_resume_aq(struct i40e_hw *hw);
|
||||
@ -51,7 +51,6 @@ static int i40e_alloc_adminq_asq_ring(struct i40e_hw *hw)
|
||||
int ret_code;
|
||||
|
||||
ret_code = i40e_allocate_dma_mem(hw, &hw->aq.asq.desc_buf,
|
||||
i40e_mem_atq_ring,
|
||||
(hw->aq.num_asq_entries *
|
||||
sizeof(struct i40e_aq_desc)),
|
||||
I40E_ADMINQ_DESC_ALIGNMENT);
|
||||
@ -78,7 +77,6 @@ static int i40e_alloc_adminq_arq_ring(struct i40e_hw *hw)
|
||||
int ret_code;
|
||||
|
||||
ret_code = i40e_allocate_dma_mem(hw, &hw->aq.arq.desc_buf,
|
||||
i40e_mem_arq_ring,
|
||||
(hw->aq.num_arq_entries *
|
||||
sizeof(struct i40e_aq_desc)),
|
||||
I40E_ADMINQ_DESC_ALIGNMENT);
|
||||
@ -136,7 +134,6 @@ static int i40e_alloc_arq_bufs(struct i40e_hw *hw)
|
||||
for (i = 0; i < hw->aq.num_arq_entries; i++) {
|
||||
bi = &hw->aq.arq.r.arq_bi[i];
|
||||
ret_code = i40e_allocate_dma_mem(hw, bi,
|
||||
i40e_mem_arq_buf,
|
||||
hw->aq.arq_buf_size,
|
||||
I40E_ADMINQ_DESC_ALIGNMENT);
|
||||
if (ret_code)
|
||||
@ -198,7 +195,6 @@ static int i40e_alloc_asq_bufs(struct i40e_hw *hw)
|
||||
for (i = 0; i < hw->aq.num_asq_entries; i++) {
|
||||
bi = &hw->aq.asq.r.asq_bi[i];
|
||||
ret_code = i40e_allocate_dma_mem(hw, bi,
|
||||
i40e_mem_asq_buf,
|
||||
hw->aq.asq_buf_size,
|
||||
I40E_ADMINQ_DESC_ALIGNMENT);
|
||||
if (ret_code)
|
||||
|
@ -4,7 +4,8 @@
|
||||
#ifndef _I40E_ADMINQ_H_
|
||||
#define _I40E_ADMINQ_H_
|
||||
|
||||
#include "i40e_osdep.h"
|
||||
#include <linux/mutex.h>
|
||||
#include "i40e_alloc.h"
|
||||
#include "i40e_adminq_cmd.h"
|
||||
|
||||
#define I40E_ADMINQ_DESC(R, i) \
|
||||
|
@ -4,6 +4,8 @@
|
||||
#ifndef _I40E_ADMINQ_CMD_H_
|
||||
#define _I40E_ADMINQ_CMD_H_
|
||||
|
||||
#include <linux/bits.h>
|
||||
|
||||
/* This header file defines the i40e Admin Queue commands and is shared between
|
||||
* i40e Firmware and Software.
|
||||
*
|
||||
|
@ -4,25 +4,25 @@
|
||||
#ifndef _I40E_ALLOC_H_
|
||||
#define _I40E_ALLOC_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct i40e_hw;
|
||||
|
||||
/* Memory allocation types */
|
||||
enum i40e_memory_type {
|
||||
i40e_mem_arq_buf = 0, /* ARQ indirect command buffer */
|
||||
i40e_mem_asq_buf = 1,
|
||||
i40e_mem_atq_buf = 2, /* ATQ indirect command buffer */
|
||||
i40e_mem_arq_ring = 3, /* ARQ descriptor ring */
|
||||
i40e_mem_atq_ring = 4, /* ATQ descriptor ring */
|
||||
i40e_mem_pd = 5, /* Page Descriptor */
|
||||
i40e_mem_bp = 6, /* Backing Page - 4KB */
|
||||
i40e_mem_bp_jumbo = 7, /* Backing Page - > 4KB */
|
||||
i40e_mem_reserved
|
||||
/* memory allocation tracking */
|
||||
struct i40e_dma_mem {
|
||||
void *va;
|
||||
dma_addr_t pa;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
struct i40e_virt_mem {
|
||||
void *va;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
/* prototype for functions used for dynamic memory allocation */
|
||||
int i40e_allocate_dma_mem(struct i40e_hw *hw,
|
||||
struct i40e_dma_mem *mem,
|
||||
enum i40e_memory_type type,
|
||||
u64 size, u32 alignment);
|
||||
int i40e_free_dma_mem(struct i40e_hw *hw,
|
||||
struct i40e_dma_mem *mem);
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <linux/net/intel/i40e_client.h>
|
||||
|
||||
#include "i40e.h"
|
||||
#include "i40e_prototype.h"
|
||||
|
||||
static LIST_HEAD(i40e_devices);
|
||||
static DEFINE_MUTEX(i40e_device_mutex);
|
||||
|
@ -1,11 +1,14 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright(c) 2013 - 2021 Intel Corporation. */
|
||||
|
||||
#include "i40e.h"
|
||||
#include "i40e_type.h"
|
||||
#include "i40e_adminq.h"
|
||||
#include "i40e_prototype.h"
|
||||
#include <linux/avf/virtchnl.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/pci.h>
|
||||
#include "i40e_adminq_cmd.h"
|
||||
#include "i40e_devids.h"
|
||||
#include "i40e_prototype.h"
|
||||
#include "i40e_register.h"
|
||||
|
||||
/**
|
||||
* i40e_set_mac_type - Sets MAC type
|
||||
|
@ -1,9 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright(c) 2013 - 2021 Intel Corporation. */
|
||||
|
||||
#include "i40e_adminq.h"
|
||||
#include "i40e_prototype.h"
|
||||
#include "i40e_alloc.h"
|
||||
#include "i40e_dcb.h"
|
||||
#include "i40e_prototype.h"
|
||||
|
||||
/**
|
||||
* i40e_get_dcbx_status
|
||||
|
@ -2,8 +2,8 @@
|
||||
/* Copyright(c) 2013 - 2021 Intel Corporation. */
|
||||
|
||||
#ifdef CONFIG_I40E_DCB
|
||||
#include "i40e.h"
|
||||
#include <net/dcbnl.h>
|
||||
#include "i40e.h"
|
||||
|
||||
#define I40E_DCBNL_STATUS_SUCCESS 0
|
||||
#define I40E_DCBNL_STATUS_ERROR 1
|
||||
|
@ -1,9 +1,27 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
||||
|
||||
#include <linux/firmware.h>
|
||||
#include "i40e.h"
|
||||
|
||||
#include <linux/firmware.h>
|
||||
#define I40_DDP_FLASH_REGION 100
|
||||
#define I40E_PROFILE_INFO_SIZE 48
|
||||
#define I40E_MAX_PROFILE_NUM 16
|
||||
#define I40E_PROFILE_LIST_SIZE \
|
||||
(I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM + 4)
|
||||
#define I40E_DDP_PROFILE_PATH "intel/i40e/ddp/"
|
||||
#define I40E_DDP_PROFILE_NAME_MAX 64
|
||||
|
||||
struct i40e_ddp_profile_list {
|
||||
u32 p_count;
|
||||
struct i40e_profile_info p_info[];
|
||||
};
|
||||
|
||||
struct i40e_ddp_old_profile_list {
|
||||
struct list_head list;
|
||||
size_t old_ddp_size;
|
||||
u8 old_ddp_buf[];
|
||||
};
|
||||
|
||||
/**
|
||||
* i40e_ddp_profiles_eq - checks if DDP profiles are the equivalent
|
||||
@ -261,8 +279,8 @@ static bool i40e_ddp_is_pkg_hdr_valid(struct net_device *netdev,
|
||||
* Checks correctness and loads DDP profile to the NIC. The function is
|
||||
* also used for rolling back previously loaded profile.
|
||||
**/
|
||||
int i40e_ddp_load(struct net_device *netdev, const u8 *data, size_t size,
|
||||
bool is_add)
|
||||
static int i40e_ddp_load(struct net_device *netdev, const u8 *data, size_t size,
|
||||
bool is_add)
|
||||
{
|
||||
u8 profile_info_sec[sizeof(struct i40e_profile_section_header) +
|
||||
sizeof(struct i40e_profile_info)];
|
||||
|
47
drivers/net/ethernet/intel/i40e/i40e_debug.h
Normal file
47
drivers/net/ethernet/intel/i40e/i40e_debug.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 2023 Intel Corporation. */
|
||||
|
||||
#ifndef _I40E_DEBUG_H_
|
||||
#define _I40E_DEBUG_H_
|
||||
|
||||
#include <linux/dev_printk.h>
|
||||
|
||||
/* debug masks - set these bits in hw->debug_mask to control output */
|
||||
enum i40e_debug_mask {
|
||||
I40E_DEBUG_INIT = 0x00000001,
|
||||
I40E_DEBUG_RELEASE = 0x00000002,
|
||||
|
||||
I40E_DEBUG_LINK = 0x00000010,
|
||||
I40E_DEBUG_PHY = 0x00000020,
|
||||
I40E_DEBUG_HMC = 0x00000040,
|
||||
I40E_DEBUG_NVM = 0x00000080,
|
||||
I40E_DEBUG_LAN = 0x00000100,
|
||||
I40E_DEBUG_FLOW = 0x00000200,
|
||||
I40E_DEBUG_DCB = 0x00000400,
|
||||
I40E_DEBUG_DIAG = 0x00000800,
|
||||
I40E_DEBUG_FD = 0x00001000,
|
||||
I40E_DEBUG_PACKAGE = 0x00002000,
|
||||
I40E_DEBUG_IWARP = 0x00F00000,
|
||||
I40E_DEBUG_AQ_MESSAGE = 0x01000000,
|
||||
I40E_DEBUG_AQ_DESCRIPTOR = 0x02000000,
|
||||
I40E_DEBUG_AQ_DESC_BUFFER = 0x04000000,
|
||||
I40E_DEBUG_AQ_COMMAND = 0x06000000,
|
||||
I40E_DEBUG_AQ = 0x0F000000,
|
||||
|
||||
I40E_DEBUG_USER = 0xF0000000,
|
||||
|
||||
I40E_DEBUG_ALL = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
struct i40e_hw;
|
||||
struct device *i40e_hw_to_dev(struct i40e_hw *hw);
|
||||
|
||||
#define hw_dbg(hw, S, A...) dev_dbg(i40e_hw_to_dev(hw), S, ##A)
|
||||
|
||||
#define i40e_debug(h, m, s, ...) \
|
||||
do { \
|
||||
if (((m) & (h)->debug_mask)) \
|
||||
dev_info(i40e_hw_to_dev(hw), s, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#endif /* _I40E_DEBUG_H_ */
|
@ -5,8 +5,9 @@
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/debugfs.h>
|
||||
|
||||
#include <linux/if_bridge.h>
|
||||
#include "i40e.h"
|
||||
#include "i40e_virtchnl_pf.h"
|
||||
|
||||
static struct dentry *i40e_dbg_root;
|
||||
|
||||
|
@ -4,7 +4,10 @@
|
||||
#ifndef _I40E_DIAG_H_
|
||||
#define _I40E_DIAG_H_
|
||||
|
||||
#include "i40e_type.h"
|
||||
#include "i40e_adminq_cmd.h"
|
||||
|
||||
/* forward-declare the HW struct for the compiler */
|
||||
struct i40e_hw;
|
||||
|
||||
enum i40e_lb_mode {
|
||||
I40E_LB_MODE_NONE = 0x0,
|
||||
|
@ -3,9 +3,10 @@
|
||||
|
||||
/* ethtool support for i40e */
|
||||
|
||||
#include "i40e.h"
|
||||
#include "i40e_devids.h"
|
||||
#include "i40e_diag.h"
|
||||
#include "i40e_txrx_common.h"
|
||||
#include "i40e_virtchnl_pf.h"
|
||||
|
||||
/* ethtool statistics helpers */
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
||||
|
||||
#include "i40e.h"
|
||||
#include "i40e_osdep.h"
|
||||
#include "i40e_register.h"
|
||||
#include "i40e_alloc.h"
|
||||
#include "i40e_debug.h"
|
||||
#include "i40e_hmc.h"
|
||||
#include "i40e_type.h"
|
||||
|
||||
@ -22,7 +20,6 @@ int i40e_add_sd_table_entry(struct i40e_hw *hw,
|
||||
enum i40e_sd_entry_type type,
|
||||
u64 direct_mode_sz)
|
||||
{
|
||||
enum i40e_memory_type mem_type __attribute__((unused));
|
||||
struct i40e_hmc_sd_entry *sd_entry;
|
||||
bool dma_mem_alloc_done = false;
|
||||
struct i40e_dma_mem mem;
|
||||
@ -43,16 +40,13 @@ int i40e_add_sd_table_entry(struct i40e_hw *hw,
|
||||
|
||||
sd_entry = &hmc_info->sd_table.sd_entry[sd_index];
|
||||
if (!sd_entry->valid) {
|
||||
if (I40E_SD_TYPE_PAGED == type) {
|
||||
mem_type = i40e_mem_pd;
|
||||
if (type == I40E_SD_TYPE_PAGED)
|
||||
alloc_len = I40E_HMC_PAGED_BP_SIZE;
|
||||
} else {
|
||||
mem_type = i40e_mem_bp_jumbo;
|
||||
else
|
||||
alloc_len = direct_mode_sz;
|
||||
}
|
||||
|
||||
/* allocate a 4K pd page or 2M backing page */
|
||||
ret_code = i40e_allocate_dma_mem(hw, &mem, mem_type, alloc_len,
|
||||
ret_code = i40e_allocate_dma_mem(hw, &mem, alloc_len,
|
||||
I40E_HMC_PD_BP_BUF_ALIGNMENT);
|
||||
if (ret_code)
|
||||
goto exit;
|
||||
@ -140,7 +134,7 @@ int i40e_add_pd_table_entry(struct i40e_hw *hw,
|
||||
page = rsrc_pg;
|
||||
} else {
|
||||
/* allocate a 4K backing page */
|
||||
ret_code = i40e_allocate_dma_mem(hw, page, i40e_mem_bp,
|
||||
ret_code = i40e_allocate_dma_mem(hw, page,
|
||||
I40E_HMC_PAGED_BP_SIZE,
|
||||
I40E_HMC_PD_BP_BUF_ALIGNMENT);
|
||||
if (ret_code)
|
||||
|
@ -4,6 +4,10 @@
|
||||
#ifndef _I40E_HMC_H_
|
||||
#define _I40E_HMC_H_
|
||||
|
||||
#include "i40e_alloc.h"
|
||||
#include "i40e_io.h"
|
||||
#include "i40e_register.h"
|
||||
|
||||
#define I40E_HMC_MAX_BP_COUNT 512
|
||||
|
||||
/* forward-declare the HW struct for the compiler */
|
||||
|
16
drivers/net/ethernet/intel/i40e/i40e_io.h
Normal file
16
drivers/net/ethernet/intel/i40e/i40e_io.h
Normal file
@ -0,0 +1,16 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 2023 Intel Corporation. */
|
||||
|
||||
#ifndef _I40E_IO_H_
|
||||
#define _I40E_IO_H_
|
||||
|
||||
/* get readq/writeq support for 32 bit kernels, use the low-first version */
|
||||
#include <linux/io-64-nonatomic-lo-hi.h>
|
||||
|
||||
#define wr32(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
|
||||
#define rd32(a, reg) readl((a)->hw_addr + (reg))
|
||||
|
||||
#define rd64(a, reg) readq((a)->hw_addr + (reg))
|
||||
#define i40e_flush(a) readl((a)->hw_addr + I40E_GLGEN_STAT)
|
||||
|
||||
#endif /* _I40E_IO_H_ */
|
@ -1,13 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
||||
|
||||
#include "i40e.h"
|
||||
#include "i40e_osdep.h"
|
||||
#include "i40e_register.h"
|
||||
#include "i40e_type.h"
|
||||
#include "i40e_hmc.h"
|
||||
#include "i40e_alloc.h"
|
||||
#include "i40e_debug.h"
|
||||
#include "i40e_lan_hmc.h"
|
||||
#include "i40e_prototype.h"
|
||||
#include "i40e_type.h"
|
||||
|
||||
/* lan specific interface functions */
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
#ifndef _I40E_LAN_HMC_H_
|
||||
#define _I40E_LAN_HMC_H_
|
||||
|
||||
#include "i40e_hmc.h"
|
||||
|
||||
/* forward-declare the HW struct for the compiler */
|
||||
struct i40e_hw;
|
||||
|
||||
|
@ -1,19 +1,22 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright(c) 2013 - 2021 Intel Corporation. */
|
||||
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/of_net.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/bpf.h>
|
||||
#include <generated/utsrelease.h>
|
||||
#include <linux/crash_dump.h>
|
||||
#include <linux/if_bridge.h>
|
||||
#include <linux/if_macvlan.h>
|
||||
#include <linux/module.h>
|
||||
#include <net/pkt_cls.h>
|
||||
#include <net/xdp_sock_drv.h>
|
||||
|
||||
/* Local includes */
|
||||
#include "i40e.h"
|
||||
#include "i40e_devids.h"
|
||||
#include "i40e_diag.h"
|
||||
#include "i40e_lan_hmc.h"
|
||||
#include "i40e_virtchnl_pf.h"
|
||||
#include "i40e_xsk.h"
|
||||
#include <net/udp_tunnel.h>
|
||||
#include <net/xdp_sock_drv.h>
|
||||
|
||||
/* All i40e tracepoints are defined by the include below, which
|
||||
* must be included exactly once across the whole kernel with
|
||||
* CREATE_TRACE_POINTS defined
|
||||
@ -120,16 +123,27 @@ static void netdev_hw_addr_refcnt(struct i40e_mac_filter *f,
|
||||
}
|
||||
|
||||
/**
|
||||
* i40e_allocate_dma_mem_d - OS specific memory alloc for shared code
|
||||
* i40e_hw_to_dev - get device pointer from the hardware structure
|
||||
* @hw: pointer to the device HW structure
|
||||
**/
|
||||
struct device *i40e_hw_to_dev(struct i40e_hw *hw)
|
||||
{
|
||||
struct i40e_pf *pf = i40e_hw_to_pf(hw);
|
||||
|
||||
return &pf->pdev->dev;
|
||||
}
|
||||
|
||||
/**
|
||||
* i40e_allocate_dma_mem - OS specific memory alloc for shared code
|
||||
* @hw: pointer to the HW structure
|
||||
* @mem: ptr to mem struct to fill out
|
||||
* @size: size of memory requested
|
||||
* @alignment: what to align the allocation to
|
||||
**/
|
||||
int i40e_allocate_dma_mem_d(struct i40e_hw *hw, struct i40e_dma_mem *mem,
|
||||
u64 size, u32 alignment)
|
||||
int i40e_allocate_dma_mem(struct i40e_hw *hw, struct i40e_dma_mem *mem,
|
||||
u64 size, u32 alignment)
|
||||
{
|
||||
struct i40e_pf *pf = (struct i40e_pf *)hw->back;
|
||||
struct i40e_pf *pf = i40e_hw_to_pf(hw);
|
||||
|
||||
mem->size = ALIGN(size, alignment);
|
||||
mem->va = dma_alloc_coherent(&pf->pdev->dev, mem->size, &mem->pa,
|
||||
@ -141,13 +155,13 @@ int i40e_allocate_dma_mem_d(struct i40e_hw *hw, struct i40e_dma_mem *mem,
|
||||
}
|
||||
|
||||
/**
|
||||
* i40e_free_dma_mem_d - OS specific memory free for shared code
|
||||
* i40e_free_dma_mem - OS specific memory free for shared code
|
||||
* @hw: pointer to the HW structure
|
||||
* @mem: ptr to mem struct to free
|
||||
**/
|
||||
int i40e_free_dma_mem_d(struct i40e_hw *hw, struct i40e_dma_mem *mem)
|
||||
int i40e_free_dma_mem(struct i40e_hw *hw, struct i40e_dma_mem *mem)
|
||||
{
|
||||
struct i40e_pf *pf = (struct i40e_pf *)hw->back;
|
||||
struct i40e_pf *pf = i40e_hw_to_pf(hw);
|
||||
|
||||
dma_free_coherent(&pf->pdev->dev, mem->size, mem->va, mem->pa);
|
||||
mem->va = NULL;
|
||||
@ -158,13 +172,13 @@ int i40e_free_dma_mem_d(struct i40e_hw *hw, struct i40e_dma_mem *mem)
|
||||
}
|
||||
|
||||
/**
|
||||
* i40e_allocate_virt_mem_d - OS specific memory alloc for shared code
|
||||
* i40e_allocate_virt_mem - OS specific memory alloc for shared code
|
||||
* @hw: pointer to the HW structure
|
||||
* @mem: ptr to mem struct to fill out
|
||||
* @size: size of memory requested
|
||||
**/
|
||||
int i40e_allocate_virt_mem_d(struct i40e_hw *hw, struct i40e_virt_mem *mem,
|
||||
u32 size)
|
||||
int i40e_allocate_virt_mem(struct i40e_hw *hw, struct i40e_virt_mem *mem,
|
||||
u32 size)
|
||||
{
|
||||
mem->size = size;
|
||||
mem->va = kzalloc(size, GFP_KERNEL);
|
||||
@ -176,11 +190,11 @@ int i40e_allocate_virt_mem_d(struct i40e_hw *hw, struct i40e_virt_mem *mem,
|
||||
}
|
||||
|
||||
/**
|
||||
* i40e_free_virt_mem_d - OS specific memory free for shared code
|
||||
* i40e_free_virt_mem - OS specific memory free for shared code
|
||||
* @hw: pointer to the HW structure
|
||||
* @mem: ptr to mem struct to free
|
||||
**/
|
||||
int i40e_free_virt_mem_d(struct i40e_hw *hw, struct i40e_virt_mem *mem)
|
||||
int i40e_free_virt_mem(struct i40e_hw *hw, struct i40e_virt_mem *mem)
|
||||
{
|
||||
/* it's ok to kfree a NULL pointer */
|
||||
kfree(mem->va);
|
||||
@ -15619,10 +15633,10 @@ err_switch_setup:
|
||||
**/
|
||||
static inline void i40e_set_subsystem_device_id(struct i40e_hw *hw)
|
||||
{
|
||||
struct pci_dev *pdev = ((struct i40e_pf *)hw->back)->pdev;
|
||||
struct i40e_pf *pf = i40e_hw_to_pf(hw);
|
||||
|
||||
hw->subsystem_device_id = pdev->subsystem_device ?
|
||||
pdev->subsystem_device :
|
||||
hw->subsystem_device_id = pf->pdev->subsystem_device ?
|
||||
pf->pdev->subsystem_device :
|
||||
(ushort)(rd32(hw, I40E_PFPCI_SUBSYSID) & USHRT_MAX);
|
||||
}
|
||||
|
||||
@ -15692,7 +15706,6 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
set_bit(__I40E_DOWN, pf->state);
|
||||
|
||||
hw = &pf->hw;
|
||||
hw->back = pf;
|
||||
|
||||
pf->ioremap_len = min_t(int, pci_resource_len(pdev, 0),
|
||||
I40E_MAX_CSR_SPACE);
|
||||
|
@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include "i40e_alloc.h"
|
||||
#include "i40e_prototype.h"
|
||||
|
||||
/**
|
||||
|
@ -1,59 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
||||
|
||||
#ifndef _I40E_OSDEP_H_
|
||||
#define _I40E_OSDEP_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/highuid.h>
|
||||
|
||||
/* get readq/writeq support for 32 bit kernels, use the low-first version */
|
||||
#include <linux/io-64-nonatomic-lo-hi.h>
|
||||
|
||||
/* File to be the magic between shared code and
|
||||
* actual OS primitives
|
||||
*/
|
||||
|
||||
#define hw_dbg(hw, S, A...) \
|
||||
do { \
|
||||
dev_dbg(&((struct i40e_pf *)hw->back)->pdev->dev, S, ##A); \
|
||||
} while (0)
|
||||
|
||||
#define wr32(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
|
||||
#define rd32(a, reg) readl((a)->hw_addr + (reg))
|
||||
|
||||
#define rd64(a, reg) readq((a)->hw_addr + (reg))
|
||||
#define i40e_flush(a) readl((a)->hw_addr + I40E_GLGEN_STAT)
|
||||
|
||||
/* memory allocation tracking */
|
||||
struct i40e_dma_mem {
|
||||
void *va;
|
||||
dma_addr_t pa;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
#define i40e_allocate_dma_mem(h, m, unused, s, a) \
|
||||
i40e_allocate_dma_mem_d(h, m, s, a)
|
||||
#define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
|
||||
|
||||
struct i40e_virt_mem {
|
||||
void *va;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
#define i40e_allocate_virt_mem(h, m, s) i40e_allocate_virt_mem_d(h, m, s)
|
||||
#define i40e_free_virt_mem(h, m) i40e_free_virt_mem_d(h, m)
|
||||
|
||||
#define i40e_debug(h, m, s, ...) \
|
||||
do { \
|
||||
if (((m) & (h)->debug_mask)) \
|
||||
pr_info("i40e %02x:%02x.%x " s, \
|
||||
(h)->bus.bus_id, (h)->bus.device, \
|
||||
(h)->bus.func, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#endif /* _I40E_OSDEP_H_ */
|
@ -4,9 +4,10 @@
|
||||
#ifndef _I40E_PROTOTYPE_H_
|
||||
#define _I40E_PROTOTYPE_H_
|
||||
|
||||
#include "i40e_type.h"
|
||||
#include "i40e_alloc.h"
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/avf/virtchnl.h>
|
||||
#include "i40e_debug.h"
|
||||
#include "i40e_type.h"
|
||||
|
||||
/* Prototypes for shared code functions that are not in
|
||||
* the standard function pointer structures. These are
|
||||
@ -497,4 +498,8 @@ int
|
||||
i40e_add_pinfo_to_list(struct i40e_hw *hw,
|
||||
struct i40e_profile_segment *profile,
|
||||
u8 *profile_info_sec, u32 track_id);
|
||||
|
||||
/* i40e_ddp */
|
||||
int i40e_ddp_flash(struct net_device *netdev, struct ethtool_flash *flash);
|
||||
|
||||
#endif /* _I40E_PROTOTYPE_H_ */
|
||||
|
@ -1,9 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
||||
|
||||
#include "i40e.h"
|
||||
#include <linux/ptp_classify.h>
|
||||
#include <linux/posix-clock.h>
|
||||
#include "i40e.h"
|
||||
#include "i40e_devids.h"
|
||||
|
||||
/* The XL710 timesync is very much like Intel's 82599 design when it comes to
|
||||
* the fundamental clock design. However, the clock operations are much simpler
|
||||
|
@ -4,6 +4,9 @@
|
||||
#ifndef _I40E_REGISTER_H_
|
||||
#define _I40E_REGISTER_H_
|
||||
|
||||
/* I40E_MASK is a macro used on 32 bit registers */
|
||||
#define I40E_MASK(mask, shift) ((u32)(mask) << (shift))
|
||||
|
||||
#define I40E_GL_ATQLEN_ATQCRIT_SHIFT 30
|
||||
#define I40E_GL_ATQLEN_ATQCRIT_MASK I40E_MASK(0x1, I40E_GL_ATQLEN_ATQCRIT_SHIFT)
|
||||
#define I40E_PF_ARQBAH 0x00080180 /* Reset: EMPR */
|
||||
@ -202,7 +205,9 @@
|
||||
#define I40E_GLGEN_MSCA_DEVADD_SHIFT 16
|
||||
#define I40E_GLGEN_MSCA_PHYADD_SHIFT 21
|
||||
#define I40E_GLGEN_MSCA_OPCODE_SHIFT 26
|
||||
#define I40E_GLGEN_MSCA_OPCODE_MASK(_i) I40E_MASK(_i, I40E_GLGEN_MSCA_OPCODE_SHIFT)
|
||||
#define I40E_GLGEN_MSCA_STCODE_SHIFT 28
|
||||
#define I40E_GLGEN_MSCA_STCODE_MASK I40E_MASK(0x1, I40E_GLGEN_MSCA_STCODE_SHIFT)
|
||||
#define I40E_GLGEN_MSCA_MDICMD_SHIFT 30
|
||||
#define I40E_GLGEN_MSCA_MDICMD_MASK I40E_MASK(0x1, I40E_GLGEN_MSCA_MDICMD_SHIFT)
|
||||
#define I40E_GLGEN_MSCA_MDIINPROGEN_SHIFT 31
|
||||
|
@ -1,14 +1,13 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
||||
|
||||
#include <linux/prefetch.h>
|
||||
#include <linux/bpf_trace.h>
|
||||
#include <linux/prefetch.h>
|
||||
#include <linux/sctp.h>
|
||||
#include <net/mpls.h>
|
||||
#include <net/xdp.h>
|
||||
#include "i40e.h"
|
||||
#include "i40e_trace.h"
|
||||
#include "i40e_prototype.h"
|
||||
#include "i40e_txrx_common.h"
|
||||
#include "i40e_trace.h"
|
||||
#include "i40e_xsk.h"
|
||||
|
||||
#define I40E_TXD_CMD (I40E_TX_DESC_CMD_EOP | I40E_TX_DESC_CMD_RS)
|
||||
|
@ -5,6 +5,7 @@
|
||||
#define _I40E_TXRX_H_
|
||||
|
||||
#include <net/xdp.h>
|
||||
#include "i40e_type.h"
|
||||
|
||||
/* Interrupt Throttling and Rate Limiting Goodies */
|
||||
#define I40E_DEFAULT_IRQ_WORK 256
|
||||
|
@ -4,6 +4,8 @@
|
||||
#ifndef I40E_TXRX_COMMON_
|
||||
#define I40E_TXRX_COMMON_
|
||||
|
||||
#include "i40e.h"
|
||||
|
||||
int i40e_xmit_xdp_tx_ring(struct xdp_buff *xdp, struct i40e_ring *xdp_ring);
|
||||
void i40e_clean_programming_status(struct i40e_ring *rx_ring, u64 qword0_raw,
|
||||
u64 qword1);
|
||||
|
@ -4,15 +4,9 @@
|
||||
#ifndef _I40E_TYPE_H_
|
||||
#define _I40E_TYPE_H_
|
||||
|
||||
#include "i40e_osdep.h"
|
||||
#include "i40e_register.h"
|
||||
#include <uapi/linux/if_ether.h>
|
||||
#include "i40e_adminq.h"
|
||||
#include "i40e_hmc.h"
|
||||
#include "i40e_lan_hmc.h"
|
||||
#include "i40e_devids.h"
|
||||
|
||||
/* I40E_MASK is a macro used on 32 bit registers */
|
||||
#define I40E_MASK(mask, shift) ((u32)(mask) << (shift))
|
||||
|
||||
#define I40E_MAX_VSI_QP 16
|
||||
#define I40E_MAX_VF_VSI 4
|
||||
@ -43,48 +37,14 @@ typedef void (*I40E_ADMINQ_CALLBACK)(struct i40e_hw *, struct i40e_aq_desc *);
|
||||
#define I40E_QTX_CTL_VM_QUEUE 0x1
|
||||
#define I40E_QTX_CTL_PF_QUEUE 0x2
|
||||
|
||||
/* debug masks - set these bits in hw->debug_mask to control output */
|
||||
enum i40e_debug_mask {
|
||||
I40E_DEBUG_INIT = 0x00000001,
|
||||
I40E_DEBUG_RELEASE = 0x00000002,
|
||||
#define I40E_MDIO_CLAUSE22_STCODE_MASK I40E_GLGEN_MSCA_STCODE_MASK
|
||||
#define I40E_MDIO_CLAUSE22_OPCODE_WRITE_MASK I40E_GLGEN_MSCA_OPCODE_MASK(1)
|
||||
#define I40E_MDIO_CLAUSE22_OPCODE_READ_MASK I40E_GLGEN_MSCA_OPCODE_MASK(2)
|
||||
|
||||
I40E_DEBUG_LINK = 0x00000010,
|
||||
I40E_DEBUG_PHY = 0x00000020,
|
||||
I40E_DEBUG_HMC = 0x00000040,
|
||||
I40E_DEBUG_NVM = 0x00000080,
|
||||
I40E_DEBUG_LAN = 0x00000100,
|
||||
I40E_DEBUG_FLOW = 0x00000200,
|
||||
I40E_DEBUG_DCB = 0x00000400,
|
||||
I40E_DEBUG_DIAG = 0x00000800,
|
||||
I40E_DEBUG_FD = 0x00001000,
|
||||
I40E_DEBUG_PACKAGE = 0x00002000,
|
||||
I40E_DEBUG_IWARP = 0x00F00000,
|
||||
I40E_DEBUG_AQ_MESSAGE = 0x01000000,
|
||||
I40E_DEBUG_AQ_DESCRIPTOR = 0x02000000,
|
||||
I40E_DEBUG_AQ_DESC_BUFFER = 0x04000000,
|
||||
I40E_DEBUG_AQ_COMMAND = 0x06000000,
|
||||
I40E_DEBUG_AQ = 0x0F000000,
|
||||
|
||||
I40E_DEBUG_USER = 0xF0000000,
|
||||
|
||||
I40E_DEBUG_ALL = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
#define I40E_MDIO_CLAUSE22_STCODE_MASK I40E_MASK(1, \
|
||||
I40E_GLGEN_MSCA_STCODE_SHIFT)
|
||||
#define I40E_MDIO_CLAUSE22_OPCODE_WRITE_MASK I40E_MASK(1, \
|
||||
I40E_GLGEN_MSCA_OPCODE_SHIFT)
|
||||
#define I40E_MDIO_CLAUSE22_OPCODE_READ_MASK I40E_MASK(2, \
|
||||
I40E_GLGEN_MSCA_OPCODE_SHIFT)
|
||||
|
||||
#define I40E_MDIO_CLAUSE45_STCODE_MASK I40E_MASK(0, \
|
||||
I40E_GLGEN_MSCA_STCODE_SHIFT)
|
||||
#define I40E_MDIO_CLAUSE45_OPCODE_ADDRESS_MASK I40E_MASK(0, \
|
||||
I40E_GLGEN_MSCA_OPCODE_SHIFT)
|
||||
#define I40E_MDIO_CLAUSE45_OPCODE_WRITE_MASK I40E_MASK(1, \
|
||||
I40E_GLGEN_MSCA_OPCODE_SHIFT)
|
||||
#define I40E_MDIO_CLAUSE45_OPCODE_READ_MASK I40E_MASK(3, \
|
||||
I40E_GLGEN_MSCA_OPCODE_SHIFT)
|
||||
#define I40E_MDIO_CLAUSE45_STCODE_MASK I40E_GLGEN_MSCA_STCODE_MASK
|
||||
#define I40E_MDIO_CLAUSE45_OPCODE_ADDRESS_MASK I40E_GLGEN_MSCA_OPCODE_MASK(0)
|
||||
#define I40E_MDIO_CLAUSE45_OPCODE_WRITE_MASK I40E_GLGEN_MSCA_OPCODE_MASK(1)
|
||||
#define I40E_MDIO_CLAUSE45_OPCODE_READ_MASK I40E_GLGEN_MSCA_OPCODE_MASK(3)
|
||||
|
||||
#define I40E_PHY_COM_REG_PAGE 0x1E
|
||||
#define I40E_PHY_LED_LINK_MODE_MASK 0xF0
|
||||
@ -525,7 +485,6 @@ struct i40e_dcbx_config {
|
||||
/* Port hardware description */
|
||||
struct i40e_hw {
|
||||
u8 __iomem *hw_addr;
|
||||
void *back;
|
||||
|
||||
/* subsystem structs */
|
||||
struct i40e_phy_info phy;
|
||||
|
@ -2,6 +2,8 @@
|
||||
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
||||
|
||||
#include "i40e.h"
|
||||
#include "i40e_lan_hmc.h"
|
||||
#include "i40e_virtchnl_pf.h"
|
||||
|
||||
/*********************notification routines***********************/
|
||||
|
||||
|
@ -4,7 +4,9 @@
|
||||
#ifndef _I40E_VIRTCHNL_PF_H_
|
||||
#define _I40E_VIRTCHNL_PF_H_
|
||||
|
||||
#include "i40e.h"
|
||||
#include <linux/avf/virtchnl.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include "i40e_type.h"
|
||||
|
||||
#define I40E_MAX_VLANID 4095
|
||||
|
||||
|
@ -2,11 +2,7 @@
|
||||
/* Copyright(c) 2018 Intel Corporation. */
|
||||
|
||||
#include <linux/bpf_trace.h>
|
||||
#include <linux/stringify.h>
|
||||
#include <net/xdp_sock_drv.h>
|
||||
#include <net/xdp.h>
|
||||
|
||||
#include "i40e.h"
|
||||
#include "i40e_txrx_common.h"
|
||||
#include "i40e_xsk.h"
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
#ifndef _I40E_XSK_H_
|
||||
#define _I40E_XSK_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* This value should match the pragma in the loop_unrolled_for
|
||||
* macro. Why 4? It is strictly empirical. It seems to be a good
|
||||
* compromise between the advantage of having simultaneous outstanding
|
||||
@ -20,7 +22,9 @@
|
||||
#define loop_unrolled_for for
|
||||
#endif
|
||||
|
||||
struct i40e_ring;
|
||||
struct i40e_vsi;
|
||||
struct net_device;
|
||||
struct xsk_buff_pool;
|
||||
|
||||
int i40e_queue_pair_disable(struct i40e_vsi *vsi, int queue_pair);
|
||||
|
@ -4,6 +4,10 @@
|
||||
#ifndef _VIRTCHNL_H_
|
||||
#define _VIRTCHNL_H_
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/overflow.h>
|
||||
#include <uapi/linux/if_ether.h>
|
||||
|
||||
/* Description:
|
||||
* This header file describes the Virtual Function (VF) - Physical Function
|
||||
* (PF) communication protocol used by the drivers for all devices starting
|
||||
|
Loading…
x
Reference in New Issue
Block a user