Skip to content

Commit 2069230

Browse files
committed
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 40GbE Intel Wired LAN Driver Updates 2016-02-17 This series contains updates to i40e/i40evf only. Jesse cleans up a duplicate declaration in probe. Then fixes a bug where the driver was using a offset based off a DMA handle while mapping and unmapping using sync_single_range_for_[cpu|device], when it should be using DMA handle (returned from alloc_coherent) and the offset of the memory to be sync'd. Fixed an issue where sync_vsi_filter() was allocating memory in a way that could sleep (GFP_KERNEL) which was causing a problem when called by the team driver under rcu_read_lock(). Shannon adds a check to ensure we do not attempt to do TSO when skb->ip_summed is not set to CHECKSUM_PARTIAL. Kiran add functions related to port mirroring features such as add/delete mirror rule. Jacob assigns the i40e_pf structure directly instead of using a large memcpy, to avoid a sparse warning and lets the compiler optimize the copy since it know the size of the structure in advance. Anjali enables GENEVE capability for XL710/X710 devices with firmware API version higher than 1.4. Added flag for automatic rule eviction feature for X722, which is disabled by default. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 024af15 + ba94272 commit 2069230

File tree

10 files changed

+254
-65
lines changed

10 files changed

+254
-65
lines changed

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
#define I40E_PRIV_FLAGS_FD_ATR BIT(2)
105105
#define I40E_PRIV_FLAGS_VEB_STATS BIT(3)
106106
#define I40E_PRIV_FLAGS_PS BIT(4)
107+
#define I40E_PRIV_FLAGS_HW_ATR_EVICT BIT(5)
107108

108109
#define I40E_NVM_VERSION_LO_SHIFT 0
109110
#define I40E_NVM_VERSION_LO_MASK (0xff << I40E_NVM_VERSION_LO_SHIFT)
@@ -757,7 +758,6 @@ static inline void i40e_irq_dynamic_enable(struct i40e_vsi *vsi, int vector)
757758
/* skip the flush */
758759
}
759760

760-
void i40e_irq_dynamic_disable(struct i40e_vsi *vsi, int vector);
761761
void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf);
762762
void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf);
763763
#ifdef I40E_FCOE

drivers/net/ethernet/intel/i40e/i40e_common.c

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,6 +2032,37 @@ i40e_status i40e_aq_set_vsi_broadcast(struct i40e_hw *hw,
20322032
return status;
20332033
}
20342034

