Commit 35d499ee authored by David S. Miller's avatar David S. Miller

Merge git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates

This series contains updates to igb, ixgbe, ixgbevf, i40e and i40evf.

Anjali provides a i40e/i40evf patch to add Energy Efficient Ethernet
Low Power Idle stats and a fix for i40e to change the string
"Side Band" to "Sideband" for consistency.

Mitch provides 2 patches for i40evf to fix if the driver encounters
an error while communicating with the PF driver, do not shut down the
admin queue unconditionally.  Add an error message when the admin
queue message never completes and fix formatting on another message
that was unnecessarily wrapped.

Mark provides a ixgbe patch and five ixgbevf patches.  Fix a possible
infinite recursion when an adapter is removed and registers all read
as all one's in ixgbe_clear_vmdq_generic() and ixgbe_clear_rar_generic().
Converts macros to static inline functions to align kernel coding standard
and prepare for adding Live Error Recovery (LER) to ixgbevf.  Change the
ethtool register test to use the normal register accessor functions and
eliminate macors used for calling register test functions to make error
exits more clear.  Checks all register reads for adapter removal by checking
the status register after any register read that returns all F's since the
status register will never return 0xFFFFFFFF unless the adapter is removed.

Jacob implements SIOCGHWTSTAMP ioctl for igb which enables user processes
to read the current hardware stamp config settings non-destructively.

Todd adds the initial register read and write for surprise removal (LER)
for igb.

Christian Engelmayer fixes an igb memory leak in the igb_get_module_eeprom()
error handling path.

Ken Ichikawa provides a fix for igb, specifically for 82575 hardware to
specify -1 to the phc_index for ethtool's get_ts_info, otherwise a wrong
value will be set to the phc_index.

