Commit 1598c36a authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2014-07-02

This series contains updates to i40e and i40evf.

Anjali fixes a possible race where we were trying to free the dummy packet
buffer in the function that created it, so cleanup the dummy packet buffer
in i40e_clean_tx_ring() instead.  Also fixes an issue where the filter
program routine was not checking if there were descriptors available for
programming a filter.

Mitch fixes unnecessary delays when sending the admin queue commands by
moving a declaration up one level so we do not dereference it out of scope.
Fixes an issue with the VF where if the admin queue interrupts get lost for
some reason, the VF communication will stall as the VFs have no way of
reaching the PF.  To alleviate this condition, go ahead and check the ARQ
every time we run the service task.  Updates i40evf to allow the watchdog
to fire vector 0 via software, which makes the driver tolerant of dropped
interrupts on that vector.

Paul fixes a shifted '1' to be unsigned to avoid shifting a signed integer.

Jesse disables TPH by default since it is currently not enabled in the
current hardware.  Also finishes the i40e implementation of get_settings
for ethtool.

Catherine adds a new variable (hw.phy.link_info.an_enabled) to track whether
auto-negotiation is enabled, along with the functionality to update the
variable.  Adds the functionality to set the requested flow control mode.
Adds i40e implementation of setpauseparam and set_settings to ethtool.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents dbaaca81 4e776381
...@@ -1036,6 +1036,164 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink) ...@@ -1036,6 +1036,164 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
/* Admin command wrappers */ /* Admin command wrappers */
/**
* i40e_aq_get_phy_capabilities
* @hw: pointer to the hw struct
* @abilities: structure for PHY capabilities to be filled
* @qualified_modules: report Qualified Modules
* @report_init: report init capabilities (active are default)
* @cmd_details: pointer to command details structure or NULL
*
* Returns the various PHY abilities supported on the Port.
**/
i40e_status i40e_aq_get_phy_capabilities(struct i40e_hw *hw,
bool qualified_modules, bool report_init,
struct i40e_aq_get_phy_abilities_resp *abilities,
struct i40e_asq_cmd_details *cmd_details)
{
struct i40e_aq_desc desc;
i40e_status status;
u16 abilities_size = sizeof(struct i40e_aq_get_phy_abilities_resp);
if (!abilities)
return I40E_ERR_PARAM;
i40e_fill_default_direct_cmd_desc(&desc,
i40e_aqc_opc_get_phy_abilities);
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_BUF);
if (abilities_size > I40E_AQ_LARGE_BUF)
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB);
if (qualified_modules)
desc.params.external.param0 |=
cpu_to_le32(I40E_AQ_PHY_REPORT_QUALIFIED_MODULES);
if (report_init)
desc.params.external.param0 |=
cpu_to_le32(I40E_AQ_PHY_REPORT_INITIAL_VALUES);
status = i40e_asq_send_command(hw, &desc, abilities, abilities_size,
cmd_details);
if (hw->aq.asq_last_status == I40E_AQ_RC_EIO)
status = I40E_ERR_UNKNOWN_PHY;
return status;
}
/**
* i40e_aq_set_phy_config
* @hw: pointer to the hw struct
* @config: structure with PHY configuration to be set
* @cmd_details: pointer to command details structure or NULL
*
* Set the various PHY configuration parameters
* supported on the Port.One or more of the Set PHY config parameters may be
* ignored in an MFP mode as the PF may not have the privilege to set some
* of the PHY Config parameters. This status will be indicated by the
* command response.
**/
enum i40e_status_code i40e_aq_set_phy_config(struct i40e_hw *hw,
struct i40e_aq_set_phy_config *config,
struct i40e_asq_cmd_details *cmd_details)
{
struct i40e_aq_desc desc;
struct i40e_aq_set_phy_config *cmd =
(struct i40e_aq_set_phy_config *)&desc.params.raw;
enum i40e_status_code status;
if (!config)
return I40E_ERR_PARAM;
i40e_fill_default_direct_cmd_desc(&desc,
i40e_aqc_opc_set_phy_config);
*cmd = *config;
status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
return status;
}
/**
* i40e_set_fc
* @hw: pointer to the hw struct
*
* Set the requested flow control mode using set_phy_config.
**/
enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,
bool atomic_restart)
{
enum i40e_fc_mode fc_mode = hw->fc.requested_mode;
struct i40e_aq_get_phy_abilities_resp abilities;
struct i40e_aq_set_phy_config config;
enum i40e_status_code status;
u8 pause_mask = 0x0;
*aq_failures = 0x0;
switch (fc_mode) {
case I40E_FC_FULL:
pause_mask |= I40E_AQ_PHY_FLAG_PAUSE_TX;
pause_mask |= I40E_AQ_PHY_FLAG_PAUSE_RX;
break;
case I40E_FC_RX_PAUSE:
pause_mask |= I40E_AQ_PHY_FLAG_PAUSE_RX;
break;
case I40E_FC_TX_PAUSE:
pause_mask |= I40E_AQ_PHY_FLAG_PAUSE_TX;
break;
default:
break;
}
/* Get the current phy config */
status = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,
NULL);
if (status) {
*aq_failures |= I40E_SET_FC_AQ_FAIL_GET;
return status;
}
memset(&config, 0, sizeof(struct i40e_aq_set_phy_config));
/* clear the old pause settings */
config.abilities = abilities.abilities & ~(I40E_AQ_PHY_FLAG_PAUSE_TX) &
~(I40E_AQ_PHY_FLAG_PAUSE_RX);
/* set the new abilities */
config.abilities |= pause_mask;
/* If the abilities have changed, then set the new config */
if (config.abilities != abilities.abilities) {
/* Auto restart link so settings take effect */
if (atomic_restart)
config.abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
/* Copy over all the old settings */
config.phy_type = abilities.phy_type;
config.link_speed = abilities.link_speed;
config.eee_capability = abilities.eee_capability;
config.eeer = abilities.eeer_val;
config.low_power_ctrl = abilities.d3_lpan;
status = i40e_aq_set_phy_config(hw, &config, NULL);
if (status)
*aq_failures |= I40E_SET_FC_AQ_FAIL_SET;
}
/* Update the link info */
status = i40e_update_link_info(hw, true);
if (status) {
/* Wait a little bit (on 40G cards it sometimes takes a really
* long time for link to come back from the atomic reset)
* and try once more
*/
msleep(1000);
status = i40e_update_link_info(hw, true);
}
if (status)
*aq_failures |= I40E_SET_FC_AQ_FAIL_UPDATE;
return status;
}
/** /**
* i40e_aq_clear_pxe_mode * i40e_aq_clear_pxe_mode
* @hw: pointer to the hw struct * @hw: pointer to the hw struct
...@@ -1112,6 +1270,7 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw, ...@@ -1112,6 +1270,7 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw,
(struct i40e_aqc_get_link_status *)&desc.params.raw; (struct i40e_aqc_get_link_status *)&desc.params.raw;
struct i40e_link_status *hw_link_info = &hw->phy.link_info; struct i40e_link_status *hw_link_info = &hw->phy.link_info;
i40e_status status; i40e_status status;
bool tx_pause, rx_pause;
u16 command_flags; u16 command_flags;
i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_get_link_status); i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_get_link_status);
...@@ -1141,6 +1300,18 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw, ...@@ -1141,6 +1300,18 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw,
hw_link_info->max_frame_size = le16_to_cpu(resp->max_frame_size); hw_link_info->max_frame_size = le16_to_cpu(resp->max_frame_size);
hw_link_info->pacing = resp->config & I40E_AQ_CONFIG_PACING_MASK; hw_link_info->pacing = resp->config & I40E_AQ_CONFIG_PACING_MASK;
/* update fc info */
tx_pause = !!(resp->an_info & I40E_AQ_LINK_PAUSE_TX);
rx_pause = !!(resp->an_info & I40E_AQ_LINK_PAUSE_RX);
if (tx_pause & rx_pause)
hw->fc.current_mode = I40E_FC_FULL;
else if (tx_pause)
hw->fc.current_mode = I40E_FC_TX_PAUSE;
else if (rx_pause)
hw->fc.current_mode = I40E_FC_RX_PAUSE;
else
hw->fc.current_mode = I40E_FC_NONE;
if (resp->config & I40E_AQ_CONFIG_CRC_ENA) if (resp->config & I40E_AQ_CONFIG_CRC_ENA)
hw_link_info->crc_enable = true; hw_link_info->crc_enable = true;
else else
...@@ -1162,6 +1333,35 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw, ...@@ -1162,6 +1333,35 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw,
return status; return status;
} }
/**
* i40e_update_link_info
* @hw: pointer to the hw struct
* @enable_lse: enable/disable LinkStatusEvent reporting
*
* Returns the link status of the adapter
**/
i40e_status i40e_update_link_info(struct i40e_hw *hw, bool enable_lse)
{
struct i40e_aq_get_phy_abilities_resp abilities;
i40e_status status;
status = i40e_aq_get_link_info(hw, enable_lse, NULL, NULL);
if (status)
return status;
status = i40e_aq_get_phy_capabilities(hw, false, false,
&abilities, NULL);
if (status)
return status;
if (abilities.abilities & I40E_AQ_PHY_AN_ENABLED)
hw->phy.link_info.an_enabled = true;
else
hw->phy.link_info.an_enabled = false;
return status;
}
/** /**
* i40e_aq_add_vsi * i40e_aq_add_vsi
* @hw: pointer to the hw struct * @hw: pointer to the hw struct
......
...@@ -127,7 +127,7 @@ struct i40e_hmc_info { ...@@ -127,7 +127,7 @@ struct i40e_hmc_info {
((((type) == I40E_SD_TYPE_PAGED) ? 0 : 1) << \ ((((type) == I40E_SD_TYPE_PAGED) ? 0 : 1) << \
I40E_PFHMC_SDDATALOW_PMSDTYPE_SHIFT) | \ I40E_PFHMC_SDDATALOW_PMSDTYPE_SHIFT) | \
(1 << I40E_PFHMC_SDDATALOW_PMSDVALID_SHIFT); \ (1 << I40E_PFHMC_SDDATALOW_PMSDVALID_SHIFT); \
val3 = (sd_index) | (1 << I40E_PFHMC_SDCMD_PMSDWR_SHIFT); \ val3 = (sd_index) | (1u << I40E_PFHMC_SDCMD_PMSDWR_SHIFT); \
wr32((hw), I40E_PFHMC_SDDATAHIGH, val1); \ wr32((hw), I40E_PFHMC_SDDATAHIGH, val1); \
wr32((hw), I40E_PFHMC_SDDATALOW, val2); \ wr32((hw), I40E_PFHMC_SDDATALOW, val2); \
wr32((hw), I40E_PFHMC_SDCMD, val3); \ wr32((hw), I40E_PFHMC_SDCMD, val3); \
...@@ -146,7 +146,7 @@ struct i40e_hmc_info { ...@@ -146,7 +146,7 @@ struct i40e_hmc_info {
I40E_PFHMC_SDDATALOW_PMSDBPCOUNT_SHIFT) | \ I40E_PFHMC_SDDATALOW_PMSDBPCOUNT_SHIFT) | \
((((type) == I40E_SD_TYPE_PAGED) ? 0 : 1) << \ ((((type) == I40E_SD_TYPE_PAGED) ? 0 : 1) << \
I40E_PFHMC_SDDATALOW_PMSDTYPE_SHIFT); \ I40E_PFHMC_SDDATALOW_PMSDTYPE_SHIFT); \
val3 = (sd_index) | (1 << I40E_PFHMC_SDCMD_PMSDWR_SHIFT); \ val3 = (sd_index) | (1u << I40E_PFHMC_SDCMD_PMSDWR_SHIFT); \
wr32((hw), I40E_PFHMC_SDDATAHIGH, 0); \ wr32((hw), I40E_PFHMC_SDDATAHIGH, 0); \
wr32((hw), I40E_PFHMC_SDDATALOW, val2); \ wr32((hw), I40E_PFHMC_SDDATALOW, val2); \
wr32((hw), I40E_PFHMC_SDCMD, val3); \ wr32((hw), I40E_PFHMC_SDCMD, val3); \
......
...@@ -39,7 +39,7 @@ static const char i40e_driver_string[] = ...@@ -39,7 +39,7 @@ static const char i40e_driver_string[] =
#define DRV_VERSION_MAJOR 0 #define DRV_VERSION_MAJOR 0
#define DRV_VERSION_MINOR 4 #define DRV_VERSION_MINOR 4
#define DRV_VERSION_BUILD 19 #define DRV_VERSION_BUILD 21
#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
__stringify(DRV_VERSION_MINOR) "." \ __stringify(DRV_VERSION_MINOR) "." \
__stringify(DRV_VERSION_BUILD) DRV_KERN __stringify(DRV_VERSION_BUILD) DRV_KERN
...@@ -2401,10 +2401,6 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring) ...@@ -2401,10 +2401,6 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
rx_ctx.rxmax = min_t(u16, vsi->max_frame, rx_ctx.rxmax = min_t(u16, vsi->max_frame,
(chain_len * ring->rx_buf_len)); (chain_len * ring->rx_buf_len));
rx_ctx.tphrdesc_ena = 1;
rx_ctx.tphwdesc_ena = 1;
rx_ctx.tphdata_ena = 1;
rx_ctx.tphhead_ena = 1;
if (hw->revision_id == 0) if (hw->revision_id == 0)
rx_ctx.lrxqthresh = 0; rx_ctx.lrxqthresh = 0;
else else
...@@ -3087,16 +3083,33 @@ static bool i40e_clean_fdir_tx_irq(struct i40e_ring *tx_ring, int budget) ...@@ -3087,16 +3083,33 @@ static bool i40e_clean_fdir_tx_irq(struct i40e_ring *tx_ring, int budget)
/* clear next_to_watch to prevent false hangs */ /* clear next_to_watch to prevent false hangs */
tx_buf->next_to_watch = NULL; tx_buf->next_to_watch = NULL;
tx_desc->buffer_addr = 0;
tx_desc->cmd_type_offset_bsz = 0;
/* move past filter desc */
tx_buf++;
tx_desc++;
i++;
if (unlikely(!i)) {
i -= tx_ring->count;
tx_buf = tx_ring->tx_bi;
tx_desc = I40E_TX_DESC(tx_ring, 0);
}
/* unmap skb header data */ /* unmap skb header data */
dma_unmap_single(tx_ring->dev, dma_unmap_single(tx_ring->dev,
dma_unmap_addr(tx_buf, dma), dma_unmap_addr(tx_buf, dma),
dma_unmap_len(tx_buf, len), dma_unmap_len(tx_buf, len),
DMA_TO_DEVICE); DMA_TO_DEVICE);
if (tx_buf->tx_flags & I40E_TX_FLAGS_FD_SB)
kfree(tx_buf->raw_buf);
tx_buf->raw_buf = NULL;
tx_buf->tx_flags = 0;
tx_buf->next_to_watch = NULL;
dma_unmap_len_set(tx_buf, len, 0); dma_unmap_len_set(tx_buf, len, 0);
tx_desc->buffer_addr = 0;
tx_desc->cmd_type_offset_bsz = 0;
/* move us past the eop_desc for start of next FD desc */
/* move to the next desc and buffer to clean */
tx_buf++; tx_buf++;
tx_desc++; tx_desc++;
i++; i++;
...@@ -4313,8 +4326,12 @@ static void i40e_print_link_message(struct i40e_vsi *vsi, bool isup) ...@@ -4313,8 +4326,12 @@ static void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
static int i40e_up_complete(struct i40e_vsi *vsi) static int i40e_up_complete(struct i40e_vsi *vsi)
{ {
struct i40e_pf *pf = vsi->back; struct i40e_pf *pf = vsi->back;
u8 set_fc_aq_fail = 0;
int err; int err;
/* force flow control off */
i40e_set_fc(&pf->hw, &set_fc_aq_fail, true);
if (pf->flags & I40E_FLAG_MSIX_ENABLED) if (pf->flags & I40E_FLAG_MSIX_ENABLED)
i40e_vsi_configure_msix(vsi); i40e_vsi_configure_msix(vsi);
else else
...@@ -5279,7 +5296,7 @@ static void i40e_handle_link_event(struct i40e_pf *pf, ...@@ -5279,7 +5296,7 @@ static void i40e_handle_link_event(struct i40e_pf *pf,
* then see if the status changed while processing the * then see if the status changed while processing the
* initial event. * initial event.
*/ */
i40e_aq_get_link_info(&pf->hw, true, NULL, NULL); i40e_update_link_info(&pf->hw, true);
i40e_link_event(pf); i40e_link_event(pf);
} }
...@@ -5297,9 +5314,6 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf) ...@@ -5297,9 +5314,6 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf)
u32 oldval; u32 oldval;
u32 val; u32 val;
if (!test_bit(__I40E_ADMINQ_EVENT_PENDING, &pf->state))
return;
/* check for error indications */ /* check for error indications */
val = rd32(&pf->hw, pf->hw.aq.arq.len); val = rd32(&pf->hw, pf->hw.aq.arq.len);
oldval = val; oldval = val;
...@@ -5343,10 +5357,9 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf) ...@@ -5343,10 +5357,9 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf)
do { do {
event.msg_size = I40E_MAX_AQ_BUF_SIZE; /* reinit each time */ event.msg_size = I40E_MAX_AQ_BUF_SIZE; /* reinit each time */
ret = i40e_clean_arq_element(hw, &event, &pending); ret = i40e_clean_arq_element(hw, &event, &pending);
if (ret == I40E_ERR_ADMIN_QUEUE_NO_WORK) { if (ret == I40E_ERR_ADMIN_QUEUE_NO_WORK)
dev_info(&pf->pdev->dev, "No ARQ event found\n");
break; break;
} else if (ret) { else if (ret) {
dev_info(&pf->pdev->dev, "ARQ event error %d\n", ret); dev_info(&pf->pdev->dev, "ARQ event error %d\n", ret);
break; break;
} }
...@@ -6872,9 +6885,11 @@ bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features) ...@@ -6872,9 +6885,11 @@ bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features)
i40e_fdir_filter_exit(pf); i40e_fdir_filter_exit(pf);
} }
pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; pf->flags &= ~I40E_FLAG_FD_SB_ENABLED;
/* if ATR was disabled it can be re-enabled. */ pf->auto_disable_flags &= ~I40E_FLAG_FD_SB_ENABLED;
if (!(pf->flags & I40E_FLAG_FD_ATR_ENABLED)) /* if ATR was auto disabled it can be re-enabled. */
pf->flags |= I40E_FLAG_FD_ATR_ENABLED; if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
(pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED))
pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED;
} }
return need_reset; return need_reset;
} }
...@@ -8266,7 +8281,6 @@ int i40e_fetch_switch_configuration(struct i40e_pf *pf, bool printconfig) ...@@ -8266,7 +8281,6 @@ int i40e_fetch_switch_configuration(struct i40e_pf *pf, bool printconfig)
**/ **/
static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit) static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)
{ {
u32 rxfc = 0, txfc = 0, rxfc_reg;
int ret; int ret;
/* find out what's out there already */ /* find out what's out there already */
...@@ -8326,68 +8340,13 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit) ...@@ -8326,68 +8340,13 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)
i40e_config_rss(pf); i40e_config_rss(pf);
/* fill in link information and enable LSE reporting */ /* fill in link information and enable LSE reporting */
i40e_aq_get_link_info(&pf->hw, true, NULL, NULL); i40e_update_link_info(&pf->hw, true);
i40e_link_event(pf); i40e_link_event(pf);
/* Initialize user-specific link properties */ /* Initialize user-specific link properties */
pf->fc_autoneg_status = ((pf->hw.phy.link_info.an_info & pf->fc_autoneg_status = ((pf->hw.phy.link_info.an_info &
I40E_AQ_AN_COMPLETED) ? true : false); I40E_AQ_AN_COMPLETED) ? true : false);
/* requested_mode is set in probe or by ethtool */
if (!pf->fc_autoneg_status)
goto no_autoneg;
if ((pf->hw.phy.link_info.an_info & I40E_AQ_LINK_PAUSE_TX) &&
(pf->hw.phy.link_info.an_info & I40E_AQ_LINK_PAUSE_RX))
pf->hw.fc.current_mode = I40E_FC_FULL;
else if (pf->hw.phy.link_info.an_info & I40E_AQ_LINK_PAUSE_TX)
pf->hw.fc.current_mode = I40E_FC_TX_PAUSE;
else if (pf->hw.phy.link_info.an_info & I40E_AQ_LINK_PAUSE_RX)
pf->hw.fc.current_mode = I40E_FC_RX_PAUSE;
else
pf->hw.fc.current_mode = I40E_FC_NONE;
/* sync the flow control settings with the auto-neg values */
switch (pf->hw.fc.current_mode) {
case I40E_FC_FULL:
txfc = 1;
rxfc = 1;
break;
case I40E_FC_TX_PAUSE:
txfc = 1;
rxfc = 0;
break;
case I40E_FC_RX_PAUSE:
txfc = 0;
rxfc = 1;
break;
case I40E_FC_NONE:
case I40E_FC_DEFAULT:
txfc = 0;
rxfc = 0;
break;
case I40E_FC_PFC:
/* TBD */
break;
/* no default case, we have to handle all possibilities here */
}
wr32(&pf->hw, I40E_PRTDCB_FCCFG, txfc << I40E_PRTDCB_FCCFG_TFCE_SHIFT);
rxfc_reg = rd32(&pf->hw, I40E_PRTDCB_MFLCN) &
~I40E_PRTDCB_MFLCN_RFCE_MASK;
rxfc_reg |= (rxfc << I40E_PRTDCB_MFLCN_RFCE_SHIFT);
wr32(&pf->hw, I40E_PRTDCB_MFLCN, rxfc_reg);
goto fc_complete;
no_autoneg:
/* disable L2 flow control, user can turn it on if they wish */
wr32(&pf->hw, I40E_PRTDCB_FCCFG, 0);
wr32(&pf->hw, I40E_PRTDCB_MFLCN, rd32(&pf->hw, I40E_PRTDCB_MFLCN) &
~I40E_PRTDCB_MFLCN_RFCE_MASK);
fc_complete:
i40e_ptp_init(pf); i40e_ptp_init(pf);
return ret; return ret;
......
...@@ -74,6 +74,15 @@ i40e_status i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags, ...@@ -74,6 +74,15 @@ i40e_status i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags,
struct i40e_asq_cmd_details *cmd_details); struct i40e_asq_cmd_details *cmd_details);
i40e_status i40e_aq_set_default_vsi(struct i40e_hw *hw, u16 vsi_id, i40e_status i40e_aq_set_default_vsi(struct i40e_hw *hw, u16 vsi_id,
struct i40e_asq_cmd_details *cmd_details); struct i40e_asq_cmd_details *cmd_details);
enum i40e_status_code i40e_aq_get_phy_capabilities(struct i40e_hw *hw,
bool qualified_modules, bool report_init,
struct i40e_aq_get_phy_abilities_resp *abilities,
struct i40e_asq_cmd_details *cmd_details);
enum i40e_status_code i40e_aq_set_phy_config(struct i40e_hw *hw,
struct i40e_aq_set_phy_config *config,
struct i40e_asq_cmd_details *cmd_details);
enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,
bool atomic_reset);
i40e_status i40e_aq_clear_pxe_mode(struct i40e_hw *hw, i40e_status i40e_aq_clear_pxe_mode(struct i40e_hw *hw,
struct i40e_asq_cmd_details *cmd_details); struct i40e_asq_cmd_details *cmd_details);
i40e_status i40e_aq_set_link_restart_an(struct i40e_hw *hw, i40e_status i40e_aq_set_link_restart_an(struct i40e_hw *hw,
...@@ -82,6 +91,7 @@ i40e_status i40e_aq_set_link_restart_an(struct i40e_hw *hw, ...@@ -82,6 +91,7 @@ i40e_status i40e_aq_set_link_restart_an(struct i40e_hw *hw,
i40e_status i40e_aq_get_link_info(struct i40e_hw *hw, i40e_status i40e_aq_get_link_info(struct i40e_hw *hw,
bool enable_lse, struct i40e_link_status *link, bool enable_lse, struct i40e_link_status *link,
struct i40e_asq_cmd_details *cmd_details); struct i40e_asq_cmd_details *cmd_details);
i40e_status i40e_update_link_info(struct i40e_hw *hw, bool enable_lse);
i40e_status i40e_aq_set_local_advt_reg(struct i40e_hw *hw, i40e_status i40e_aq_set_local_advt_reg(struct i40e_hw *hw,
u64 advt_reg, u64 advt_reg,
struct i40e_asq_cmd_details *cmd_details); struct i40e_asq_cmd_details *cmd_details);
......
...@@ -39,6 +39,7 @@ static inline __le64 build_ctob(u32 td_cmd, u32 td_offset, unsigned int size, ...@@ -39,6 +39,7 @@ static inline __le64 build_ctob(u32 td_cmd, u32 td_offset, unsigned int size,
} }
#define I40E_TXD_CMD (I40E_TX_DESC_CMD_EOP | I40E_TX_DESC_CMD_RS) #define I40E_TXD_CMD (I40E_TX_DESC_CMD_EOP | I40E_TX_DESC_CMD_RS)
#define I40E_FD_CLEAN_DELAY 10
/** /**
* i40e_program_fdir_filter - Program a Flow Director filter * i40e_program_fdir_filter - Program a Flow Director filter
* @fdir_data: Packet data that will be filter parameters * @fdir_data: Packet data that will be filter parameters
...@@ -50,7 +51,7 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet, ...@@ -50,7 +51,7 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
struct i40e_pf *pf, bool add) struct i40e_pf *pf, bool add)
{ {
struct i40e_filter_program_desc *fdir_desc; struct i40e_filter_program_desc *fdir_desc;
struct i40e_tx_buffer *tx_buf; struct i40e_tx_buffer *tx_buf, *first;
struct i40e_tx_desc *tx_desc; struct i40e_tx_desc *tx_desc;
struct i40e_ring *tx_ring; struct i40e_ring *tx_ring;
unsigned int fpt, dcc; unsigned int fpt, dcc;
...@@ -58,6 +59,7 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet, ...@@ -58,6 +59,7 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
struct device *dev; struct device *dev;
dma_addr_t dma; dma_addr_t dma;
u32 td_cmd = 0; u32 td_cmd = 0;
u16 delay = 0;
u16 i; u16 i;
/* find existing FDIR VSI */ /* find existing FDIR VSI */
...@@ -71,6 +73,17 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet, ...@@ -71,6 +73,17 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
tx_ring = vsi->tx_rings[0]; tx_ring = vsi->tx_rings[0];
dev = tx_ring->dev; dev = tx_ring->dev;
/* we need two descriptors to add/del a filter and we can wait */
do {
if (I40E_DESC_UNUSED(tx_ring) > 1)
break;
msleep_interruptible(1);
delay++;
} while (delay < I40E_FD_CLEAN_DELAY);
if (!(I40E_DESC_UNUSED(tx_ring) > 1))
return -EAGAIN;
dma = dma_map_single(dev, raw_packet, dma = dma_map_single(dev, raw_packet,
I40E_FDIR_MAX_RAW_PACKET_SIZE, DMA_TO_DEVICE); I40E_FDIR_MAX_RAW_PACKET_SIZE, DMA_TO_DEVICE);
if (dma_mapping_error(dev, dma)) if (dma_mapping_error(dev, dma))
...@@ -79,8 +92,10 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet, ...@@ -79,8 +92,10 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
/* grab the next descriptor */ /* grab the next descriptor */
i = tx_ring->next_to_use; i = tx_ring->next_to_use;
fdir_desc = I40E_TX_FDIRDESC(tx_ring, i); fdir_desc = I40E_TX_FDIRDESC(tx_ring, i);
first = &tx_ring->tx_bi[i];
memset(first, 0, sizeof(struct i40e_tx_buffer));
tx_ring->next_to_use = (i + 1 < tx_ring->count) ? i + 1 : 0; tx_ring->next_to_use = ((i + 1) < tx_ring->count) ? i + 1 : 0;
fpt = (fdir_data->q_index << I40E_TXD_FLTR_QW0_QINDEX_SHIFT) & fpt = (fdir_data->q_index << I40E_TXD_FLTR_QW0_QINDEX_SHIFT) &
I40E_TXD_FLTR_QW0_QINDEX_MASK; I40E_TXD_FLTR_QW0_QINDEX_MASK;
...@@ -132,7 +147,9 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet, ...@@ -132,7 +147,9 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
tx_desc = I40E_TX_DESC(tx_ring, i); tx_desc = I40E_TX_DESC(tx_ring, i);
tx_buf = &tx_ring->tx_bi[i]; tx_buf = &tx_ring->tx_bi[i];
tx_ring->next_to_use = (i + 1 < tx_ring->count) ? i + 1 : 0; tx_ring->next_to_use = ((i + 1) < tx_ring->count) ? i + 1 : 0;
memset(tx_buf, 0, sizeof(struct i40e_tx_buffer));
/* record length, and DMA address */ /* record length, and DMA address */
dma_unmap_len_set(tx_buf, len, I40E_FDIR_MAX_RAW_PACKET_SIZE); dma_unmap_len_set(tx_buf, len, I40E_FDIR_MAX_RAW_PACKET_SIZE);
...@@ -141,6 +158,9 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet, ...@@ -141,6 +158,9 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
tx_desc->buffer_addr = cpu_to_le64(dma); tx_desc->buffer_addr = cpu_to_le64(dma);
td_cmd = I40E_TXD_CMD | I40E_TX_DESC_CMD_DUMMY; td_cmd = I40E_TXD_CMD | I40E_TX_DESC_CMD_DUMMY;
tx_buf->tx_flags = I40E_TX_FLAGS_FD_SB;
tx_buf->raw_buf = (void *)raw_packet;
tx_desc->cmd_type_offset_bsz = tx_desc->cmd_type_offset_bsz =
build_ctob(td_cmd, 0, I40E_FDIR_MAX_RAW_PACKET_SIZE, 0); build_ctob(td_cmd, 0, I40E_FDIR_MAX_RAW_PACKET_SIZE, 0);
...@@ -148,14 +168,12 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet, ...@@ -148,14 +168,12 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
tx_buf->time_stamp = jiffies; tx_buf->time_stamp = jiffies;
/* Force memory writes to complete before letting h/w /* Force memory writes to complete before letting h/w
* know there are new descriptors to fetch. (Only * know there are new descriptors to fetch.
* applicable for weak-ordered memory model archs,
* such as IA-64).
*/ */
wmb(); wmb();
/* Mark the data descriptor to be watched */ /* Mark the data descriptor to be watched */
tx_buf->next_to_watch = tx_desc; first->next_to_watch = tx_desc;
writel(tx_ring->next_to_use, tx_ring->tail); writel(tx_ring->next_to_use, tx_ring->tail);
return 0; return 0;
...@@ -170,24 +188,27 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet, ...@@ -170,24 +188,27 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
* i40e_add_del_fdir_udpv4 - Add/Remove UDPv4 filters * i40e_add_del_fdir_udpv4 - Add/Remove UDPv4 filters
* @vsi: pointer to the targeted VSI * @vsi: pointer to the targeted VSI
* @fd_data: the flow director data required for the FDir descriptor * @fd_data: the flow director data required for the FDir descriptor
* @raw_packet: the pre-allocated packet buffer for FDir
* @add: true adds a filter, false removes it * @add: true adds a filter, false removes it
* *
* Returns 0 if the filters were successfully added or removed * Returns 0 if the filters were successfully added or removed
**/ **/
static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi, static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi,
struct i40e_fdir_filter *fd_data, struct i40e_fdir_filter *fd_data,
u8 *raw_packet, bool add) bool add)
{ {
struct i40e_pf *pf = vsi->back; struct i40e_pf *pf = vsi->back;
struct udphdr *udp; struct udphdr *udp;
struct iphdr *ip; struct iphdr *ip;
bool err = false; bool err = false;
u8 *raw_packet;
int ret; int ret;
static char packet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0, static char packet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0,
0x45, 0, 0, 0x1c, 0, 0, 0x40, 0, 0x40, 0x11, 0, 0, 0, 0, 0, 0, 0x45, 0, 0, 0x1c, 0, 0, 0x40, 0, 0x40, 0x11, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
raw_packet = kzalloc(I40E_FDIR_MAX_RAW_PACKET_SIZE, GFP_KERNEL);
if (!raw_packet)
return -ENOMEM;
memcpy(raw_packet, packet, I40E_UDPIP_DUMMY_PACKET_LEN); memcpy(raw_packet, packet, I40E_UDPIP_DUMMY_PACKET_LEN);
ip = (struct iphdr *)(raw_packet + IP_HEADER_OFFSET); ip = (struct iphdr *)(raw_packet + IP_HEADER_OFFSET);
...@@ -220,19 +241,19 @@ static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi, ...@@ -220,19 +241,19 @@ static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi,
* i40e_add_del_fdir_tcpv4 - Add/Remove TCPv4 filters * i40e_add_del_fdir_tcpv4 - Add/Remove TCPv4 filters
* @vsi: pointer to the targeted VSI * @vsi: pointer to the targeted VSI
* @fd_data: the flow director data required for the FDir descriptor * @fd_data: the flow director data required for the FDir descriptor
* @raw_packet: the pre-allocated packet buffer for FDir
* @add: true adds a filter, false removes it * @add: true adds a filter, false removes it
* *
* Returns 0 if the filters were successfully added or removed * Returns 0 if the filters were successfully added or removed
**/ **/
static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi, static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi,
struct i40e_fdir_filter *fd_data, struct i40e_fdir_filter *fd_data,
u8 *raw_packet, bool add) bool add)
{ {
struct i40e_pf *pf = vsi->back; struct i40e_pf *pf = vsi->back;
struct tcphdr *tcp; struct tcphdr *tcp;
struct iphdr *ip; struct iphdr *ip;
bool err = false; bool err = false;
u8 *raw_packet;
int ret; int ret;
/* Dummy packet */ /* Dummy packet */
static char packet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0, static char packet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0,
...@@ -240,6 +261,9 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi, ...@@ -240,6 +261,9 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0x11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0x11,
0x0, 0x72, 0, 0, 0, 0}; 0x0, 0x72, 0, 0, 0, 0};
raw_packet = kzalloc(I40E_FDIR_MAX_RAW_PACKET_SIZE, GFP_KERNEL);
if (!raw_packet)
return -ENOMEM;
memcpy(raw_packet, packet, I40E_TCPIP_DUMMY_PACKET_LEN); memcpy(raw_packet, packet, I40E_TCPIP_DUMMY_PACKET_LEN);
ip = (struct iphdr *)(raw_packet + IP_HEADER_OFFSET); ip = (struct iphdr *)(raw_packet + IP_HEADER_OFFSET);
...@@ -286,7 +310,7 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi, ...@@ -286,7 +310,7 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi,
**/ **/
static int i40e_add_del_fdir_sctpv4(struct i40e_vsi *vsi, static int i40e_add_del_fdir_sctpv4(struct i40e_vsi *vsi,
struct i40e_fdir_filter *fd_data, struct i40e_fdir_filter *fd_data,
u8 *raw_packet, bool add) bool add)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -297,33 +321,36 @@ static int i40e_add_del_fdir_sctpv4(struct i40e_vsi *vsi, ...@@ -297,33 +321,36 @@ static int i40e_add_del_fdir_sctpv4(struct i40e_vsi *vsi,
* a specific flow spec * a specific flow spec
* @vsi: pointer to the targeted VSI * @vsi: pointer to the targeted VSI
* @fd_data: the flow director data required for the FDir descriptor * @fd_data: the flow director data required for the FDir descriptor
* @raw_packet: the pre-allocated packet buffer for FDir
* @add: true adds a filter, false removes it * @add: true adds a filter, false removes it
* *
* Returns 0 if the filters were successfully added or removed * Returns 0 if the filters were successfully added or removed
**/ **/
static int i40e_add_del_fdir_ipv4(struct i40e_vsi *vsi, static int i40e_add_del_fdir_ipv4(struct i40e_vsi *vsi,
struct i40e_fdir_filter *fd_data, struct i40e_fdir_filter *fd_data,
u8 *raw_packet, bool add) bool add)
{ {
struct i40e_pf *pf = vsi->back; struct i40e_pf *pf = vsi->back;
struct iphdr *ip; struct iphdr *ip;
bool err = false; bool err = false;
u8 *raw_packet;
int ret; int ret;
int i; int i;
static char packet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0, static char packet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0,
0x45, 0, 0, 0x14, 0, 0, 0x40, 0, 0x40, 0x10, 0, 0, 0, 0, 0, 0, 0x45, 0, 0, 0x14, 0, 0, 0x40, 0, 0x40, 0x10, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0}; 0, 0, 0, 0};
memcpy(raw_packet, packet, I40E_IP_DUMMY_PACKET_LEN);
ip = (struct iphdr *)(raw_packet + IP_HEADER_OFFSET);
ip->saddr = fd_data->src_ip[0];
ip->daddr = fd_data->dst_ip[0];
ip->protocol = 0;
for (i = I40E_FILTER_PCTYPE_NONF_IPV4_OTHER; for (i = I40E_FILTER_PCTYPE_NONF_IPV4_OTHER;
i <= I40E_FILTER_PCTYPE_FRAG_IPV4; i++) { i <= I40E_FILTER_PCTYPE_FRAG_IPV4; i++) {
raw_packet = kzalloc(I40E_FDIR_MAX_RAW_PACKET_SIZE, GFP_KERNEL);
if (!raw_packet)
return -ENOMEM;
memcpy(raw_packet, packet, I40E_IP_DUMMY_PACKET_LEN);
ip = (struct iphdr *)(raw_packet + IP_HEADER_OFFSET);
ip->saddr = fd_data->src_ip[0];
ip->daddr = fd_data->dst_ip[0];
ip->protocol = 0;
fd_data->pctype = i; fd_data->pctype = i;
ret = i40e_program_fdir_filter(fd_data, raw_packet, pf, add); ret = i40e_program_fdir_filter(fd_data, raw_packet, pf, add);
...@@ -353,50 +380,34 @@ int i40e_add_del_fdir(struct i40e_vsi *vsi, ...@@ -353,50 +380,34 @@ int i40e_add_del_fdir(struct i40e_vsi *vsi,
struct i40e_fdir_filter *input, bool add) struct i40e_fdir_filter *input, bool add)
{ {
struct i40e_pf *pf = vsi->back; struct i40e_pf *pf = vsi->back;
u8 *raw_packet;
int ret; int ret;
/* Populate the Flow Director that we have at the moment
* and allocate the raw packet buffer for the calling functions
*/
raw_packet = kzalloc(I40E_FDIR_MAX_RAW_PACKET_SIZE, GFP_KERNEL);
if (!raw_packet)
return -ENOMEM;
switch (input->flow_type & ~FLOW_EXT) { switch (input->flow_type & ~FLOW_EXT) {
case TCP_V4_FLOW: case TCP_V4_FLOW:
ret = i40e_add_del_fdir_tcpv4(vsi, input, raw_packet, ret = i40e_add_del_fdir_tcpv4(vsi, input, add);
add);
break; break;
case UDP_V4_FLOW: case UDP_V4_FLOW:
ret = i40e_add_del_fdir_udpv4(vsi, input, raw_packet, ret = i40e_add_del_fdir_udpv4(vsi, input, add);
add);
break; break;
case SCTP_V4_FLOW: case SCTP_V4_FLOW:
ret = i40e_add_del_fdir_sctpv4(vsi, input, raw_packet, ret = i40e_add_del_fdir_sctpv4(vsi, input, add);
add);
break; break;
case IPV4_FLOW: case IPV4_FLOW:
ret = i40e_add_del_fdir_ipv4(vsi, input, raw_packet, ret = i40e_add_del_fdir_ipv4(vsi, input, add);
add);
break; break;
case IP_USER_FLOW: case IP_USER_FLOW:
switch (input->ip4_proto) { switch (input->ip4_proto) {
case IPPROTO_TCP: case IPPROTO_TCP:
ret = i40e_add_del_fdir_tcpv4(vsi, input, ret = i40e_add_del_fdir_tcpv4(vsi, input, add);
raw_packet, add);
break; break;
case IPPROTO_UDP: case IPPROTO_UDP:
ret = i40e_add_del_fdir_udpv4(vsi, input, ret = i40e_add_del_fdir_udpv4(vsi, input, add);
raw_packet, add);
break; break;
case IPPROTO_SCTP: case IPPROTO_SCTP:
ret = i40e_add_del_fdir_sctpv4(vsi, input, ret = i40e_add_del_fdir_sctpv4(vsi, input, add);
raw_packet, add);
break; break;
default: default:
ret = i40e_add_del_fdir_ipv4(vsi, input, ret = i40e_add_del_fdir_ipv4(vsi, input, add);
raw_packet, add);
break; break;
} }
break; break;
...@@ -406,7 +417,7 @@ int i40e_add_del_fdir(struct i40e_vsi *vsi, ...@@ -406,7 +417,7 @@ int i40e_add_del_fdir(struct i40e_vsi *vsi,
ret = -EINVAL; ret = -EINVAL;
} }
kfree(raw_packet); /* The buffer allocated here is freed by the i40e_clean_tx_ring() */
return ret; return ret;
} }
...@@ -480,7 +491,11 @@ static void i40e_unmap_and_free_tx_resource(struct i40e_ring *ring, ...@@ -480,7 +491,11 @@ static void i40e_unmap_and_free_tx_resource(struct i40e_ring *ring,
struct i40e_tx_buffer *tx_buffer) struct i40e_tx_buffer *tx_buffer)
{ {
if (tx_buffer->skb) { if (tx_buffer->skb) {
dev_kfree_skb_any(tx_buffer->skb); if (tx_buffer->tx_flags & I40E_TX_FLAGS_FD_SB)
kfree(tx_buffer->raw_buf);
else
dev_kfree_skb_any(tx_buffer->skb);
if (dma_unmap_len(tx_buffer, len)) if (dma_unmap_len(tx_buffer, len))
dma_unmap_single(ring->dev, dma_unmap_single(ring->dev,
dma_unmap_addr(tx_buffer, dma), dma_unmap_addr(tx_buffer, dma),
......
...@@ -131,6 +131,7 @@ enum i40e_dyn_idx_t { ...@@ -131,6 +131,7 @@ enum i40e_dyn_idx_t {
#define I40E_TX_FLAGS_FCCRC (u32)(1 << 6) #define I40E_TX_FLAGS_FCCRC (u32)(1 << 6)
#define I40E_TX_FLAGS_FSO (u32)(1 << 7) #define I40E_TX_FLAGS_FSO (u32)(1 << 7)
#define I40E_TX_FLAGS_TSYN (u32)(1 << 8) #define I40E_TX_FLAGS_TSYN (u32)(1 << 8)
#define I40E_TX_FLAGS_FD_SB (u32)(1 << 9)
#define I40E_TX_FLAGS_VLAN_MASK 0xffff0000 #define I40E_TX_FLAGS_VLAN_MASK 0xffff0000
#define I40E_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000 #define I40E_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000
#define I40E_TX_FLAGS_VLAN_PRIO_SHIFT 29 #define I40E_TX_FLAGS_VLAN_PRIO_SHIFT 29
...@@ -139,7 +140,10 @@ enum i40e_dyn_idx_t { ...@@ -139,7 +140,10 @@ enum i40e_dyn_idx_t {
struct i40e_tx_buffer { struct i40e_tx_buffer {
struct i40e_tx_desc *next_to_watch; struct i40e_tx_desc *next_to_watch;
unsigned long time_stamp; unsigned long time_stamp;
struct sk_buff *skb; union {
struct sk_buff *skb;
void *raw_buf;
};
unsigned int bytecount; unsigned int bytecount;
unsigned short gso_segs; unsigned short gso_segs;
DEFINE_DMA_UNMAP_ADDR(dma); DEFINE_DMA_UNMAP_ADDR(dma);
......
...@@ -140,6 +140,14 @@ enum i40e_fc_mode { ...@@ -140,6 +140,14 @@ enum i40e_fc_mode {
I40E_FC_DEFAULT I40E_FC_DEFAULT
}; };
enum i40e_set_fc_aq_failures {
I40E_SET_FC_AQ_FAIL_NONE = 0,
I40E_SET_FC_AQ_FAIL_GET = 1,
I40E_SET_FC_AQ_FAIL_SET = 2,
I40E_SET_FC_AQ_FAIL_UPDATE = 4,
I40E_SET_FC_AQ_FAIL_SET_UPDATE = 6
};
enum i40e_vsi_type { enum i40e_vsi_type {
I40E_VSI_MAIN = 0, I40E_VSI_MAIN = 0,
I40E_VSI_VMDQ1, I40E_VSI_VMDQ1,
...@@ -166,6 +174,7 @@ struct i40e_link_status { ...@@ -166,6 +174,7 @@ struct i40e_link_status {
u8 an_info; u8 an_info;
u8 ext_info; u8 ext_info;
u8 loopback; u8 loopback;
bool an_enabled;
/* is Link Status Event notification to SW enabled */ /* is Link Status Event notification to SW enabled */
bool lse_enable; bool lse_enable;
u16 max_frame_size; u16 max_frame_size;
......
...@@ -347,10 +347,6 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_idx, ...@@ -347,10 +347,6 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_idx,
rx_ctx.dsize = 1; rx_ctx.dsize = 1;
/* default values */ /* default values */
rx_ctx.tphrdesc_ena = 1;
rx_ctx.tphwdesc_ena = 1;
rx_ctx.tphdata_ena = 1;
rx_ctx.tphhead_ena = 1;
rx_ctx.lrxqthresh = 2; rx_ctx.lrxqthresh = 2;
rx_ctx.crcstrip = 1; rx_ctx.crcstrip = 1;
rx_ctx.prefena = 1; rx_ctx.prefena = 1;
......
...@@ -551,6 +551,7 @@ i40e_status i40e_aq_send_msg_to_pf(struct i40e_hw *hw, ...@@ -551,6 +551,7 @@ i40e_status i40e_aq_send_msg_to_pf(struct i40e_hw *hw,
struct i40e_asq_cmd_details *cmd_details) struct i40e_asq_cmd_details *cmd_details)
{ {
struct i40e_aq_desc desc; struct i40e_aq_desc desc;
struct i40e_asq_cmd_details details;
i40e_status status; i40e_status status;
i40evf_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_send_msg_to_pf); i40evf_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_send_msg_to_pf);
...@@ -565,7 +566,6 @@ i40e_status i40e_aq_send_msg_to_pf(struct i40e_hw *hw, ...@@ -565,7 +566,6 @@ i40e_status i40e_aq_send_msg_to_pf(struct i40e_hw *hw,
desc.datalen = cpu_to_le16(msglen); desc.datalen = cpu_to_le16(msglen);
} }
if (!cmd_details) { if (!cmd_details) {
struct i40e_asq_cmd_details details;
memset(&details, 0, sizeof(details)); memset(&details, 0, sizeof(details));
details.async = true; details.async = true;
cmd_details = &details; cmd_details = &details;
......
...@@ -127,7 +127,7 @@ struct i40e_hmc_info { ...@@ -127,7 +127,7 @@ struct i40e_hmc_info {
((((type) == I40E_SD_TYPE_PAGED) ? 0 : 1) << \ ((((type) == I40E_SD_TYPE_PAGED) ? 0 : 1) << \
I40E_PFHMC_SDDATALOW_PMSDTYPE_SHIFT) | \ I40E_PFHMC_SDDATALOW_PMSDTYPE_SHIFT) | \
(1 << I40E_PFHMC_SDDATALOW_PMSDVALID_SHIFT); \ (1 << I40E_PFHMC_SDDATALOW_PMSDVALID_SHIFT); \
val3 = (sd_index) | (1 << I40E_PFHMC_SDCMD_PMSDWR_SHIFT); \ val3 = (sd_index) | (1u << I40E_PFHMC_SDCMD_PMSDWR_SHIFT); \
wr32((hw), I40E_PFHMC_SDDATAHIGH, val1); \ wr32((hw), I40E_PFHMC_SDDATAHIGH, val1); \
wr32((hw), I40E_PFHMC_SDDATALOW, val2); \ wr32((hw), I40E_PFHMC_SDDATALOW, val2); \
wr32((hw), I40E_PFHMC_SDCMD, val3); \ wr32((hw), I40E_PFHMC_SDCMD, val3); \
...@@ -146,7 +146,7 @@ struct i40e_hmc_info { ...@@ -146,7 +146,7 @@ struct i40e_hmc_info {
I40E_PFHMC_SDDATALOW_PMSDBPCOUNT_SHIFT) | \ I40E_PFHMC_SDDATALOW_PMSDBPCOUNT_SHIFT) | \
((((type) == I40E_SD_TYPE_PAGED) ? 0 : 1) << \ ((((type) == I40E_SD_TYPE_PAGED) ? 0 : 1) << \
I40E_PFHMC_SDDATALOW_PMSDTYPE_SHIFT); \ I40E_PFHMC_SDDATALOW_PMSDTYPE_SHIFT); \
val3 = (sd_index) | (1 << I40E_PFHMC_SDCMD_PMSDWR_SHIFT); \ val3 = (sd_index) | (1u << I40E_PFHMC_SDCMD_PMSDWR_SHIFT); \
wr32((hw), I40E_PFHMC_SDDATAHIGH, 0); \ wr32((hw), I40E_PFHMC_SDDATAHIGH, 0); \
wr32((hw), I40E_PFHMC_SDDATALOW, val2); \ wr32((hw), I40E_PFHMC_SDDATALOW, val2); \
wr32((hw), I40E_PFHMC_SDCMD, val3); \ wr32((hw), I40E_PFHMC_SDCMD, val3); \
......
...@@ -50,7 +50,11 @@ static void i40e_unmap_and_free_tx_resource(struct i40e_ring *ring, ...@@ -50,7 +50,11 @@ static void i40e_unmap_and_free_tx_resource(struct i40e_ring *ring,
struct i40e_tx_buffer *tx_buffer) struct i40e_tx_buffer *tx_buffer)
{ {
if (tx_buffer->skb) { if (tx_buffer->skb) {
dev_kfree_skb_any(tx_buffer->skb); if (tx_buffer->tx_flags & I40E_TX_FLAGS_FD_SB)
kfree(tx_buffer->raw_buf);
else
dev_kfree_skb_any(tx_buffer->skb);
if (dma_unmap_len(tx_buffer, len)) if (dma_unmap_len(tx_buffer, len))
dma_unmap_single(ring->dev, dma_unmap_single(ring->dev,
dma_unmap_addr(tx_buffer, dma), dma_unmap_addr(tx_buffer, dma),
......
...@@ -130,6 +130,7 @@ enum i40e_dyn_idx_t { ...@@ -130,6 +130,7 @@ enum i40e_dyn_idx_t {
#define I40E_TX_FLAGS_IPV6 (u32)(1 << 5) #define I40E_TX_FLAGS_IPV6 (u32)(1 << 5)
#define I40E_TX_FLAGS_FCCRC (u32)(1 << 6) #define I40E_TX_FLAGS_FCCRC (u32)(1 << 6)
#define I40E_TX_FLAGS_FSO (u32)(1 << 7) #define I40E_TX_FLAGS_FSO (u32)(1 << 7)
#define I40E_TX_FLAGS_FD_SB (u32)(1 << 9)
#define I40E_TX_FLAGS_VLAN_MASK 0xffff0000 #define I40E_TX_FLAGS_VLAN_MASK 0xffff0000
#define I40E_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000 #define I40E_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000
#define I40E_TX_FLAGS_VLAN_PRIO_SHIFT 29 #define I40E_TX_FLAGS_VLAN_PRIO_SHIFT 29
...@@ -138,7 +139,10 @@ enum i40e_dyn_idx_t { ...@@ -138,7 +139,10 @@ enum i40e_dyn_idx_t {
struct i40e_tx_buffer { struct i40e_tx_buffer {
struct i40e_tx_desc *next_to_watch; struct i40e_tx_desc *next_to_watch;
unsigned long time_stamp; unsigned long time_stamp;
struct sk_buff *skb; union {
struct sk_buff *skb;
void *raw_buf;
};
unsigned int bytecount; unsigned int bytecount;
unsigned short gso_segs; unsigned short gso_segs;
DEFINE_DMA_UNMAP_ADDR(dma); DEFINE_DMA_UNMAP_ADDR(dma);
......
...@@ -140,6 +140,14 @@ enum i40e_fc_mode { ...@@ -140,6 +140,14 @@ enum i40e_fc_mode {
I40E_FC_DEFAULT I40E_FC_DEFAULT
}; };
enum i40e_set_fc_aq_failures {
I40E_SET_FC_AQ_FAIL_NONE = 0,
I40E_SET_FC_AQ_FAIL_GET = 1,
I40E_SET_FC_AQ_FAIL_SET = 2,
I40E_SET_FC_AQ_FAIL_UPDATE = 4,
I40E_SET_FC_AQ_FAIL_SET_UPDATE = 6
};
enum i40e_vsi_type { enum i40e_vsi_type {
I40E_VSI_MAIN = 0, I40E_VSI_MAIN = 0,
I40E_VSI_VMDQ1, I40E_VSI_VMDQ1,
...@@ -166,6 +174,7 @@ struct i40e_link_status { ...@@ -166,6 +174,7 @@ struct i40e_link_status {
u8 an_info; u8 an_info;
u8 ext_info; u8 ext_info;
u8 loopback; u8 loopback;
bool an_enabled;
/* is Link Status Event notification to SW enabled */ /* is Link Status Event notification to SW enabled */
bool lse_enable; bool lse_enable;
u16 max_frame_size; u16 max_frame_size;
......
...@@ -36,7 +36,7 @@ char i40evf_driver_name[] = "i40evf"; ...@@ -36,7 +36,7 @@ char i40evf_driver_name[] = "i40evf";
static const char i40evf_driver_string[] = static const char i40evf_driver_string[] =
"Intel(R) XL710/X710 Virtual Function Network Driver"; "Intel(R) XL710/X710 Virtual Function Network Driver";
#define DRV_VERSION "0.9.38" #define DRV_VERSION "0.9.40"
const char i40evf_driver_version[] = DRV_VERSION; const char i40evf_driver_version[] = DRV_VERSION;
static const char i40evf_copyright[] = static const char i40evf_copyright[] =
"Copyright (c) 2013 - 2014 Intel Corporation."; "Copyright (c) 2013 - 2014 Intel Corporation.";
...@@ -260,6 +260,12 @@ static void i40evf_fire_sw_int(struct i40evf_adapter *adapter, ...@@ -260,6 +260,12 @@ static void i40evf_fire_sw_int(struct i40evf_adapter *adapter,
int i; int i;
uint32_t dyn_ctl; uint32_t dyn_ctl;
if (mask & 1) {
dyn_ctl = rd32(hw, I40E_VFINT_DYN_CTL01);
dyn_ctl |= I40E_VFINT_DYN_CTLN_SWINT_TRIG_MASK |
I40E_VFINT_DYN_CTLN_CLEARPBA_MASK;
wr32(hw, I40E_VFINT_DYN_CTL01, dyn_ctl);
}
for (i = 1; i < adapter->num_msix_vectors; i++) { for (i = 1; i < adapter->num_msix_vectors; i++) {
if (mask & (1 << i)) { if (mask & (1 << i)) {
dyn_ctl = rd32(hw, I40E_VFINT_DYN_CTLN1(i - 1)); dyn_ctl = rd32(hw, I40E_VFINT_DYN_CTLN1(i - 1));
...@@ -278,6 +284,7 @@ void i40evf_irq_enable(struct i40evf_adapter *adapter, bool flush) ...@@ -278,6 +284,7 @@ void i40evf_irq_enable(struct i40evf_adapter *adapter, bool flush)
{ {
struct i40e_hw *hw = &adapter->hw; struct i40e_hw *hw = &adapter->hw;
i40evf_misc_irq_enable(adapter);
i40evf_irq_enable_queues(adapter, ~0); i40evf_irq_enable_queues(adapter, ~0);
if (flush) if (flush)
......
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