2035+
/**
2036+
* i40e_aq_set_vsi_vlan_promisc - control the VLAN promiscuous setting
2037+
* @hw: pointer to the hw struct
2038+
* @seid: vsi number
2039+
* @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN
2040+
* @cmd_details: pointer to command details structure or NULL
2041+
**/
2042+
i40e_status i40e_aq_set_vsi_vlan_promisc(struct i40e_hw *hw,
2043+
u16 seid, bool enable,
2044+
struct i40e_asq_cmd_details *cmd_details)
2045+
{
2046+
struct i40e_aq_desc desc;
2047+
struct i40e_aqc_set_vsi_promiscuous_modes *cmd =
2048+
(struct i40e_aqc_set_vsi_promiscuous_modes *)&desc.params.raw;
2049+
i40e_status status;
2050+
u16 flags = 0;
2051+
2052+
i40e_fill_default_direct_cmd_desc(&desc,
2053+
i40e_aqc_opc_set_vsi_promiscuous_modes);
2054+
if (enable)
2055+
flags |= I40E_AQC_SET_VSI_PROMISC_VLAN;
2056+
2057+
cmd->promiscuous_flags = cpu_to_le16(flags);
2058+
cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_VLAN);
2059+
cmd->seid = cpu_to_le16(seid);
2060+
2061+
status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
2062+
2063+
return status;
2064+
}
2065+
20352066
/**
20362067
* i40e_get_vsi_params - get VSI configuration info
20372068
* @hw: pointer to the hw struct
@@ -2469,6 +2500,137 @@ i40e_status i40e_aq_remove_macvlan(struct i40e_hw *hw, u16 seid,
24692500
return status;
24702501
}
24712502

2503+
/**
2504+
* i40e_mirrorrule_op - Internal helper function to add/delete mirror rule
2505+
* @hw: pointer to the hw struct
2506+
* @opcode: AQ opcode for add or delete mirror rule
2507+
* @sw_seid: Switch SEID (to which rule refers)
2508+
* @rule_type: Rule Type (ingress/egress/VLAN)
2509+
* @id: Destination VSI SEID or Rule ID
2510+
* @count: length of the list
2511+
* @mr_list: list of mirrored VSI SEIDs or VLAN IDs
2512+
* @cmd_details: pointer to command details structure or NULL
2513+
* @rule_id: Rule ID returned from FW
2514+
* @rule_used: Number of rules used in internal switch
2515+
* @rule_free: Number of rules free in internal switch
2516+
*
2517+
* Add/Delete a mirror rule to a specific switch. Mirror rules are supported for
2518+
* VEBs/VEPA elements only
2519+
**/
2520+
static i40e_status i40e_mirrorrule_op(struct i40e_hw *hw,
2521+
u16 opcode, u16 sw_seid, u16 rule_type, u16 id,
2522+
u16 count, __le16 *mr_list,
2523+
struct i40e_asq_cmd_details *cmd_details,
2524+
u16 *rule_id, u16 *rules_used, u16 *rules_free)
2525+
{
2526+
struct i40e_aq_desc desc;
2527+
struct i40e_aqc_add_delete_mirror_rule *cmd =
2528+
(struct i40e_aqc_add_delete_mirror_rule *)&desc.params.raw;
2529+
struct i40e_aqc_add_delete_mirror_rule_completion *resp =
2530+
(struct i40e_aqc_add_delete_mirror_rule_completion *)&desc.params.raw;
2531+
i40e_status status;
2532+
u16 buf_size;
2533+
2534+
buf_size = count * sizeof(*mr_list);
2535+
2536+
/* prep the rest of the request */
2537+
i40e_fill_default_direct_cmd_desc(&desc, opcode);
2538+
cmd->seid = cpu_to_le16(sw_seid);
2539+
cmd->rule_type = cpu_to_le16(rule_type &
2540+
I40E_AQC_MIRROR_RULE_TYPE_MASK);
2541+
cmd->num_entries = cpu_to_le16(count);
2542+
/* Dest VSI for add, rule_id for delete */
2543+
cmd->destination = cpu_to_le16(id);
2544+
if (mr_list) {
2545+
desc.flags |= cpu_to_le16((u16)(I40E_AQ_FLAG_BUF |
2546+
I40E_AQ_FLAG_RD));
2547+
if (buf_size > I40E_AQ_LARGE_BUF)
2548+
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB);
2549+
}
2550+
2551+
status = i40e_asq_send_command(hw, &desc, mr_list, buf_size,
2552+
cmd_details);
2553+
if (!status ||
2554+
hw->aq.asq_last_status == I40E_AQ_RC_ENOSPC) {
2555+
if (rule_id)
2556+
*rule_id = le16_to_cpu(resp->rule_id);
2557+
if (rules_used)
2558+
*rules_used = le16_to_cpu(resp->mirror_rules_used);
2559+
if (rules_free)
2560+
*rules_free = le16_to_cpu(resp->mirror_rules_free);
2561+
}
2562+
return status;
2563+
}
2564+
2565+
/**
2566+
* i40e_aq_add_mirrorrule - add a mirror rule
2567+
* @hw: pointer to the hw struct
2568+
* @sw_seid: Switch SEID (to which rule refers)
2569+
* @rule_type: Rule Type (ingress/egress/VLAN)
2570+
* @dest_vsi: SEID of VSI to which packets will be mirrored
2571+
* @count: length of the list
2572+
* @mr_list: list of mirrored VSI SEIDs or VLAN IDs
2573+
* @cmd_details: pointer to command details structure or NULL
2574+
* @rule_id: Rule ID returned from FW
2575+
* @rule_used: Number of rules used in internal switch
2576+
* @rule_free: Number of rules free in internal switch
2577+
*
2578+
* Add mirror rule. Mirror rules are supported for VEBs or VEPA elements only
2579+
**/
2580+
i40e_status i40e_aq_add_mirrorrule(struct i40e_hw *hw, u16 sw_seid,
2581+
u16 rule_type, u16 dest_vsi, u16 count, __le16 *mr_list,
2582+
struct i40e_asq_cmd_details *cmd_details,
2583+
u16 *rule_id, u16 *rules_used, u16 *rules_free)
2584+
{
2585+
if (!(rule_type == I40E_AQC_MIRROR_RULE_TYPE_ALL_INGRESS ||
2586+
rule_type == I40E_AQC_MIRROR_RULE_TYPE_ALL_EGRESS)) {
2587+
if (count == 0 || !mr_list)
2588+
return I40E_ERR_PARAM;
2589+
}
2590+
2591+
return i40e_mirrorrule_op(hw, i40e_aqc_opc_add_mirror_rule, sw_seid,
2592+
rule_type, dest_vsi, count, mr_list,
2593+
cmd_details, rule_id, rules_used, rules_free);
2594+
}
2595+
2596+
/**
2597+
* i40e_aq_delete_mirrorrule - delete a mirror rule
2598+
* @hw: pointer to the hw struct
2599+
* @sw_seid: Switch SEID (to which rule refers)
2600+
* @rule_type: Rule Type (ingress/egress/VLAN)
2601+
* @count: length of the list
2602+
* @rule_id: Rule ID that is returned in the receive desc as part of
2603+
* add_mirrorrule.
2604+
* @mr_list: list of mirrored VLAN IDs to be removed
2605+
* @cmd_details: pointer to command details structure or NULL
2606+
* @rule_used: Number of rules used in internal switch
2607+
* @rule_free: Number of rules free in internal switch
2608+
*
2609+
* Delete a mirror rule. Mirror rules are supported for VEBs/VEPA elements only
2610+
**/
2611+
i40e_status i40e_aq_delete_mirrorrule(struct i40e_hw *hw, u16 sw_seid,
2612+
u16 rule_type, u16 rule_id, u16 count, __le16 *mr_list,
2613+
struct i40e_asq_cmd_details *cmd_details,
2614+
u16 *rules_used, u16 *rules_free)
2615+
{
2616+
/* Rule ID has to be valid except rule_type: INGRESS VLAN mirroring */
2617+
if (rule_type != I40E_AQC_MIRROR_RULE_TYPE_VLAN) {
2618+
if (!rule_id)
2619+
return I40E_ERR_PARAM;
2620+
} else {
2621+
/* count and mr_list shall be valid for rule_type INGRESS VLAN
2622+
* mirroring. For other rule_type, count and rule_type should
2623+
* not matter.
2624+
*/
2625+
if (count == 0 || !mr_list)
2626+
return I40E_ERR_PARAM;
2627+
}
2628+
2629+
return i40e_mirrorrule_op(hw, i40e_aqc_opc_delete_mirror_rule, sw_seid,
2630+
rule_type, rule_id, count, mr_list,
2631+
cmd_details, NULL, rules_used, rules_free);
2632+
}
2633+
24722634
/**
24732635
* i40e_aq_send_msg_to_vf
24742636
* @hw: pointer to the hardware structure

drivers/net/ethernet/intel/i40e/i40e_debugfs.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,11 @@ static ssize_t i40e_dbg_dump_write(struct file *filp,
185185
if (i40e_dbg_prep_dump_buf(pf, buflen)) {
186186
p = i40e_dbg_dump_buf;
187187

188-
len = sizeof(struct i40e_pf);
189-
memcpy(p, pf, len);
190-
p += len;
188+
/* avoid use of memcpy here due to sparse warning
189+
* about copy size.
190+
*/
191+
*((struct i40e_pf *)p) = *pf;
192+
p += sizeof(struct i40e_pf);
191193