Christopher Paasch fixes a null pointer dereference in igb and makes sure
to unset the HAS_MSIX flag when the driver falls back to MSI only.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0b8c7f6f b709323d
...@@ -114,6 +114,11 @@ static struct i40e_stats i40e_gstrings_stats[] = { ...@@ -114,6 +114,11 @@ static struct i40e_stats i40e_gstrings_stats[] = {
I40E_PF_STAT("VF_admin_queue_requests", vf_aq_requests), I40E_PF_STAT("VF_admin_queue_requests", vf_aq_requests),
I40E_PF_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts), I40E_PF_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts),
I40E_PF_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared), I40E_PF_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared),
/* LPI stats */
I40E_PF_STAT("tx_lpi_status", stats.tx_lpi_status),
I40E_PF_STAT("rx_lpi_status", stats.rx_lpi_status),
I40E_PF_STAT("tx_lpi_count", stats.tx_lpi_count),
I40E_PF_STAT("rx_lpi_count", stats.rx_lpi_count),
}; };
#define I40E_QUEUE_STATS_LEN(n) \ #define I40E_QUEUE_STATS_LEN(n) \
......
...@@ -740,6 +740,7 @@ void i40e_update_stats(struct i40e_vsi *vsi) ...@@ -740,6 +740,7 @@ void i40e_update_stats(struct i40e_vsi *vsi)
u32 rx_page, rx_buf; u32 rx_page, rx_buf;
u64 rx_p, rx_b; u64 rx_p, rx_b;
u64 tx_p, tx_b; u64 tx_p, tx_b;
u32 val;
int i; int i;
u16 q; u16 q;
...@@ -972,6 +973,20 @@ void i40e_update_stats(struct i40e_vsi *vsi) ...@@ -972,6 +973,20 @@ void i40e_update_stats(struct i40e_vsi *vsi)
i40e_stat_update32(hw, I40E_GLPRT_RJC(hw->port), i40e_stat_update32(hw, I40E_GLPRT_RJC(hw->port),
pf->stat_offsets_loaded, pf->stat_offsets_loaded,
&osd->rx_jabber, &nsd->rx_jabber); &osd->rx_jabber, &nsd->rx_jabber);
val = rd32(hw, I40E_PRTPM_EEE_STAT);
nsd->tx_lpi_status =
(val & I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_MASK) >>
I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_SHIFT;
nsd->rx_lpi_status =
(val & I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_MASK) >>
I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_SHIFT;
i40e_stat_update32(hw, I40E_PRTPM_TLPIC,
pf->stat_offsets_loaded,
&osd->tx_lpi_count, &nsd->tx_lpi_count);
i40e_stat_update32(hw, I40E_PRTPM_RLPIC,
pf->stat_offsets_loaded,
&osd->rx_lpi_count, &nsd->rx_lpi_count);
} }
pf->stat_offsets_loaded = true; pf->stat_offsets_loaded = true;
...@@ -6381,7 +6396,7 @@ static int i40e_sw_init(struct i40e_pf *pf) ...@@ -6381,7 +6396,7 @@ static int i40e_sw_init(struct i40e_pf *pf)
pf->flags |= I40E_FLAG_FD_SB_ENABLED; pf->flags |= I40E_FLAG_FD_SB_ENABLED;
} else { } else {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"Flow Director Side Band mode Disabled in MFP mode\n"); "Flow Director Sideband mode Disabled in MFP mode\n");
} }
pf->fdir_pf_filter_count = pf->fdir_pf_filter_count =
pf->hw.func_caps.fd_filters_guaranteed; pf->hw.func_caps.fd_filters_guaranteed;
......
...@@ -1014,6 +1014,11 @@ struct i40e_hw_port_stats { ...@@ -1014,6 +1014,11 @@ struct i40e_hw_port_stats {
u64 tx_size_big; /* ptc9522 */ u64 tx_size_big; /* ptc9522 */
u64 mac_short_packet_dropped; /* mspdc */ u64 mac_short_packet_dropped; /* mspdc */
u64 checksum_error; /* xec */ u64 checksum_error; /* xec */
/* EEE LPI */
bool tx_lpi_status;
bool rx_lpi_status;
u64 tx_lpi_count; /* etlpic */
u64 rx_lpi_count; /* erlpic */
}; };
/* Checksum and Shadow RAM pointers */ /* Checksum and Shadow RAM pointers */
......
...@@ -1020,6 +1020,11 @@ struct i40e_hw_port_stats { ...@@ -1020,6 +1020,11 @@ struct i40e_hw_port_stats {
u64 tx_size_big; /* ptc9522 */ u64 tx_size_big; /* ptc9522 */
u64 mac_short_packet_dropped; /* mspdc */ u64 mac_short_packet_dropped; /* mspdc */
u64 checksum_error; /* xec */ u64 checksum_error; /* xec */
/* EEE LPI */
bool tx_lpi_status;
bool rx_lpi_status;
u64 tx_lpi_count; /* etlpic */
u64 rx_lpi_count; /* erlpic */
}; };
/* Checksum and Shadow RAM pointers */ /* Checksum and Shadow RAM pointers */
......
...@@ -1968,8 +1968,7 @@ static void i40evf_init_task(struct work_struct *work) ...@@ -1968,8 +1968,7 @@ static void i40evf_init_task(struct work_struct *work)
} }
err = i40evf_send_api_ver(adapter); err = i40evf_send_api_ver(adapter);
if (err) { if (err) {
dev_err(&pdev->dev, "Unable to send to PF (%d)\n", dev_err(&pdev->dev, "Unable to send to PF (%d)\n", err);
err);
i40evf_shutdown_adminq(hw); i40evf_shutdown_adminq(hw);
goto err; goto err;
} }
...@@ -1977,8 +1976,10 @@ static void i40evf_init_task(struct work_struct *work) ...@@ -1977,8 +1976,10 @@ static void i40evf_init_task(struct work_struct *work)
goto restart; goto restart;
break; break;
case __I40EVF_INIT_VERSION_CHECK: case __I40EVF_INIT_VERSION_CHECK:
if (!i40evf_asq_done(hw)) if (!i40evf_asq_done(hw)) {
dev_err(&pdev->dev, "Admin queue command never completed.\n");
goto err; goto err;
}
/* aq msg sent, awaiting reply */ /* aq msg sent, awaiting reply */
err = i40evf_verify_api_ver(adapter); err = i40evf_verify_api_ver(adapter);
...@@ -2133,8 +2134,6 @@ static void i40evf_init_task(struct work_struct *work) ...@@ -2133,8 +2134,6 @@ static void i40evf_init_task(struct work_struct *work)
kfree(adapter->vf_res); kfree(adapter->vf_res);
adapter->vf_res = NULL; adapter->vf_res = NULL;
err: err:
if (hw->aq.asq.count)
i40evf_shutdown_adminq(hw); /* ignore error */
/* Things went into the weeds, so try again later */ /* Things went into the weeds, so try again later */
if (++adapter->aq_wait_count > I40EVF_AQ_MAX_ERR) { if (++adapter->aq_wait_count > I40EVF_AQ_MAX_ERR) {
dev_err(&pdev->dev, "Failed to communicate with PF; giving up.\n"); dev_err(&pdev->dev, "Failed to communicate with PF; giving up.\n");
......
...@@ -362,12 +362,25 @@ ...@@ -362,12 +362,25 @@
* Filter - RW */ * Filter - RW */
#define E1000_VMVIR(_n) (0x03700 + (4 * (_n))) #define E1000_VMVIR(_n) (0x03700 + (4 * (_n)))
#define wr32(reg, value) (writel(value, hw->hw_addr + reg)) struct e1000_hw;
#define rd32(reg) (readl(hw->hw_addr + reg))
u32 igb_rd32(struct e1000_hw *hw, u32 reg);
/* write operations, indexed using DWORDS */
#define wr32(reg, val) \
do { \
u8 __iomem *hw_addr = ACCESS_ONCE((hw)->hw_addr); \
if (!E1000_REMOVED(hw_addr)) \
writel((val), &hw_addr[(reg)]); \
} while (0)
#define rd32(reg) (igb_rd32(hw, reg))
#define wrfl() ((void)rd32(E1000_STATUS)) #define wrfl() ((void)rd32(E1000_STATUS))
#define array_wr32(reg, offset, value) \ #define array_wr32(reg, offset, value) \
(writel(value, hw->hw_addr + reg + ((offset) << 2))) wr32((reg) + ((offset) << 2), (value))
#define array_rd32(reg, offset) \ #define array_rd32(reg, offset) \
(readl(hw->hw_addr + reg + ((offset) << 2))) (readl(hw->hw_addr + reg + ((offset) << 2)))
...@@ -406,4 +419,6 @@ ...@@ -406,4 +419,6 @@
#define E1000_INVM_DATA_REG(_n) (0x12120 + 4*(_n)) #define E1000_INVM_DATA_REG(_n) (0x12120 + 4*(_n))
#define E1000_INVM_SIZE 64 /* Number of INVM Data Registers */ #define E1000_INVM_SIZE 64 /* Number of INVM Data Registers */
#define E1000_REMOVED(h) unlikely(!(h))
#endif #endif
...@@ -434,6 +434,7 @@ struct igb_adapter { ...@@ -434,6 +434,7 @@ struct igb_adapter {
struct delayed_work ptp_overflow_work; struct delayed_work ptp_overflow_work;
struct work_struct ptp_tx_work; struct work_struct ptp_tx_work;
struct sk_buff *ptp_tx_skb; struct sk_buff *ptp_tx_skb;
struct hwtstamp_config tstamp_config;
unsigned long ptp_tx_start; unsigned long ptp_tx_start;
unsigned long last_rx_ptp_check; unsigned long last_rx_ptp_check;
spinlock_t tmreg_lock; spinlock_t tmreg_lock;
...@@ -545,8 +546,8 @@ static inline void igb_ptp_rx_hwtstamp(struct igb_ring *rx_ring, ...@@ -545,8 +546,8 @@ static inline void igb_ptp_rx_hwtstamp(struct igb_ring *rx_ring,
rx_ring->last_rx_timestamp = jiffies; rx_ring->last_rx_timestamp = jiffies;
} }
int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
int cmd); int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
#ifdef CONFIG_IGB_HWMON #ifdef CONFIG_IGB_HWMON
void igb_sysfs_exit(struct igb_adapter *adapter); void igb_sysfs_exit(struct igb_adapter *adapter);
int igb_sysfs_init(struct igb_adapter *adapter); int igb_sysfs_init(struct igb_adapter *adapter);
......
...@@ -2353,6 +2353,11 @@ static int igb_get_ts_info(struct net_device *dev, ...@@ -2353,6 +2353,11 @@ static int igb_get_ts_info(struct net_device *dev,
{ {
struct igb_adapter *adapter = netdev_priv(dev); struct igb_adapter *adapter = netdev_priv(dev);
if (adapter->ptp_clock)
info->phc_index = ptp_clock_index(adapter->ptp_clock);
else
info->phc_index = -1;
switch (adapter->hw.mac.type) { switch (adapter->hw.mac.type) {
case e1000_82575: case e1000_82575:
info->so_timestamping = info->so_timestamping =
...@@ -2374,11 +2379,6 @@ static int igb_get_ts_info(struct net_device *dev, ...@@ -2374,11 +2379,6 @@ static int igb_get_ts_info(struct net_device *dev,
SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_RX_HARDWARE |
SOF_TIMESTAMPING_RAW_HARDWARE; SOF_TIMESTAMPING_RAW_HARDWARE;
if (adapter->ptp_clock)
info->phc_index = ptp_clock_index(adapter->ptp_clock);
else
info->phc_index = -1;
info->tx_types = info->tx_types =
(1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_OFF) |
(1 << HWTSTAMP_TX_ON); (1 << HWTSTAMP_TX_ON);
...@@ -2791,9 +2791,11 @@ static int igb_get_module_eeprom(struct net_device *netdev, ...@@ -2791,9 +2791,11 @@ static int igb_get_module_eeprom(struct net_device *netdev,
/* Read EEPROM block, SFF-8079/SFF-8472, word at a time */ /* Read EEPROM block, SFF-8079/SFF-8472, word at a time */
for (i = 0; i < last_word - first_word + 1; i++) { for (i = 0; i < last_word - first_word + 1; i++) {
status = igb_read_phy_reg_i2c(hw, first_word + i, &dataword[i]); status = igb_read_phy_reg_i2c(hw, first_word + i, &dataword[i]);
if (status != E1000_SUCCESS) if (status != E1000_SUCCESS) {
/* Error occurred while reading module */ /* Error occurred while reading module */
kfree(dataword);
return -EIO; return -EIO;
}
be16_to_cpus(&dataword[i]); be16_to_cpus(&dataword[i]);
} }
......
...@@ -751,6 +751,28 @@ static void igb_cache_ring_register(struct igb_adapter *adapter) ...@@ -751,6 +751,28 @@ static void igb_cache_ring_register(struct igb_adapter *adapter)
} }
} }
u32 igb_rd32(struct e1000_hw *hw, u32 reg)
{
struct igb_adapter *igb = container_of(hw, struct igb_adapter, hw);
u8 __iomem *hw_addr = ACCESS_ONCE(hw->hw_addr);
u32 value = 0;
if (E1000_REMOVED(hw_addr))
return ~value;
value = readl(&hw_addr[reg]);
/* reads should not return all F's */
if (!(~value) && (!reg || !(~readl(hw_addr)))) {
struct net_device *netdev = igb->netdev;
hw->hw_addr = NULL;
netif_device_detach(netdev);
netdev_err(netdev, "PCIe link lost, device now detached\n");
}
return value;
}
/** /**
* igb_write_ivar - configure ivar for given MSI-X vector * igb_write_ivar - configure ivar for given MSI-X vector
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
...@@ -1013,6 +1035,12 @@ static void igb_reset_q_vector(struct igb_adapter *adapter, int v_idx) ...@@ -1013,6 +1035,12 @@ static void igb_reset_q_vector(struct igb_adapter *adapter, int v_idx)
{ {
struct igb_q_vector *q_vector = adapter->q_vector[v_idx]; struct igb_q_vector *q_vector = adapter->q_vector[v_idx];
/* Coming from igb_set_interrupt_capability, the vectors are not yet
* allocated. So, q_vector is NULL so we should stop here.
*/
if (!q_vector)
return;
if (q_vector->tx.ring) if (q_vector->tx.ring)
adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL; adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL;
...@@ -1121,6 +1149,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix) ...@@ -1121,6 +1149,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
/* If we can't do MSI-X, try MSI */ /* If we can't do MSI-X, try MSI */
msi_only: msi_only:
adapter->flags &= ~IGB_FLAG_HAS_MSIX;
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
/* disable SR-IOV for non MSI-X configurations */ /* disable SR-IOV for non MSI-X configurations */
if (adapter->vf_data) { if (adapter->vf_data) {
...@@ -7162,8 +7191,10 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) ...@@ -7162,8 +7191,10 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
case SIOCGMIIREG: case SIOCGMIIREG:
case SIOCSMIIREG: case SIOCSMIIREG:
return igb_mii_ioctl(netdev, ifr, cmd); return igb_mii_ioctl(netdev, ifr, cmd);
case SIOCGHWTSTAMP:
return igb_ptp_get_ts_config(netdev, ifr);
case SIOCSHWTSTAMP: case SIOCSHWTSTAMP:
return igb_ptp_hwtstamp_ioctl(netdev, ifr, cmd); return igb_ptp_set_ts_config(netdev, ifr);
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -541,10 +541,26 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, ...@@ -541,10 +541,26 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector,
} }
/** /**
* igb_ptp_hwtstamp_ioctl - control hardware time stamping * igb_ptp_get_ts_config - get hardware time stamping config
* @netdev:
* @ifreq:
*
* Get the hwtstamp_config settings to return to the user. Rather than attempt
* to deconstruct the settings from the registers, just return a shadow copy
* of the last known settings.
**/
int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr)
{
struct igb_adapter *adapter = netdev_priv(netdev);
struct hwtstamp_config *config = &adapter->tstamp_config;
return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ?
-EFAULT : 0;
}
/**
* igb_ptp_set_ts_config - control hardware time stamping
* @netdev: * @netdev:
* @ifreq: * @ifreq:
* @cmd:
* *
* Outgoing time stamping can be enabled and disabled. Play nice and * Outgoing time stamping can be enabled and disabled. Play nice and
* disable it when requested, although it shouldn't case any overhead * disable it when requested, although it shouldn't case any overhead
...@@ -558,12 +574,11 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, ...@@ -558,12 +574,11 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector,
* not supported, with the exception of "all V2 events regardless of * not supported, with the exception of "all V2 events regardless of
* level 2 or 4". * level 2 or 4".
**/ **/
int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr)
struct ifreq *ifr, int cmd)
{ {
struct igb_adapter *adapter = netdev_priv(netdev); struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
struct hwtstamp_config config; struct hwtstamp_config *config = &adapter->tstamp_config;
u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED; u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED;
u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
u32 tsync_rx_cfg = 0; u32 tsync_rx_cfg = 0;
...@@ -571,14 +586,14 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, ...@@ -571,14 +586,14 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
bool is_l2 = false; bool is_l2 = false;
u32 regval; u32 regval;
if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) if (copy_from_user(config, ifr->ifr_data, sizeof(*config)))
return -EFAULT; return -EFAULT;
/* reserved for future extensions */ /* reserved for future extensions */
if (config.flags) if (config->flags)
return -EINVAL; return -EINVAL;
switch (config.tx_type) { switch (config->tx_type) {
case HWTSTAMP_TX_OFF: case HWTSTAMP_TX_OFF:
tsync_tx_ctl = 0; tsync_tx_ctl = 0;
case HWTSTAMP_TX_ON: case HWTSTAMP_TX_ON:
...@@ -587,7 +602,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, ...@@ -587,7 +602,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
return -ERANGE; return -ERANGE;
} }
switch (config.rx_filter) { switch (config->rx_filter) {
case HWTSTAMP_FILTER_NONE: case HWTSTAMP_FILTER_NONE:
tsync_rx_ctl = 0; tsync_rx_ctl = 0;
break; break;
...@@ -611,7 +626,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, ...@@ -611,7 +626,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_EVENT_V2; tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_EVENT_V2;
config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
is_l2 = true; is_l2 = true;
is_l4 = true; is_l4 = true;
break; break;
...@@ -622,12 +637,12 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, ...@@ -622,12 +637,12 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
*/ */
if (hw->mac.type != e1000_82576) { if (hw->mac.type != e1000_82576) {
tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL; tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL;
config.rx_filter = HWTSTAMP_FILTER_ALL; config->rx_filter = HWTSTAMP_FILTER_ALL;
break; break;
} }
/* fall through */ /* fall through */
default: default:
config.rx_filter = HWTSTAMP_FILTER_NONE; config->rx_filter = HWTSTAMP_FILTER_NONE;
return -ERANGE; return -ERANGE;
} }
...@@ -644,7 +659,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, ...@@ -644,7 +659,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) { if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) {
tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL; tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL;
config.rx_filter = HWTSTAMP_FILTER_ALL; config->rx_filter = HWTSTAMP_FILTER_ALL;
is_l2 = true; is_l2 = true;
is_l4 = true; is_l4 = true;
...@@ -708,7 +723,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, ...@@ -708,7 +723,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
regval = rd32(E1000_RXSTMPL); regval = rd32(E1000_RXSTMPL);
regval = rd32(E1000_RXSTMPH); regval = rd32(E1000_RXSTMPH);
return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ?
-EFAULT : 0; -EFAULT : 0;
} }
...@@ -865,6 +880,9 @@ void igb_ptp_reset(struct igb_adapter *adapter) ...@@ -865,6 +880,9 @@ void igb_ptp_reset(struct igb_adapter *adapter)
if (!(adapter->flags & IGB_FLAG_PTP)) if (!(adapter->flags & IGB_FLAG_PTP))
return; return;
/* reset the tstamp_config */
memset(&adapter->tstamp_config, 0, sizeof(adapter->tstamp_config));
switch (adapter->hw.mac.type) { switch (adapter->hw.mac.type) {
case e1000_82576: case e1000_82576:
/* Dial the nominal frequency. */ /* Dial the nominal frequency. */
......
...@@ -2913,6 +2913,9 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq) ...@@ -2913,6 +2913,9 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar));
mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar));
if (ixgbe_removed(hw->hw_addr))
goto done;
if (!mpsar_lo && !mpsar_hi) if (!mpsar_lo && !mpsar_hi)
goto done; goto done;
......
/******************************************************************************* /*******************************************************************************
Intel 82599 Virtual Function driver Intel 82599 Virtual Function driver
Copyright(c) 1999 - 2012 Intel Corporation. Copyright(c) 1999 - 2014 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -530,41 +530,55 @@ static const u32 register_test_patterns[] = { ...@@ -530,41 +530,55 @@ static const u32 register_test_patterns[] = {
0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF 0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF
}; };
#define REG_PATTERN_TEST(R, M, W) \ static bool reg_pattern_test(struct ixgbevf_adapter *adapter, u64 *data,
{ \ int reg, u32 mask, u32 write)
u32 pat, val, before; \ {
for (pat = 0; pat < ARRAY_SIZE(register_test_patterns); pat++) { \ u32 pat, val, before;
before = readl(adapter->hw.hw_addr + R); \
writel((register_test_patterns[pat] & W), \ if (IXGBE_REMOVED(adapter->hw.hw_addr)) {
(adapter->hw.hw_addr + R)); \ *data = 1;
val = readl(adapter->hw.hw_addr + R); \ return true;
if (val != (register_test_patterns[pat] & W & M)) { \ }
hw_dbg(&adapter->hw, \ for (pat = 0; pat < ARRAY_SIZE(register_test_patterns); pat++) {
"pattern test reg %04X failed: got " \ before = ixgbe_read_reg(&adapter->hw, reg);
"0x%08X expected 0x%08X\n", \ ixgbe_write_reg(&adapter->hw, reg,
R, val, (register_test_patterns[pat] & W & M)); \ register_test_patterns[pat] & write);
*data = R; \ val = ixgbe_read_reg(&adapter->hw, reg);
writel(before, adapter->hw.hw_addr + R); \ if (val != (register_test_patterns[pat] & write & mask)) {
return 1; \ hw_dbg(&adapter->hw,
} \ "pattern test reg %04X failed: got 0x%08X expected 0x%08X\n",
writel(before, adapter->hw.hw_addr + R); \ reg, val,
} \ register_test_patterns[pat] & write & mask);
*data = reg;
ixgbe_write_reg(&adapter->hw, reg, before);
return true;
}
ixgbe_write_reg(&adapter->hw, reg, before);
}
return false;
} }
#define REG_SET_AND_CHECK(R, M, W) \ static bool reg_set_and_check(struct ixgbevf_adapter *adapter, u64 *data,
{ \ int reg, u32 mask, u32 write)
u32 val, before; \ {
before = readl(adapter->hw.hw_addr + R); \ u32 val, before;
writel((W & M), (adapter->hw.hw_addr + R)); \
val = readl(adapter->hw.hw_addr + R); \ if (IXGBE_REMOVED(adapter->hw.hw_addr)) {
if ((W & M) != (val & M)) { \ *data = 1;
pr_err("set/check reg %04X test failed: got 0x%08X expected " \ return true;
"0x%08X\n", R, (val & M), (W & M)); \ }
*data = R; \ before = ixgbe_read_reg(&adapter->hw, reg);
writel(before, (adapter->hw.hw_addr + R)); \ ixgbe_write_reg(&adapter->hw, reg, write & mask);
return 1; \ val = ixgbe_read_reg(&adapter->hw, reg);
} \ if ((write & mask) != (val & mask)) {
writel(before, (adapter->hw.hw_addr + R)); \ pr_err("set/check reg %04X test failed: got 0x%08X expected 0x%08X\n",
reg, (val & mask), write & mask);
*data = reg;
ixgbe_write_reg(&adapter->hw, reg, before);
return true;
}
ixgbe_write_reg(&adapter->hw, reg, before);
return false;
} }
static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data) static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data)
...@@ -572,6 +586,12 @@ static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data) ...@@ -572,6 +586,12 @@ static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data)
const struct ixgbevf_reg_test *test; const struct ixgbevf_reg_test *test;
u32 i; u32 i;
if (IXGBE_REMOVED(adapter->hw.hw_addr)) {
dev_err(&adapter->pdev->dev,
"Adapter removed - register test blocked\n");
*data = 1;
return 1;
}
test = reg_test_vf; test = reg_test_vf;
/* /*
...@@ -580,38 +600,47 @@ static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data) ...@@ -580,38 +600,47 @@ static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data)
*/ */
while (test->reg) { while (test->reg) {
for (i = 0; i < test->array_len; i++) { for (i = 0; i < test->array_len; i++) {
bool b = false;
switch (test->test_type) { switch (test->test_type) {
case PATTERN_TEST: case PATTERN_TEST:
REG_PATTERN_TEST(test->reg + (i * 0x40), b = reg_pattern_test(adapter, data,
test->mask, test->reg + (i * 0x40),
test->write); test->mask,
test->write);
break; break;
case SET_READ_TEST: case SET_READ_TEST:
REG_SET_AND_CHECK(test->reg + (i * 0x40), b = reg_set_and_check(adapter, data,
test->mask, test->reg + (i * 0x40),
test->write); test->mask,
test->write);
break; break;
case WRITE_NO_TEST: case WRITE_NO_TEST:
writel(test->write, ixgbe_write_reg(&adapter->hw,
(adapter->hw.hw_addr + test->reg) test->reg + (i * 0x40),
+ (i * 0x40)); test->write);
break; break;
case TABLE32_TEST: case TABLE32_TEST:
REG_PATTERN_TEST(test->reg + (i * 4), b = reg_pattern_test(adapter, data,
test->mask, test->reg + (i * 4),
test->write); test->mask,
test->write);
break; break;
case TABLE64_TEST_LO: case TABLE64_TEST_LO:
REG_PATTERN_TEST(test->reg + (i * 8), b = reg_pattern_test(adapter, data,
test->mask, test->reg + (i * 8),
test->write); test->mask,
test->write);
break; break;
case TABLE64_TEST_HI: case TABLE64_TEST_HI:
REG_PATTERN_TEST((test->reg + 4) + (i * 8), b = reg_pattern_test(adapter, data,
test->mask, test->reg + 4 + (i * 8),
test->write); test->mask,
test->write);
break; break;
} }
if (b)
return 1;
} }
test++; test++;
} }
...@@ -626,6 +655,14 @@ static void ixgbevf_diag_test(struct net_device *netdev, ...@@ -626,6 +655,14 @@ static void ixgbevf_diag_test(struct net_device *netdev,
struct ixgbevf_adapter *adapter = netdev_priv(netdev); struct ixgbevf_adapter *adapter = netdev_priv(netdev);
bool if_running = netif_running(netdev); bool if_running = netif_running(netdev);
if (IXGBE_REMOVED(adapter->hw.hw_addr)) {
dev_err(&adapter->pdev->dev,
"Adapter removed - test blocked\n");
data[0] = 1;
data[1] = 1;
eth_test->flags |= ETH_TEST_FL_FAILED;
return;
}
set_bit(__IXGBEVF_TESTING, &adapter->state); set_bit(__IXGBEVF_TESTING, &adapter->state);
if (eth_test->flags == ETH_TEST_FL_OFFLINE) { if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
/* Offline tests */ /* Offline tests */
......
...@@ -315,6 +315,11 @@ static inline u16 ixgbevf_desc_unused(struct ixgbevf_ring *ring) ...@@ -315,6 +315,11 @@ static inline u16 ixgbevf_desc_unused(struct ixgbevf_ring *ring)
return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1; return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1;
} }
static inline void ixgbevf_write_tail(struct ixgbevf_ring *ring, u32 value)
{
writel(value, ring->tail);
}
#define IXGBEVF_RX_DESC(R, i) \ #define IXGBEVF_RX_DESC(R, i) \
(&(((union ixgbe_adv_rx_desc *)((R)->desc))[i])) (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i]))
#define IXGBEVF_TX_DESC(R, i) \ #define IXGBEVF_TX_DESC(R, i) \
...@@ -401,6 +406,7 @@ struct ixgbevf_adapter { ...@@ -401,6 +406,7 @@ struct ixgbevf_adapter {
u64 bp_tx_missed; u64 bp_tx_missed;
#endif #endif
u8 __iomem *io_addr; /* Mainly for iounmap use */
u32 link_speed; u32 link_speed;
bool link_up; bool link_up;
......
...@@ -99,6 +99,49 @@ static void ixgbevf_queue_reset_subtask(struct ixgbevf_adapter *adapter); ...@@ -99,6 +99,49 @@ static void ixgbevf_queue_reset_subtask(struct ixgbevf_adapter *adapter);
static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector); static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector);
static void ixgbevf_free_all_rx_resources(struct ixgbevf_adapter *adapter); static void ixgbevf_free_all_rx_resources(struct ixgbevf_adapter *adapter);
static void ixgbevf_remove_adapter(struct ixgbe_hw *hw)
{
struct ixgbevf_adapter *adapter = hw->back;
if (!hw->hw_addr)
return;
hw->hw_addr = NULL;
dev_err(&adapter->pdev->dev, "Adapter removed\n");
schedule_work(&adapter->watchdog_task);
}
static void ixgbevf_check_remove(struct ixgbe_hw *hw, u32 reg)
{
u32 value;
/* The following check not only optimizes a bit by not
* performing a read on the status register when the
* register just read was a status register read that
* returned IXGBE_FAILED_READ_REG. It also blocks any
* potential recursion.
*/
if (reg == IXGBE_VFSTATUS) {
ixgbevf_remove_adapter(hw);
return;
}
value = ixgbe_read_reg(hw, IXGBE_VFSTATUS);
if (value == IXGBE_FAILED_READ_REG)
ixgbevf_remove_adapter(hw);
}
u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg)
{
u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr);
u32 value;
if (IXGBE_REMOVED(reg_addr))
return IXGBE_FAILED_READ_REG;
value = readl(reg_addr + reg);
if (unlikely(value == IXGBE_FAILED_READ_REG))
ixgbevf_check_remove(hw, reg);
return value;
}
static inline void ixgbevf_release_rx_desc(struct ixgbevf_ring *rx_ring, static inline void ixgbevf_release_rx_desc(struct ixgbevf_ring *rx_ring,
u32 val) u32 val)
{ {
...@@ -111,7 +154,7 @@ static inline void ixgbevf_release_rx_desc(struct ixgbevf_ring *rx_ring, ...@@ -111,7 +154,7 @@ static inline void ixgbevf_release_rx_desc(struct ixgbevf_ring *rx_ring,
* such as IA-64). * such as IA-64).
*/ */
wmb(); wmb();
writel(val, rx_ring->tail); ixgbevf_write_tail(rx_ring, val);
} }
/** /**
...@@ -1139,7 +1182,7 @@ static void ixgbevf_configure_tx_ring(struct ixgbevf_adapter *adapter, ...@@ -1139,7 +1182,7 @@ static void ixgbevf_configure_tx_ring(struct ixgbevf_adapter *adapter,
/* reset head and tail pointers */ /* reset head and tail pointers */
IXGBE_WRITE_REG(hw, IXGBE_VFTDH(reg_idx), 0); IXGBE_WRITE_REG(hw, IXGBE_VFTDH(reg_idx), 0);
IXGBE_WRITE_REG(hw, IXGBE_VFTDT(reg_idx), 0); IXGBE_WRITE_REG(hw, IXGBE_VFTDT(reg_idx), 0);
ring->tail = hw->hw_addr + IXGBE_VFTDT(reg_idx); ring->tail = adapter->io_addr + IXGBE_VFTDT(reg_idx);
/* reset ntu and ntc to place SW in sync with hardwdare */ /* reset ntu and ntc to place SW in sync with hardwdare */
ring->next_to_clean = 0; ring->next_to_clean = 0;
...@@ -1259,6 +1302,8 @@ static void ixgbevf_disable_rx_queue(struct ixgbevf_adapter *adapter, ...@@ -1259,6 +1302,8 @@ static void ixgbevf_disable_rx_queue(struct ixgbevf_adapter *adapter,
u32 rxdctl; u32 rxdctl;
u8 reg_idx = ring->reg_idx; u8 reg_idx = ring->reg_idx;
if (IXGBE_REMOVED(hw->hw_addr))
return;
rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx)); rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
rxdctl &= ~IXGBE_RXDCTL_ENABLE; rxdctl &= ~IXGBE_RXDCTL_ENABLE;
...@@ -1284,6 +1329,8 @@ static void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter, ...@@ -1284,6 +1329,8 @@ static void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter,
u32 rxdctl; u32 rxdctl;
u8 reg_idx = ring->reg_idx; u8 reg_idx = ring->reg_idx;
if (IXGBE_REMOVED(hw->hw_addr))
return;
do { do {
usleep_range(1000, 2000); usleep_range(1000, 2000);
rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx)); rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
...@@ -1318,7 +1365,7 @@ static void ixgbevf_configure_rx_ring(struct ixgbevf_adapter *adapter, ...@@ -1318,7 +1365,7 @@ static void ixgbevf_configure_rx_ring(struct ixgbevf_adapter *adapter,
/* reset head and tail pointers */ /* reset head and tail pointers */
IXGBE_WRITE_REG(hw, IXGBE_VFRDH(reg_idx), 0); IXGBE_WRITE_REG(hw, IXGBE_VFRDH(reg_idx), 0);
IXGBE_WRITE_REG(hw, IXGBE_VFRDT(reg_idx), 0); IXGBE_WRITE_REG(hw, IXGBE_VFRDT(reg_idx), 0);
ring->tail = hw->hw_addr + IXGBE_VFRDT(reg_idx); ring->tail = adapter->io_addr + IXGBE_VFRDT(reg_idx);
/* reset ntu and ntc to place SW in sync with hardwdare */ /* reset ntu and ntc to place SW in sync with hardwdare */
ring->next_to_clean = 0; ring->next_to_clean = 0;
...@@ -2357,6 +2404,14 @@ static void ixgbevf_watchdog_task(struct work_struct *work) ...@@ -2357,6 +2404,14 @@ static void ixgbevf_watchdog_task(struct work_struct *work)
bool link_up = adapter->link_up; bool link_up = adapter->link_up;
s32 need_reset; s32 need_reset;
if (IXGBE_REMOVED(hw->hw_addr)) {
if (!test_bit(__IXGBEVF_DOWN, &adapter->state)) {
rtnl_lock();
ixgbevf_down(adapter);
rtnl_unlock();
}
return;
}
ixgbevf_queue_reset_subtask(adapter); ixgbevf_queue_reset_subtask(adapter);
adapter->flags |= IXGBE_FLAG_IN_WATCHDOG_TASK; adapter->flags |= IXGBE_FLAG_IN_WATCHDOG_TASK;
...@@ -3060,7 +3115,7 @@ static void ixgbevf_tx_map(struct ixgbevf_ring *tx_ring, ...@@ -3060,7 +3115,7 @@ static void ixgbevf_tx_map(struct ixgbevf_ring *tx_ring,
tx_ring->next_to_use = i; tx_ring->next_to_use = i;
/* notify HW of packet */ /* notify HW of packet */
writel(i, tx_ring->tail); ixgbevf_write_tail(tx_ring, i);
return; return;
dma_error: dma_error:
...@@ -3459,6 +3514,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3459,6 +3514,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
hw->hw_addr = ioremap(pci_resource_start(pdev, 0), hw->hw_addr = ioremap(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0)); pci_resource_len(pdev, 0));
adapter->io_addr = hw->hw_addr;
if (!hw->hw_addr) { if (!hw->hw_addr) {
err = -EIO; err = -EIO;
goto err_ioremap; goto err_ioremap;
...@@ -3544,7 +3600,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3544,7 +3600,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ixgbevf_clear_interrupt_scheme(adapter); ixgbevf_clear_interrupt_scheme(adapter);
err_sw_init: err_sw_init:
ixgbevf_reset_interrupt_capability(adapter); ixgbevf_reset_interrupt_capability(adapter);
iounmap(hw->hw_addr); iounmap(adapter->io_addr);
err_ioremap: err_ioremap:
free_netdev(netdev); free_netdev(netdev);
err_alloc_etherdev: err_alloc_etherdev:
...@@ -3582,7 +3638,7 @@ static void ixgbevf_remove(struct pci_dev *pdev) ...@@ -3582,7 +3638,7 @@ static void ixgbevf_remove(struct pci_dev *pdev)
ixgbevf_clear_interrupt_scheme(adapter); ixgbevf_clear_interrupt_scheme(adapter);
ixgbevf_reset_interrupt_capability(adapter); ixgbevf_reset_interrupt_capability(adapter);
iounmap(adapter->hw.hw_addr); iounmap(adapter->io_addr);
pci_release_regions(pdev); pci_release_regions(pdev);
hw_dbg(&adapter->hw, "Remove complete\n"); hw_dbg(&adapter->hw, "Remove complete\n");
......
/******************************************************************************* /*******************************************************************************
Intel 82599 Virtual Function driver Intel 82599 Virtual Function driver
Copyright(c) 1999 - 2012 Intel Corporation. Copyright(c) 1999 - 2014 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -70,16 +70,6 @@ ...@@ -70,16 +70,6 @@
#define IXGBE_VFGOTC_MSB 0x02024 #define IXGBE_VFGOTC_MSB 0x02024
#define IXGBE_VFMPRC 0x01034 #define IXGBE_VFMPRC 0x01034
#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
#define IXGBE_READ_REG(a, reg) readl((a)->hw_addr + (reg))
#define IXGBE_WRITE_REG_ARRAY(a, reg, offset, value) ( \
writel((value), ((a)->hw_addr + (reg) + ((offset) << 2))))
#define IXGBE_READ_REG_ARRAY(a, reg, offset) ( \
readl((a)->hw_addr + (reg) + ((offset) << 2)))
#define IXGBE_WRITE_FLUSH(a) (IXGBE_READ_REG(a, IXGBE_VFSTATUS)) #define IXGBE_WRITE_FLUSH(a) (IXGBE_READ_REG(a, IXGBE_VFSTATUS))
#endif /* _IXGBEVF_REGS_H_ */ #endif /* _IXGBEVF_REGS_H_ */
/******************************************************************************* /*******************************************************************************
Intel 82599 Virtual Function driver Intel 82599 Virtual Function driver
Copyright(c) 1999 - 2012 Intel Corporation. Copyright(c) 1999 - 2014 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -172,6 +172,37 @@ struct ixgbevf_info { ...@@ -172,6 +172,37 @@ struct ixgbevf_info {
const struct ixgbe_mac_operations *mac_ops; const struct ixgbe_mac_operations *mac_ops;
}; };
#define IXGBE_FAILED_READ_REG 0xffffffffU
#define IXGBE_REMOVED(a) unlikely(!(a))
static inline void ixgbe_write_reg(struct ixgbe_hw *hw, u32 reg, u32 value)
{
u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr);
if (IXGBE_REMOVED(reg_addr))
return;
writel(value, reg_addr + reg);
}
#define IXGBE_WRITE_REG(h, r, v) ixgbe_write_reg(h, r, v)
u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg);
#define IXGBE_READ_REG(h, r) ixgbe_read_reg(h, r)
static inline void ixgbe_write_reg_array(struct ixgbe_hw *hw, u32 reg,
u32 offset, u32 value)
{
ixgbe_write_reg(hw, reg + (offset << 2), value);
}
#define IXGBE_WRITE_REG_ARRAY(h, r, o, v) ixgbe_write_reg_array(h, r, o, v)
static inline u32 ixgbe_read_reg_array(struct ixgbe_hw *hw, u32 reg,
u32 offset)
{
return ixgbe_read_reg(hw, reg + (offset << 2));
}
#define IXGBE_READ_REG_ARRAY(h, r, o) ixgbe_read_reg_array(h, r, o)
void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size); void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api); int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment