Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c44ade9e authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by Jeff Garzik
Browse files

ixgbe: update to latest common code module



This is a massive update that includes infrastructure for further patches
where we will add support for more phy types and eeprom types.

This code is shared as much as possible with other drivers, so the code may
seem a little obtuse at times but wherever possible we keep to the linux
style and methods.

Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent f0848276
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -41,8 +41,6 @@
#include <linux/dca.h>
#include <linux/dca.h>
#endif
#endif


#define IXGBE_ERR(args...) printk(KERN_ERR "ixgbe: " args)

#define PFX "ixgbe: "
#define PFX "ixgbe: "
#define DPRINTK(nlevel, klevel, fmt, args...) \
#define DPRINTK(nlevel, klevel, fmt, args...) \
	((void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
	((void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
+507 −93

File changed.

Preview size limit exceeded, changes collapsed.

+608 −306

File changed.

Preview size limit exceeded, changes collapsed.

+34 −25
Original line number Original line Diff line number Diff line
@@ -31,36 +31,45 @@


#include "ixgbe_type.h"
#include "ixgbe_type.h"


s32 ixgbe_init_hw(struct ixgbe_hw *hw);
s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw);
s32 ixgbe_start_hw(struct ixgbe_hw *hw);
s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw);
s32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr);
s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw);
s32 ixgbe_stop_adapter(struct ixgbe_hw *hw);
s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw);
s32 ixgbe_read_part_num(struct ixgbe_hw *hw, u32 *part_num);
s32 ixgbe_read_pba_num_generic(struct ixgbe_hw *hw, u32 *pba_num);

s32 ixgbe_get_mac_addr_generic(struct ixgbe_hw *hw, u8 *mac_addr);
s32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index);
s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw);
s32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index);
s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw);


s32 ixgbe_init_eeprom(struct ixgbe_hw *hw);
s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index);
s32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data);
s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index);
s32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val);


s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw);
s32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vind,
s32 ixgbe_read_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 *data);
s32 ixgbe_read_eeprom_bit_bang_generic(struct ixgbe_hw *hw, u16 offset,
                                       u16 *data);
s32 ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw,
                                           u16 *checksum_val);
s32 ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw);

s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
                          u32 enable_addr);
                          u32 enable_addr);
s32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
s32 ixgbe_clear_rar_generic(struct ixgbe_hw *hw, u32 index);
			      u32 mc_addr_count, ixgbe_mc_addr_itr next);
s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw);
s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *uc_addr_list,
s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
			      u32 mc_addr_count, ixgbe_mc_addr_itr next);
                                      u32 mc_addr_count,
s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on);
                                      ixgbe_mc_addr_itr func);
s32 ixgbe_validate_mac_addr(u8 *mac_addr);
s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list,

                                      u32 addr_count, ixgbe_mc_addr_itr func);
s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packtetbuf_num);
s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw);
s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw);


s32 ixgbe_validate_mac_addr(u8 *mac_addr);
s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask);
s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask);
void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask);
void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask);
s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw);
s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw);


s32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val);
s32 ixgbe_read_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 *val);
s32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val);
s32 ixgbe_write_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 val);


#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg)))