192194
len = (sizeof(struct i40e_aq_desc)
193195
* pf->hw.aq.num_asq_entries);

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {
8989
I40E_VSI_STAT("rx_unknown_protocol", eth_stats.rx_unknown_protocol),
9090
I40E_VSI_STAT("tx_linearize", tx_linearize),
9191
I40E_VSI_STAT("tx_force_wb", tx_force_wb),
92+
I40E_VSI_STAT("rx_alloc_fail", rx_buf_failed),
93+
I40E_VSI_STAT("rx_pg_alloc_fail", rx_page_failed),
9294
};
9395

9496
/* These PF_STATs might look like duplicates of some NETDEV_STATs,
@@ -233,6 +235,7 @@ static const char i40e_priv_flags_strings[][ETH_GSTRING_LEN] = {
233235
"flow-director-atr",
234236
"veb-stats",
235237
"packet-split",
238+
"hw-atr-eviction",
236239
};
237240

238241
#define I40E_PRIV_FLAGS_STR_LEN ARRAY_SIZE(i40e_priv_flags_strings)
@@ -2729,6 +2732,8 @@ static u32 i40e_get_priv_flags(struct net_device *dev)
27292732
I40E_PRIV_FLAGS_VEB_STATS : 0;
27302733
ret_flags |= pf->flags & I40E_FLAG_RX_PS_ENABLED ?
27312734
I40E_PRIV_FLAGS_PS : 0;
2735+
ret_flags |= pf->auto_disable_flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE ?
2736+
0 : I40E_PRIV_FLAGS_HW_ATR_EVICT;
27322737

27332738
return ret_flags;
27342739
}
@@ -2785,6 +2790,12 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
27852790
else
27862791
pf->flags &= ~I40E_FLAG_VEB_STATS_ENABLED;
27872792

2793+
if ((flags & I40E_PRIV_FLAGS_HW_ATR_EVICT) &&
2794+
(pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE))
2795+
pf->auto_disable_flags &= ~I40E_FLAG_HW_ATR_EVICT_CAPABLE;
2796+
else
2797+
pf->auto_disable_flags |= I40E_FLAG_HW_ATR_EVICT_CAPABLE;
2798+
27882799
/* if needed, issue reset to cause things to take effect */
27892800
if (reset_required)
27902801
i40e_do_reset(pf, BIT(__I40E_PF_RESET_REQUESTED));

0 commit comments

Comments
 (0)