Unverified Commit 6876782e authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!5707 [OLK-6.6] Fix warnings for RNPGBE driver

Merge Pull Request from: @dong-yibo 
 
1 Fix Mucse Network adapter (RNPGBE) driver warnings
update files
drivers/net/ethernet/mucse/rnpgbe/Makefile
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_common.h
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_lib.c
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx.c
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx.h
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.c
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_ptp.c
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_sriov.c
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_sysfs.c

https://gitee.com/openeuler/kernel/issues/I9DI7I 
 
Link:https://gitee.com/openeuler/kernel/pulls/5707

 

Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents 570bcdb0 f27f159f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
#
#

obj-$(CONFIG_MXGBE) += rnpgbe.o
obj-$(CONFIG_MGBE) += rnpgbe.o
rnpgbe-objs :=   \
		rnpgbe_main.o \
		rnpgbe_common.o \
+130 −115
Original line number Diff line number Diff line
@@ -151,13 +151,12 @@ static struct rnpgbe_dma_operations dma_ops_n500 = {
 *  @eth: pointer to eth structure
 *  @index: Receive address register to write
 *  @addr: Address to put into receive address register
 *  @vmdq: VMDq "set" or "pool" index
 *  @enable_addr: set flag that address is active
 *  @sriov_flag
 *
 *  Puts an ethernet address into a receive address register.
 **/
s32 rnpgbe_eth_set_rar_n500(struct rnpgbe_eth_info *eth, u32 index, u8 *addr,
static s32 rnpgbe_eth_set_rar_n500(struct rnpgbe_eth_info *eth, u32 index,
				   u8 *addr,
				   bool enable_addr)
{
	u32 mcstctrl;
@@ -209,7 +208,8 @@ s32 rnpgbe_eth_set_rar_n500(struct rnpgbe_eth_info *eth, u32 index, u8 *addr,
 *
 *  Clears an ethernet address from a receive address register.
 **/
s32 rnpgbe_eth_clear_rar_n500(struct rnpgbe_eth_info *eth, u32 index)
static s32 rnpgbe_eth_clear_rar_n500(struct rnpgbe_eth_info *eth,
				     u32 index)
{
	u32 rar_high;
	u32 rar_entries = eth->num_rar_entries;
@@ -243,7 +243,8 @@ s32 rnpgbe_eth_clear_rar_n500(struct rnpgbe_eth_info *eth, u32 index)
 *  @vmdq: VMDq pool index
 *  only mac->vf
 **/
s32 rnpgbe_eth_set_vmdq_n500(struct rnpgbe_eth_info *eth, u32 rar, u32 vmdq)
static s32 rnpgbe_eth_set_vmdq_n500(struct rnpgbe_eth_info *eth,
				    u32 rar, u32 vmdq)
{
	u32 rar_entries = eth->num_rar_entries;

@@ -264,7 +265,8 @@ s32 rnpgbe_eth_set_vmdq_n500(struct rnpgbe_eth_info *eth, u32 rar, u32 vmdq)
 *  @rar: receive address register index to disassociate
 *  @vmdq: VMDq pool index to remove from the rar
 **/
s32 rnpgbe_eth_clear_vmdq_n500(struct rnpgbe_eth_info *eth, u32 rar, u32 vmdq)
static s32 rnpgbe_eth_clear_vmdq_n500(struct rnpgbe_eth_info *eth,
				      u32 rar, u32 vmdq)
{
	u32 rar_entries = eth->num_rar_entries;

@@ -363,7 +365,8 @@ static void rnp500_set_vf_mta(struct rnpgbe_hw *hw, u16 vector)
	eth->mta_shadow[vector_reg] |= (1 << vector_bit);
}

u8 *rnpgbe_addr_list_itr(struct rnpgbe_hw __maybe_unused *hw, u8 **mc_addr_ptr)
static u8 *rnpgbe_addr_list_itr(struct rnpgbe_hw __maybe_unused *hw,
				u8 **mc_addr_ptr)
{
	struct netdev_hw_addr *mc_ptr;
	u8 *addr = *mc_addr_ptr;
@@ -382,16 +385,17 @@ u8 *rnpgbe_addr_list_itr(struct rnpgbe_hw __maybe_unused *hw, u8 **mc_addr_ptr)
}

/**
 *  rnpgbe_update_mc_addr_list_n500 - Updates MAC list of multicast addresses
 *  @hw: pointer to hardware structure
 *  rnpgbe_eth_update_mc_addr_list_n500 - Updates MAC list of multicast addresses
 *  @eth: pointer to hardware structure
 *  @netdev: pointer to net device structure
 *  @sriov_on: sriov status
 *
 *  The given list replaces any existing list. Clears the MC addrs from receive
 *  address registers and the multicast table. Uses unused receive address
 *  registers for the first multicast addresses, and hashes the rest into the
 *  multicast table.
 **/
s32 rnpgbe_eth_update_mc_addr_list_n500(struct rnpgbe_eth_info *eth,
static s32 rnpgbe_eth_update_mc_addr_list_n500(struct rnpgbe_eth_info *eth,
					       struct net_device *netdev,
					       bool sriov_on)
{
@@ -474,7 +478,7 @@ s32 rnpgbe_eth_update_mc_addr_list_n500(struct rnpgbe_eth_info *eth,
}

/* clean all mc addr */
void rnpgbe_eth_clr_mc_addr_n500(struct rnpgbe_eth_info *eth)
static void rnpgbe_eth_clr_mc_addr_n500(struct rnpgbe_eth_info *eth)
{
	int i;

@@ -485,11 +489,12 @@ void rnpgbe_eth_clr_mc_addr_n500(struct rnpgbe_eth_info *eth)
/**
 *  rnpgbe_eth_set_rss_hfunc_n500 - Remove Rx address register
 *  @eth: pointer to eth structure
 *  @hfunc type
 *  @hfunc: hash function type
 *
 *  update rss key to eth regs
 **/
int rnpgbe_eth_set_rss_hfunc_n500(struct rnpgbe_eth_info *eth, int hfunc)
static int rnpgbe_eth_set_rss_hfunc_n500(struct rnpgbe_eth_info *eth,
					 int hfunc)
{
	u32 data;

@@ -514,12 +519,12 @@ int rnpgbe_eth_set_rss_hfunc_n500(struct rnpgbe_eth_info *eth, int hfunc)
/**
 *  rnpgbe_eth_update_rss_key_n500 - Remove Rx address register
 *  @eth: pointer to eth structure
 *  @sriov_flag sriov status
 *  @sriov_flag: sriov status
 *
 *  update rss key to eth regs
 **/

void rnpgbe_eth_update_rss_key_n500(struct rnpgbe_eth_info *eth,
static void rnpgbe_eth_update_rss_key_n500(struct rnpgbe_eth_info *eth,
					   bool sriov_flag)
{
	struct rnpgbe_hw *hw = (struct rnpgbe_hw *)eth->back;
@@ -553,7 +558,7 @@ void rnpgbe_eth_update_rss_key_n500(struct rnpgbe_eth_info *eth,
 *
 *  update rss table to eth regs
 **/
void rnpgbe_eth_update_rss_table_n500(struct rnpgbe_eth_info *eth)
static void rnpgbe_eth_update_rss_table_n500(struct rnpgbe_eth_info *eth)
{
	struct rnpgbe_hw *hw = (struct rnpgbe_hw *)eth->back;
	u32 reta_entries = hw->rss_indir_tbl_num;
@@ -580,7 +585,8 @@ void rnpgbe_eth_update_rss_table_n500(struct rnpgbe_eth_info *eth)
 *
 *  Turn on/off specified VLAN in the VLAN filter table.
 **/
s32 rnpgbe_eth_set_vfta_n500(struct rnpgbe_eth_info *eth, u32 vlan,
static s32 rnpgbe_eth_set_vfta_n500(struct rnpgbe_eth_info *eth,
				    u32 vlan,
				    bool vlan_on)
{
	s32 regindex;
@@ -621,7 +627,7 @@ s32 rnpgbe_eth_set_vfta_n500(struct rnpgbe_eth_info *eth, u32 vlan,
	return 0;
}

void rnpgbe_eth_clr_vfta_n500(struct rnpgbe_eth_info *eth)
static void rnpgbe_eth_clr_vfta_n500(struct rnpgbe_eth_info *eth)
{
	u32 offset;

@@ -677,13 +683,14 @@ static void rnpgbe_eth_set_vlan_filter_n500(struct rnpgbe_eth_info *eth,
	eth_wr32(eth, RNP500_ETH_VLAN_FILTER_ENABLE, value);
}

u16 rnpgbe_layer2_pritologic_n500(u16 hw_id)
static u16 rnpgbe_layer2_pritologic_n500(u16 hw_id)
{
	return hw_id;
}

void rnpgbe_eth_set_layer2_n500(struct rnpgbe_eth_info *eth,
				union rnpgbe_atr_input *input, u16 pri_id,
static void rnpgbe_eth_set_layer2_n500(struct rnpgbe_eth_info *eth,
				       union rnpgbe_atr_input *input,
				       u16 pri_id,
				       u8 queue, bool prio_flag)
{
	u16 hw_id;
@@ -709,7 +716,7 @@ void rnpgbe_eth_set_layer2_n500(struct rnpgbe_eth_info *eth,
	}
}

void rnpgbe_eth_clr_layer2_n500(struct rnpgbe_eth_info *eth, u16 pri_id)
static void rnpgbe_eth_clr_layer2_n500(struct rnpgbe_eth_info *eth, u16 pri_id)
{
	u16 hw_id;

@@ -717,7 +724,7 @@ void rnpgbe_eth_clr_layer2_n500(struct rnpgbe_eth_info *eth, u16 pri_id)
	eth_wr32(eth, RNP500_ETH_LAYER2_ETQF(hw_id), 0);
}

void rnpgbe_eth_clr_all_layer2_n500(struct rnpgbe_eth_info *eth)
static void rnpgbe_eth_clr_all_layer2_n500(struct rnpgbe_eth_info *eth)
{
	int i;
#define RNP500_MAX_LAYER2_FILTERS 16
@@ -725,13 +732,14 @@ void rnpgbe_eth_clr_all_layer2_n500(struct rnpgbe_eth_info *eth)
		eth_wr32(eth, RNP500_ETH_LAYER2_ETQF(i), 0);
}

u16 rnpgbe_tuple5_pritologic_n500(u16 hw_id)
static u16 rnpgbe_tuple5_pritologic_n500(u16 hw_id)
{
	return hw_id;
}

void rnpgbe_eth_set_tuple5_n500(struct rnpgbe_eth_info *eth,
				union rnpgbe_atr_input *input, u16 pri_id,
static void rnpgbe_eth_set_tuple5_n500(struct rnpgbe_eth_info *eth,
				       union rnpgbe_atr_input *input,
				       u16 pri_id,
				       u8 queue, bool prio_flag)
{
#define RNP500_SRC_IP_MASK BIT(0)
@@ -811,7 +819,8 @@ void rnpgbe_eth_set_tuple5_n500(struct rnpgbe_eth_info *eth,
	}
}

void rnpgbe_eth_clr_tuple5_n500(struct rnpgbe_eth_info *eth, u16 pri_id)
static void rnpgbe_eth_clr_tuple5_n500(struct rnpgbe_eth_info *eth,
				       u16 pri_id)
{
	u16 hw_id;

@@ -819,7 +828,7 @@ void rnpgbe_eth_clr_tuple5_n500(struct rnpgbe_eth_info *eth, u16 pri_id)
	eth_wr32(eth, RNP500_ETH_TUPLE5_FTQF(hw_id), 0);
}

void rnpgbe_eth_clr_all_tuple5_n500(struct rnpgbe_eth_info *eth)
static void rnpgbe_eth_clr_all_tuple5_n500(struct rnpgbe_eth_info *eth)
{
	int i;

@@ -827,7 +836,8 @@ void rnpgbe_eth_clr_all_tuple5_n500(struct rnpgbe_eth_info *eth)
		eth_wr32(eth, RNP500_ETH_TUPLE5_FTQF(i), 0);
}

void rnpgbe_eth_set_tcp_sync_n500(struct rnpgbe_eth_info *eth, int queue,
static void rnpgbe_eth_set_tcp_sync_n500(struct rnpgbe_eth_info *eth,
					 int queue,
					 bool flag, bool prio)
{
	if (flag) {
@@ -843,7 +853,8 @@ void rnpgbe_eth_set_tcp_sync_n500(struct rnpgbe_eth_info *eth, int queue,
	}
}

void rnpgbe_eth_set_rx_skip_n500(struct rnpgbe_eth_info *eth, int count,
static void rnpgbe_eth_set_rx_skip_n500(struct rnpgbe_eth_info *eth,
					int count,
					bool flag)
{
	if (flag) {
@@ -989,7 +1000,7 @@ static struct rnpgbe_eth_operations eth_ops_n500 = {
};

/**
 *  rnpgbe_init_hw_n500 - Generic hardware initialization
 *  rnpgbe_init_hw_ops_n500 - Generic hardware initialization
 *  @hw: pointer to hardware structure
 *
 *  Initialize the hardware by resetting the hardware, filling the bus info
@@ -998,7 +1009,7 @@ static struct rnpgbe_eth_operations eth_ops_n500 = {
 *  up link and flow control settings, and leaves transmit and receive units
 *  disabled and uninitialized
 **/
s32 rnpgbe_init_hw_ops_n500(struct rnpgbe_hw *hw)
static s32 rnpgbe_init_hw_ops_n500(struct rnpgbe_hw *hw)
{
	s32 status = 0;

@@ -1011,7 +1022,8 @@ s32 rnpgbe_init_hw_ops_n500(struct rnpgbe_hw *hw)
	return status;
}

s32 rnpgbe_get_permtion_mac_addr_n500(struct rnpgbe_hw *hw, u8 *mac_addr)
static s32 rnpgbe_get_permtion_mac_addr_n500(struct rnpgbe_hw *hw,
					     u8 *mac_addr)
{
	if (rnpgbe_fw_get_macaddr(hw, hw->pfvfnum, mac_addr, hw->nr_lane))
		eth_random_addr(mac_addr);
@@ -1024,7 +1036,7 @@ s32 rnpgbe_get_permtion_mac_addr_n500(struct rnpgbe_hw *hw, u8 *mac_addr)
	return 0;
}

s32 rnpgbe_reset_hw_ops_n500(struct rnpgbe_hw *hw)
static s32 rnpgbe_reset_hw_ops_n500(struct rnpgbe_hw *hw)
{
	int i;
	struct rnpgbe_dma_info *dma = &hw->dma;
@@ -1096,7 +1108,7 @@ s32 rnpgbe_reset_hw_ops_n500(struct rnpgbe_hw *hw)
	return 0;
}

s32 rnpgbe_start_hw_ops_n500(struct rnpgbe_hw *hw)
static s32 rnpgbe_start_hw_ops_n500(struct rnpgbe_hw *hw)
{
	s32 ret_val = 0;
	struct rnpgbe_eth_info *eth = &hw->eth;
@@ -1308,8 +1320,10 @@ static void rnpgbe_set_mac_hw_ops_n500(struct rnpgbe_hw *hw, u8 *mac,
}

/**
 * rnpgbe_write_uc_addr_list - write unicast addresses to RAR table
 * rnpgbe_write_uc_addr_list_n500 - write unicast addresses to RAR table
 * @hw: hardware structure
 * @netdev: network interface device structure
 * @sriov_flag: sriov on or not
 *
 * Writes unicast address list to the RAR table.
 * Returns: -ENOMEM on failure/insufficient address space
@@ -1722,11 +1736,6 @@ static void rnpgbe_set_rx_hash_hw_ops_n500(struct rnpgbe_hw *hw, bool status,
	eth->ops.set_rx_hash(eth, status, sriov_flag);
}

/**
 * setup mac to rar 0
 * clean vmdq
 * clean mc addr
 **/
static s32 rnpgbe_init_rx_addrs_hw_ops_n500(struct rnpgbe_hw *hw)
{
	struct rnpgbe_eth_info *eth = &hw->eth;
@@ -1845,16 +1854,18 @@ static void rnpgbe_set_mbx_ifup_hw_ops_n500(struct rnpgbe_hw *hw, int enable)
}

/**
 *  rnpgbe_check_mac_link_n500 - Determine link and speed status
 *  rnpgbe_check_mac_link_hw_ops_n500 - Determine link and speed status
 *  @hw: pointer to hardware structure
 *  @speed: pointer to link speed
 *  @link_up: true when link is up
 *  @duplex: full or half
 *  @link_up_wait_to_complete: bool used to wait for link up or not
 *
 *  Reads the links register to determine if link is up and the current speed
 **/
s32 rnpgbe_check_mac_link_hw_ops_n500(struct rnpgbe_hw *hw,
				      rnpgbe_link_speed *speed, bool *link_up,
static s32 rnpgbe_check_mac_link_hw_ops_n500(struct rnpgbe_hw *hw,
					     rnpgbe_link_speed *speed,
					     bool *link_up,
					     bool *duplex,
					     bool link_up_wait_to_complete)
{
@@ -1885,8 +1896,11 @@ s32 rnpgbe_check_mac_link_hw_ops_n500(struct rnpgbe_hw *hw,
	return 0;
}

s32 rnpgbe_setup_mac_link_hw_ops_n500(struct rnpgbe_hw *hw, u32 adv,
				      u32 autoneg, u32 speed, u32 duplex)
static s32 rnpgbe_setup_mac_link_hw_ops_n500(struct rnpgbe_hw *hw,
					     u32 adv,
					     u32 autoneg,
					     u32 speed,
					     u32 duplex)
{
	rnpgbe_mbx_phy_link_set(hw, adv, autoneg, speed, duplex,
				hw->tp_mdix_ctrl);
@@ -1894,7 +1908,7 @@ s32 rnpgbe_setup_mac_link_hw_ops_n500(struct rnpgbe_hw *hw, u32 adv,
	return 0;
}

void rnpgbe_clean_link_hw_ops_n500(struct rnpgbe_hw *hw)
static void rnpgbe_clean_link_hw_ops_n500(struct rnpgbe_hw *hw)
{
	hw->link = 0;
}
@@ -1953,8 +1967,10 @@ static void rnpgbe_set_outer_vlan_type_hw_ops_n500(struct rnpgbe_hw *hw,
	eth->ops.set_outer_vlan_type(eth, type);
}

s32 rnpgbe_phy_read_reg_hw_ops_n500(struct rnpgbe_hw *hw, u32 reg_addr,
				    u32 device_type, u16 *phy_data)
static s32 rnpgbe_phy_read_reg_hw_ops_n500(struct rnpgbe_hw *hw,
					   u32 reg_addr,
					   u32 device_type,
					   u16 *phy_data)
{
	struct rnpgbe_mac_info *mac = &hw->mac;
	s32 status = 0;
@@ -1966,8 +1982,10 @@ s32 rnpgbe_phy_read_reg_hw_ops_n500(struct rnpgbe_hw *hw, u32 reg_addr,
	return status;
}

s32 rnpgbe_phy_write_reg_hw_ops_n500(struct rnpgbe_hw *hw, u32 reg_addr,
				     u32 device_type, u16 phy_data)
static s32 rnpgbe_phy_write_reg_hw_ops_n500(struct rnpgbe_hw *hw,
					    u32 reg_addr,
					    u32 device_type,
					    u16 phy_data)
{
	struct rnpgbe_mac_info *mac = &hw->mac;
	s32 status = 0;
@@ -1977,14 +1995,15 @@ s32 rnpgbe_phy_write_reg_hw_ops_n500(struct rnpgbe_hw *hw, u32 reg_addr,
	return status;
}

void rnpgbe_setup_wol_hw_ops_n500(struct rnpgbe_hw *hw, u32 mode)
static void rnpgbe_setup_wol_hw_ops_n500(struct rnpgbe_hw *hw, u32 mode)
{
	struct rnpgbe_mac_info *mac = &hw->mac;

	mac->ops.pmt(mac, mode, !!hw->ncsi_en);
}

void rnpgbe_setup_eee_hw_ops_n500(struct rnpgbe_hw *hw, int ls, int tw,
static void rnpgbe_setup_eee_hw_ops_n500(struct rnpgbe_hw *hw,
					 int ls, int tw,
					 u32 local_eee)
{
	struct rnpgbe_mac_info *mac = &hw->mac;
@@ -1995,7 +2014,7 @@ void rnpgbe_setup_eee_hw_ops_n500(struct rnpgbe_hw *hw, int ls, int tw,
	rnpgbe_mbx_phy_eee_set(hw, tw, local_eee);
}

void rnpgbe_set_eee_mode_hw_ops_n500(struct rnpgbe_hw *hw,
static void rnpgbe_set_eee_mode_hw_ops_n500(struct rnpgbe_hw *hw,
					    bool en_tx_lpi_clockgating)
{
	struct rnpgbe_mac_info *mac = &hw->mac;
@@ -2003,28 +2022,29 @@ void rnpgbe_set_eee_mode_hw_ops_n500(struct rnpgbe_hw *hw,
	mac->ops.set_eee_mode(mac, en_tx_lpi_clockgating);
}

void rnpgbe_reset_eee_mode_hw_ops_n500(struct rnpgbe_hw *hw)
static void rnpgbe_reset_eee_mode_hw_ops_n500(struct rnpgbe_hw *hw)
{
	struct rnpgbe_mac_info *mac = &hw->mac;

	mac->ops.reset_eee_mode(mac);
}

void rnpgbe_set_eee_pls_hw_ops_n500(struct rnpgbe_hw *hw, int link)
static void rnpgbe_set_eee_pls_hw_ops_n500(struct rnpgbe_hw *hw, int link)
{
	struct rnpgbe_mac_info *mac = &hw->mac;

	mac->ops.set_eee_pls(mac, link);
}

u32 rnpgbe_get_lpi_status_hw_ops_n500(struct rnpgbe_hw *hw)
static u32 rnpgbe_get_lpi_status_hw_ops_n500(struct rnpgbe_hw *hw)
{
	struct rnpgbe_mac_info *mac = &hw->mac;

	return mac->ops.get_lpi_status(mac);
}

int rnpgbe_get_ncsi_mac_hw_ops_n500(struct rnpgbe_hw *hw, u8 *addr, int idx)
static int rnpgbe_get_ncsi_mac_hw_ops_n500(struct rnpgbe_hw *hw,
					   u8 *addr, int idx)
{
#define NCSI_MAC_H(i) (0x48 + (i) * 0x8)
#define NCSI_MAC_L(i) (0x4C + (i) * 0x8)
@@ -2047,7 +2067,8 @@ int rnpgbe_get_ncsi_mac_hw_ops_n500(struct rnpgbe_hw *hw, u8 *addr, int idx)
	}
}

int rnpgbe_get_ncsi_vlan_hw_ops_n500(struct rnpgbe_hw *hw, u16 *vlan, int idx)
static int rnpgbe_get_ncsi_vlan_hw_ops_n500(struct rnpgbe_hw *hw,
					    u16 *vlan, int idx)
{
#define NCSI_VLAN(i) (0x80 + (i) * 0x10)
	struct rnpgbe_mac_info *mac = &hw->mac;
@@ -2063,23 +2084,25 @@ int rnpgbe_get_ncsi_vlan_hw_ops_n500(struct rnpgbe_hw *hw, u16 *vlan, int idx)
	}
}

void rnpgbe_set_lldp_hw_ops_n500(struct rnpgbe_hw *hw, bool enable)
static void rnpgbe_set_lldp_hw_ops_n500(struct rnpgbe_hw *hw, bool enable)
{
	rnpgbe_mbx_lldp_set(hw, enable);
}

void rnpgbe_get_lldp_hw_ops_n500(struct rnpgbe_hw *hw)
static void rnpgbe_get_lldp_hw_ops_n500(struct rnpgbe_hw *hw)
{
}

void rnpgbe_set_eee_timer_hw_ops_n500(struct rnpgbe_hw *hw, int ls, int tw)
static void rnpgbe_set_eee_timer_hw_ops_n500(struct rnpgbe_hw *hw,
					     int ls, int tw)
{
	struct rnpgbe_mac_info *mac = &hw->mac;

	mac->ops.set_eee_timer(mac, ls, tw);
}

void rnpgbe_set_vf_vlan_mode_hw_ops_n500(struct rnpgbe_hw *hw, u16 vlan, int vf,
static void rnpgbe_set_vf_vlan_mode_hw_ops_n500(struct rnpgbe_hw *hw,
						u16 vlan, int vf,
						bool enable)
{
	struct rnpgbe_eth_info *eth = &hw->eth;
@@ -2089,7 +2112,8 @@ void rnpgbe_set_vf_vlan_mode_hw_ops_n500(struct rnpgbe_hw *hw, u16 vlan, int vf,
		eth->ops.set_vf_vlan_mode(eth, vlan, vf, enable);
}

void rnpgbe_driver_status_hw_ops_n500(struct rnpgbe_hw *hw, bool enable,
static void rnpgbe_driver_status_hw_ops_n500(struct rnpgbe_hw *hw,
					     bool enable,
					     int mode)
{
	switch (mode) {
@@ -2253,7 +2277,7 @@ static const char rnp500_gstrings_test[][ETH_GSTRING_LEN] = {

#define RNP500_TEST_LEN (sizeof(rnp500_gstrings_test) / ETH_GSTRING_LEN)

int rnp500_get_link_ksettings(struct net_device *netdev,
static int rnp500_get_link_ksettings(struct net_device *netdev,
				     struct ethtool_link_ksettings *cmd)
{
	struct rnpgbe_adapter *adapter = netdev_priv(netdev);
@@ -2378,7 +2402,7 @@ int rnp500_get_link_ksettings(struct net_device *netdev,
	return 0;
}

int rnp500_set_link_ksettings(struct net_device *netdev,
static int rnp500_set_link_ksettings(struct net_device *netdev,
				     const struct ethtool_link_ksettings *cmd)
{
	struct rnpgbe_adapter *adapter = netdev_priv(netdev);
@@ -2547,7 +2571,7 @@ static int rnp500_set_eeprom(struct net_device *netdev,
	return 0;
}

void rnp500_get_pauseparam(struct net_device *netdev,
static void rnp500_get_pauseparam(struct net_device *netdev,
				  struct ethtool_pauseparam *pause)
{
	struct rnpgbe_adapter *adapter = netdev_priv(netdev);
@@ -2571,7 +2595,7 @@ void rnp500_get_pauseparam(struct net_device *netdev,
	}
}

int rnp500_set_pauseparam(struct net_device *netdev,
static int rnp500_set_pauseparam(struct net_device *netdev,
				 struct ethtool_pauseparam *pause)
{
	struct rnpgbe_adapter *adapter = netdev_priv(netdev);
@@ -2617,11 +2641,8 @@ static void rnp500_get_regs(struct net_device *netdev,
static void rnp500_get_strings(struct net_device *netdev, u32 stringset,
			       u8 *data)
{
	struct rnpgbe_adapter *adapter = netdev_priv(netdev);
	char *p = (char *)data;
	int i;
	struct rnpgbe_ring *ring;
	u32 dma_ch;

	switch (stringset) {
	case ETH_SS_TEST:
@@ -2643,8 +2664,6 @@ static void rnp500_get_strings(struct net_device *netdev, u32 stringset,
		}
		for (i = 0; i < RNP_NUM_TX_QUEUES; i++) {
			/* ====  tx ======== */
			ring = adapter->tx_ring[i];
			dma_ch = ring->rnpgbe_queue_idx;
			sprintf(p, "---\n     queue%u_tx_packets", i);
			p += ETH_GSTRING_LEN;
			sprintf(p, "queue%u_tx_bytes", i);
@@ -2695,8 +2714,6 @@ static void rnp500_get_strings(struct net_device *netdev, u32 stringset,
			p += ETH_GSTRING_LEN;

			/* ====  rx ======== */
			ring = adapter->rx_ring[i];
			dma_ch = ring->rnpgbe_queue_idx;
			sprintf(p, "queue%u_rx_packets", i);
			p += ETH_GSTRING_LEN;
			sprintf(p, "queue%u_rx_bytes", i);
@@ -3072,7 +3089,6 @@ static void rnp500_get_ethtool_stats(struct net_device *netdev,
	BUG_ON(RNP_NUM_TX_QUEUES != RNP_NUM_RX_QUEUES);

	for (j = 0; j < RNP_NUM_TX_QUEUES; j++) {
		int idx;
		/* tx-ring */
		ring = adapter->tx_ring[j];
		if (!ring) {
@@ -3124,7 +3140,6 @@ static void rnp500_get_ethtool_stats(struct net_device *netdev,
			data[i++] = 0;
			continue;
		}
		idx = ring->rnpgbe_queue_idx;

		data[i++] = ring->stats.packets;
		data[i++] = ring->stats.bytes;
@@ -3183,7 +3198,6 @@ static void rnp500_get_ethtool_stats(struct net_device *netdev,
			data[i++] = 0;
			continue;
		}
		idx = ring->rnpgbe_queue_idx;
		data[i++] = ring->stats.packets;
		data[i++] = ring->stats.bytes;

@@ -3262,7 +3276,7 @@ static const struct ethtool_ops rnp500_ethtool_ops = {
	.flash_device = rnpgbe_flash_device,
};

void rnpgbe_set_ethtool_hw_ops_n500(struct net_device *netdev)
static void rnpgbe_set_ethtool_hw_ops_n500(struct net_device *netdev)
{
	netdev->ethtool_ops = &rnp500_ethtool_ops;
}
@@ -3387,12 +3401,12 @@ static void rnpgbe_mac_fcs_n500(struct rnpgbe_mac_info *mac, bool status)
}

/**
 *  rnpgbe_fc_mode_n500 - Enable flow control
 *  @hw: pointer to hardware structure
 *  rnpgbe_mac_fc_mode_n500 - Enable flow control
 *  @mac: pointer to hardware structure
 *
 *  Enable flow control according to the current settings.
 **/
s32 rnpgbe_mac_fc_mode_n500(struct rnpgbe_mac_info *mac)
static s32 rnpgbe_mac_fc_mode_n500(struct rnpgbe_mac_info *mac)
{
	struct rnpgbe_hw *hw = (struct rnpgbe_hw *)mac->back;
	s32 ret_val = 0;
@@ -3451,7 +3465,7 @@ s32 rnpgbe_mac_fc_mode_n500(struct rnpgbe_mac_info *mac)
	return ret_val;
}

bool poll_free_mdio(u8 __iomem *addr, u32 mask, int count)
static bool poll_free_mdio(u8 __iomem *addr, u32 mask, int count)
{
	unsigned int value;
	int con = 0;
@@ -3465,7 +3479,7 @@ bool poll_free_mdio(u8 __iomem *addr, u32 mask, int count)
	return !!(con >= count);
}

int rnpgbe_mdio_read(struct rnpgbe_mac_info *mac, int phyreg)
static int rnpgbe_mdio_read(struct rnpgbe_mac_info *mac, int phyreg)
{
#define MII_BUSY 0x00000001
#define MII_WRITE 0x00000002
@@ -3496,8 +3510,9 @@ int rnpgbe_mdio_read(struct rnpgbe_mac_info *mac, int phyreg)
	return data;
}

void rnpgbe_mac_check_link_n500(struct rnpgbe_mac_info *mac,
				rnpgbe_link_speed *speed, bool *link_up,
static void rnpgbe_mac_check_link_n500(struct rnpgbe_mac_info *mac,
				       rnpgbe_link_speed *speed,
				       bool *link_up,
				       bool link_up_wait_to_complete)
{
	struct rnpgbe_hw *hw = (struct rnpgbe_hw *)mac->back;
@@ -3542,7 +3557,7 @@ void rnpgbe_mac_check_link_n500(struct rnpgbe_mac_info *mac,
	}
}

void rnpgbe_mac_set_mac_n500(struct rnpgbe_mac_info *mac, u8 *addr, int index)
static void rnpgbe_mac_set_mac_n500(struct rnpgbe_mac_info *mac, u8 *addr, int index)
{
	u32 rar_low, rar_high = 0;

@@ -3553,7 +3568,7 @@ void rnpgbe_mac_set_mac_n500(struct rnpgbe_mac_info *mac, u8 *addr, int index)
	mac_wr32(mac, RNP500_MAC_UNICAST_LOW(index), rar_low);
}

int rnpgbe_mac_mdio_read_n500(struct rnpgbe_mac_info *mac, u32 phyreg,
static int rnpgbe_mac_mdio_read_n500(struct rnpgbe_mac_info *mac, u32 phyreg,
				     u32 *regvalue)
{
	unsigned int mii_address = mac->mii.addr;
@@ -3583,7 +3598,7 @@ int rnpgbe_mac_mdio_read_n500(struct rnpgbe_mac_info *mac, u32 phyreg,
	return data;
}

int rnpgbe_mac_mdio_write_n500(struct rnpgbe_mac_info *mac, int phyreg,
static int rnpgbe_mac_mdio_write_n500(struct rnpgbe_mac_info *mac, int phyreg,
				      int phydata)
{
	unsigned int mii_address = mac->mii.addr;
@@ -3610,7 +3625,7 @@ int rnpgbe_mac_mdio_write_n500(struct rnpgbe_mac_info *mac, int phyreg,
	return poll_free_mdio(mac->mac_addr + mii_address, MII_BUSY, 100);
}

void rnpgbe_mac_pmt_n500(struct rnpgbe_mac_info *mac, u32 mode, bool ncsi_en)
static void rnpgbe_mac_pmt_n500(struct rnpgbe_mac_info *mac, u32 mode, bool ncsi_en)
{
	unsigned int pmt = 0;

@@ -3654,7 +3669,7 @@ static void rnpgbe_mac_reset_eee_mode_n500(struct rnpgbe_mac_info *mac)
	mac_wr32(mac, GMAC_LPI_CTRL_STATUS, value);
}

void rnpgbe_mac_set_eee_timer_n500(struct rnpgbe_mac_info *mac, int ls, int tw)
static void rnpgbe_mac_set_eee_timer_n500(struct rnpgbe_mac_info *mac, int ls, int tw)
{
	int value = ((tw & 0xffff)) | ((ls & 0x7ff) << 16);

+0 −81
Original line number Diff line number Diff line
@@ -29,13 +29,11 @@ struct rnpgbe_adapter;
#define desc_hex_dump(msg, buf, len)                                           \
	print_hex_dump(KERN_WARNING, msg, DUMP_PREFIX_OFFSET, 16, 1, (buf),    \
		       (len), false)
#define rnpgbe_skb_dump _rnpgbe_skb_dump

#define tx_dbg(fmt, args...)                                                   \
	printk(KERN_DEBUG "[ %s:%d ] " fmt, __func__, __LINE__, ##args)
#else
#define desc_hex_dump(msg, buf, len)
#define rnpgbe_skb_dump(skb, full_pkt)
#define tx_dbg(fmt, args...)
#endif /* CONFIG_RNP_TX_DEBUG */

@@ -262,85 +260,6 @@ static inline void buf_dump(const char *msg, void *buf, int len)
	printk(KERN_DEBUG "%s\n", msg_buf);
}

#ifndef NO_SKB_DUMP
static inline void _rnpgbe_skb_dump(const struct sk_buff *skb, bool full_pkt)
{
	static atomic_t can_dump_full = ATOMIC_INIT(5);
#ifdef DEBUG
	struct skb_shared_info *sh = skb_shinfo(skb);
#endif
	struct net_device *dev = skb->dev;
	//struct sock *sk = skb->sk;
	struct sk_buff *list_skb;
	bool has_mac, has_trans;
	int headroom, tailroom;
	int i, len, seg_len;
	const char *level = KERN_WARNING;

	if (full_pkt)
		full_pkt = atomic_dec_if_positive(&can_dump_full) >= 0;

	if (full_pkt)
		len = skb->len;
	else
		len = min_t(int, skb->len, MAX_HEADER + 128);

	headroom = skb_headroom(skb);
	tailroom = skb_tailroom(skb);

	has_mac = skb_mac_header_was_set(skb);
	has_trans = skb_transport_header_was_set(skb);

	dbg("%sskb len=%u headroom=%u headlen=%u tailroom=%u\n"
	    "mac=(%d,%d) net=(%d,%d) trans=%d\n"
	    "shinfo(txflags=%u nr_frags=%u gso(size=%hu type=%u segs=%hu))\n"
	    "csum(0x%x ip_summed=%u complete_sw=%u valid=%u level=%u)\n"
	    "hash(0x%x sw=%u l4=%u) proto=0x%04x pkttype=%u iif=%d\n",
	    level, skb->len, headroom, skb_headlen(skb), tailroom,
	    has_mac ? skb->mac_header : -1,
	    has_mac ? (skb->network_header - skb->mac_header) : -1,
	    skb->network_header, has_trans ? skb_network_header_len(skb) : -1,
	    has_trans ? skb->transport_header : -1, sh->tx_flags, sh->nr_frags,
	    sh->gso_size, sh->gso_type, sh->gso_segs, skb->csum, skb->ip_summed,
	    skb->csum_complete_sw, skb->csum_valid, skb->csum_level, skb->hash,
	    skb->sw_hash, skb->l4_hash, ntohs(skb->protocol), skb->pkt_type,
	    skb->skb_iif);

	if (dev)
		dbg("%sdev name=%s feat=0x%pNF\n", level, dev->name,
		    &dev->features);

	seg_len = min_t(int, skb_headlen(skb), len);
	if (seg_len)
		print_hex_dump(level, "skb linear:   ", DUMP_PREFIX_OFFSET, 16,
			       1, skb->data, seg_len, false);
	len -= seg_len;

	for (i = 0; len && i < skb_shinfo(skb)->nr_frags; i++) {
		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
		u32 p_len;
		struct page *p;
		u8 *vaddr;

		p = skb_frag_address(frag);
		p_len = skb_frag_size(frag);
		seg_len = min_t(int, p_len, len);
		vaddr = kmap_atomic(p);
		print_hex_dump(level, "skb frag:     ", DUMP_PREFIX_OFFSET, 16,
			       1, vaddr, seg_len, false);
		kunmap_atomic(vaddr);
		len -= seg_len;
		if (!len)
			break;
	}

	if (full_pkt && skb_has_frag_list(skb)) {
		dbg("skb fraglist:\n");
		skb_walk_frags(skb, list_skb) _rnpgbe_skb_dump(list_skb, true);
	}
}
#endif

enum RNP_LOG_EVT {
	LOG_MBX_IN,
	LOG_MBX_OUT,
+1 −1
Original line number Diff line number Diff line
@@ -1538,7 +1538,7 @@ int rnpgbe_update_ethtool_fdir_entry(struct rnpgbe_adapter *adapter,
	/* setup hw */
	hlist_for_each_entry_safe(rule, node2, &adapter->fdir_filter_list,
				  fdir_node) {
		if (netif_running(adapter->netdev))
		if (!netif_running(adapter->netdev))
			break;
		/* hw_idx */
		if (rule->filter.formatted.flow_type == RNP_ATR_FLOW_TYPE_ETHER)
+10 −12
Original line number Diff line number Diff line
@@ -305,7 +305,7 @@ static void rnpgbe_set_num_queues(struct rnpgbe_adapter *adapter)
	rnpgbe_set_rss_queues(adapter);
}

int rnpgbe_acquire_msix_vectors(struct rnpgbe_adapter *adapter, int vectors)
static int rnpgbe_acquire_msix_vectors(struct rnpgbe_adapter *adapter, int vectors)
{
	int err;

@@ -341,12 +341,11 @@ static void rnpgbe_add_ring(struct rnpgbe_ring *ring,
/**
 * rnpgbe_alloc_q_vector - Allocate memory for a single interrupt vector
 * @adapter: board private structure to initialize
 * @v_count: q_vectors allocated on adapter, used for ring interleaving
 * @eth_queue_idx: eth queue idx
 * @v_idx: index of vector in adapter struct
 * @txr_count: total number of Tx rings to allocate
 * @txr_idx: index of first Tx ring to allocate
 * @rxr_count: total number of Rx rings to allocate
 * @rxr_idx: index of first Rx ring to allocate
 * @r_idx: index of first Tx ring to allocate
 * @r_count: total number of Rx rings to allocate
 * @step: ring step
 *
 * We allocate one q_vector.  If allocation fails we return -ENOMEM.
 **/
@@ -716,7 +715,7 @@ int rnpgbe_set_interrupt_capability(struct rnpgbe_adapter *adapter)
	return err;
}

void update_ring_count(struct rnpgbe_adapter *adapter)
static void update_ring_count(struct rnpgbe_adapter *adapter)
{
	if (adapter->flags2 & RNP_FLAG2_INSMOD)
		return;
@@ -799,11 +798,10 @@ void rnpgbe_clear_interrupt_scheme(struct rnpgbe_adapter *adapter)
/**
 * rnpgbe_tx_ctxtdesc - Send a control desc to hw
 * @tx_ring: target ring of this control desc
 * @mss_seg_len: mss length
 * @l4_hdr_len:  l4 length
 * @tunnel_hdr_len: tunnel_hdr_len
 * @inner_vlan_tag: inner_vlan_tag
 * @type_tucmd: cmd
 * @mss_len_vf_num: mss length
 * @inner_vlan_tunnel_len: inner vlan tunnel length
 * @ignore_vlan: ignore vlan flag
 * @crc_pad: padding flag
 *
 **/

Loading