+11 −9
Original line number Original line Diff line number Diff line
@@ -128,9 +128,10 @@ static int ixgbe_get_settings(struct net_device *netdev,
		ecmd->advertising = (ADVERTISED_10000baseT_Full |
		ecmd->advertising = (ADVERTISED_10000baseT_Full |
				     ADVERTISED_FIBRE);
				     ADVERTISED_FIBRE);
		ecmd->port = PORT_FIBRE;
		ecmd->port = PORT_FIBRE;
		ecmd->autoneg = AUTONEG_DISABLE;
	}
	}


	adapter->hw.mac.ops.check_link(hw, &(link_speed), &link_up, false);
	hw->mac.ops.check_link(hw, &link_speed, &link_up, false);
	if (link_up) {
	if (link_up) {
		ecmd->speed = (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ?
		ecmd->speed = (link_speed == IXGBE_LINK_SPEED_10GB_FULL) ?
				SPEED_10000 : SPEED_1000;
				SPEED_10000 : SPEED_1000;
@@ -327,7 +328,7 @@ static void ixgbe_get_regs(struct net_device *netdev,
	regs_buff[25] = IXGBE_READ_REG(hw, IXGBE_IVAR(0));
	regs_buff[25] = IXGBE_READ_REG(hw, IXGBE_IVAR(0));
	regs_buff[26] = IXGBE_READ_REG(hw, IXGBE_MSIXT);
	regs_buff[26] = IXGBE_READ_REG(hw, IXGBE_MSIXT);
	regs_buff[27] = IXGBE_READ_REG(hw, IXGBE_MSIXPBA);
	regs_buff[27] = IXGBE_READ_REG(hw, IXGBE_MSIXPBA);
	regs_buff[28] = IXGBE_READ_REG(hw, IXGBE_PBACL);
	regs_buff[28] = IXGBE_READ_REG(hw, IXGBE_PBACL(0));
	regs_buff[29] = IXGBE_READ_REG(hw, IXGBE_GPIE);
	regs_buff[29] = IXGBE_READ_REG(hw, IXGBE_GPIE);


	/* Flow Control */
	/* Flow Control */
@@ -373,7 +374,7 @@ static void ixgbe_get_regs(struct net_device *netdev,
		regs_buff[482 + i] = IXGBE_READ_REG(hw, IXGBE_RAL(i));
		regs_buff[482 + i] = IXGBE_READ_REG(hw, IXGBE_RAL(i));
	for (i = 0; i < 16; i++)
	for (i = 0; i < 16; i++)
		regs_buff[498 + i] = IXGBE_READ_REG(hw, IXGBE_RAH(i));
		regs_buff[498 + i] = IXGBE_READ_REG(hw, IXGBE_RAH(i));
	regs_buff[514] = IXGBE_READ_REG(hw, IXGBE_PSRTYPE);
	regs_buff[514] = IXGBE_READ_REG(hw, IXGBE_PSRTYPE(0));
	regs_buff[515] = IXGBE_READ_REG(hw, IXGBE_FCTRL);
	regs_buff[515] = IXGBE_READ_REG(hw, IXGBE_FCTRL);
	regs_buff[516] = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
	regs_buff[516] = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
	regs_buff[517] = IXGBE_READ_REG(hw, IXGBE_MCSTCTRL);
	regs_buff[517] = IXGBE_READ_REG(hw, IXGBE_MCSTCTRL);
@@ -605,7 +606,7 @@ static int ixgbe_get_eeprom(struct net_device *netdev,
		return -ENOMEM;
		return -ENOMEM;


	for (i = 0; i < eeprom_len; i++) {
	for (i = 0; i < eeprom_len; i++) {
		if ((ret_val = ixgbe_read_eeprom(hw, first_word + i,
		if ((ret_val = hw->eeprom.ops.read(hw, first_word + i,
						   &eeprom_buff[i])))
						   &eeprom_buff[i])))
			break;
			break;
	}
	}
@@ -807,7 +808,7 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
			      u8 *data)
			      u8 *data)
{
{
	struct ixgbe_adapter *adapter = netdev_priv(netdev);
	struct ixgbe_adapter *adapter = netdev_priv(netdev);
	u8 *p = data;
	char *p = (char *)data;
	int i;
	int i;


	switch (stringset) {
	switch (stringset) {
@@ -857,16 +858,17 @@ static int ixgbe_nway_reset(struct net_device *netdev)
static int ixgbe_phys_id(struct net_device *netdev, u32 data)
static int ixgbe_phys_id(struct net_device *netdev, u32 data)
{
{
	struct ixgbe_adapter *adapter = netdev_priv(netdev);
	struct ixgbe_adapter *adapter = netdev_priv(netdev);
	u32 led_reg = IXGBE_READ_REG(&adapter->hw, IXGBE_LEDCTL);
	struct ixgbe_hw *hw = &adapter->hw;
	u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
	u32 i;
	u32 i;


	if (!data || data > 300)
	if (!data || data > 300)
		data = 300;
		data = 300;


	for (i = 0; i < (data * 1000); i += 400) {
	for (i = 0; i < (data * 1000); i += 400) {
		ixgbe_led_on(&adapter->hw, IXGBE_LED_ON);
		hw->mac.ops.led_on(hw, IXGBE_LED_ON);
		msleep_interruptible(200);
		msleep_interruptible(200);
		ixgbe_led_off(&adapter->hw, IXGBE_LED_ON);
		hw->mac.ops.led_off(hw, IXGBE_LED_ON);
		msleep_interruptible(200);
		msleep_interruptible(200);
	}
	}


Loading