aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-04-07 00:06:38 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-07 00:06:38 -0400
commitde6099e27ef33086d7a967bbfce078952312b74d (patch)
tree56cd02272f18f36d9e9c7fda6c2cfac96c1a52c6
parent58a01d4dc43e60208b70ce08604b5bcbb907f0d1 (diff)
parentba6cc7f6f194e3645368f87d951bedd7e3b75f39 (diff)
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-04-06 This series contains updates to i40e and i40evf. Deepthi adds a debug message to display the MSIx vector count for hardware capabilities. Shannon removed the setting of debug_mask at startup to take care of an issue where all the device capabilities getting printed when we had not asked for it. Moved the NVM status out of the admin queue structure, since it should really stay with the other NVM data structures. Akeem added the flush routine to the end of the reset flow to avoid problems in the pass-through routines. Jesse moves a local variable deeper into the depths of the driver where the light is low and the context is great. Then cleaned up the tx_ring argument since it was not making good arguments. Improved performance by not "checking for FCoE" by re-ordering the FCoE checks. Anjali adds the support for changing a VF from non-trusted to trusted and vice-versa. Mitch adds opcodes and structures to support RSS configuration by PF driver on behalf of the VF driver. Fixed how the VLAN feature flags are set. Kiran added defines for RSS, flow director, flexible payload and IPv6. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_adminq.c33
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_adminq.h1
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_common.c3
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_fcoe.c12
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c4
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_nvm.c43
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_prototype.h1
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c17
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.h10
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_type.h34
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl.h45
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c53
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h2
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_adminq.h1
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_txrx.c13
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_txrx.h10
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_type.h43
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h45
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_main.c29
19 files changed, 311 insertions, 88 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
index df8e2fd6a649..43bb4139d896 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
@@ -33,16 +33,6 @@
33static void i40e_resume_aq(struct i40e_hw *hw); 33static void i40e_resume_aq(struct i40e_hw *hw);
34 34
35/** 35/**
36 * i40e_is_nvm_update_op - return true if this is an NVM update operation
37 * @desc: API request descriptor
38 **/
39static inline bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc)
40{
41 return (desc->opcode == cpu_to_le16(i40e_aqc_opc_nvm_erase)) ||
42 (desc->opcode == cpu_to_le16(i40e_aqc_opc_nvm_update));
43}
44
45/**
46 * i40e_adminq_init_regs - Initialize AdminQ registers 36 * i40e_adminq_init_regs - Initialize AdminQ registers
47 * @hw: pointer to the hardware structure 37 * @hw: pointer to the hardware structure
48 * 38 *
@@ -624,7 +614,7 @@ i40e_status i40e_init_adminq(struct i40e_hw *hw)
624 614
625 /* pre-emptive resource lock release */ 615 /* pre-emptive resource lock release */
626 i40e_aq_release_resource(hw, I40E_NVM_RESOURCE_ID, 0, NULL); 616 i40e_aq_release_resource(hw, I40E_NVM_RESOURCE_ID, 0, NULL);
627 hw->aq.nvm_release_on_done = false; 617 hw->nvm_release_on_done = false;
628 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; 618 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
629 619
630 ret_code = i40e_aq_set_hmc_resource_profile(hw, 620 ret_code = i40e_aq_set_hmc_resource_profile(hw,
@@ -1023,26 +1013,7 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw,
1023 hw->aq.arq.next_to_clean = ntc; 1013 hw->aq.arq.next_to_clean = ntc;
1024 hw->aq.arq.next_to_use = ntu; 1014 hw->aq.arq.next_to_use = ntu;
1025 1015
1026 if (i40e_is_nvm_update_op(&e->desc)) { 1016 i40e_nvmupd_check_wait_event(hw, le16_to_cpu(e->desc.opcode));
1027 if (hw->aq.nvm_release_on_done) {
1028 i40e_release_nvm(hw);
1029 hw->aq.nvm_release_on_done = false;
1030 }
1031
1032 switch (hw->nvmupd_state) {
1033 case I40E_NVMUPD_STATE_INIT_WAIT:
1034 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
1035 break;
1036
1037 case I40E_NVMUPD_STATE_WRITE_WAIT:
1038 hw->nvmupd_state = I40E_NVMUPD_STATE_WRITING;
1039 break;
1040
1041 default:
1042 break;
1043 }
1044 }
1045
1046clean_arq_element_out: 1017clean_arq_element_out:
1047 /* Set pending if needed, unlock and return */ 1018 /* Set pending if needed, unlock and return */
1048 if (pending) 1019 if (pending)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.h b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
index 12fbbddea299..d92aad38afdc 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
@@ -97,7 +97,6 @@ struct i40e_adminq_info {
97 u32 fw_build; /* firmware build number */ 97 u32 fw_build; /* firmware build number */
98 u16 api_maj_ver; /* api major version */ 98 u16 api_maj_ver; /* api major version */
99 u16 api_min_ver; /* api minor version */ 99 u16 api_min_ver; /* api minor version */
100 bool nvm_release_on_done;
101 100
102 struct mutex asq_mutex; /* Send queue lock */ 101 struct mutex asq_mutex; /* Send queue lock */
103 struct mutex arq_mutex; /* Receive queue lock */ 102 struct mutex arq_mutex; /* Receive queue lock */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index ebcc0d3ecbfb..f3c1d8890cbb 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -3080,6 +3080,9 @@ static void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff,
3080 break; 3080 break;
3081 case I40E_AQ_CAP_ID_MSIX: 3081 case I40E_AQ_CAP_ID_MSIX:
3082 p->num_msix_vectors = number; 3082 p->num_msix_vectors = number;
3083 i40e_debug(hw, I40E_DEBUG_INIT,
3084 "HW Capability: MSIX vector count = %d\n",
3085 p->num_msix_vectors);
3083 break; 3086 break;
3084 case I40E_AQ_CAP_ID_VF_MSIX: 3087 case I40E_AQ_CAP_ID_VF_MSIX:
3085 p->num_msix_vectors_vf = number; 3088 p->num_msix_vectors_vf = number;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
index 92d2208d13c7..58e6c1570335 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 * 2 *
3 * Intel Ethernet Controller XL710 Family Linux Driver 3 * Intel Ethernet Controller XL710 Family Linux Driver
4 * Copyright(c) 2013 - 2015 Intel Corporation. 4 * Copyright(c) 2013 - 2016 Intel Corporation.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -38,16 +38,6 @@
38#include "i40e_fcoe.h" 38#include "i40e_fcoe.h"
39 39
40/** 40/**
41 * i40e_rx_is_fcoe - returns true if the rx packet type is FCoE
42 * @ptype: the packet type field from rx descriptor write-back
43 **/
44static inline bool i40e_rx_is_fcoe(u16 ptype)
45{
46 return (ptype >= I40E_RX_PTYPE_L2_FCOE_PAY3) &&
47 (ptype <= I40E_RX_PTYPE_L2_FCOE_VFT_FCOTHER);
48}
49
50/**
51 * i40e_fcoe_sof_is_class2 - returns true if this is a FC Class 2 SOF 41 * i40e_fcoe_sof_is_class2 - returns true if this is a FC Class 2 SOF
52 * @sof: the FCoE start of frame delimiter 42 * @sof: the FCoE start of frame delimiter
53 **/ 43 **/
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index d6147f899062..dc3b3939dd0a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -46,7 +46,7 @@ static const char i40e_driver_string[] =
46 46
47#define DRV_VERSION_MAJOR 1 47#define DRV_VERSION_MAJOR 1
48#define DRV_VERSION_MINOR 5 48#define DRV_VERSION_MINOR 5
49#define DRV_VERSION_BUILD 2 49#define DRV_VERSION_BUILD 5
50#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ 50#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
51 __stringify(DRV_VERSION_MINOR) "." \ 51 __stringify(DRV_VERSION_MINOR) "." \
52 __stringify(DRV_VERSION_BUILD) DRV_KERN 52 __stringify(DRV_VERSION_BUILD) DRV_KERN
@@ -8438,7 +8438,6 @@ static int i40e_sw_init(struct i40e_pf *pf)
8438 8438
8439 pf->msg_enable = netif_msg_init(I40E_DEFAULT_MSG_ENABLE, 8439 pf->msg_enable = netif_msg_init(I40E_DEFAULT_MSG_ENABLE,
8440 (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)); 8440 (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK));
8441 pf->hw.debug_mask = pf->msg_enable | I40E_DEBUG_DIAG;
8442 if (debug != -1 && debug != I40E_DEFAULT_MSG_ENABLE) { 8441 if (debug != -1 && debug != I40E_DEFAULT_MSG_ENABLE) {
8443 if (I40E_DEBUG_USER & debug) 8442 if (I40E_DEBUG_USER & debug)
8444 pf->hw.debug_mask = debug; 8443 pf->hw.debug_mask = debug;
@@ -9070,6 +9069,7 @@ static const struct net_device_ops i40e_netdev_ops = {
9070 .ndo_get_vf_config = i40e_ndo_get_vf_config, 9069 .ndo_get_vf_config = i40e_ndo_get_vf_config,
9071 .ndo_set_vf_link_state = i40e_ndo_set_vf_link_state, 9070 .ndo_set_vf_link_state = i40e_ndo_set_vf_link_state,
9072 .ndo_set_vf_spoofchk = i40e_ndo_set_vf_spoofchk, 9071 .ndo_set_vf_spoofchk = i40e_ndo_set_vf_spoofchk,
9072 .ndo_set_vf_trust = i40e_ndo_set_vf_trust,
9073#if IS_ENABLED(CONFIG_VXLAN) 9073#if IS_ENABLED(CONFIG_VXLAN)
9074 .ndo_add_vxlan_port = i40e_add_vxlan_port, 9074 .ndo_add_vxlan_port = i40e_add_vxlan_port,
9075 .ndo_del_vxlan_port = i40e_del_vxlan_port, 9075 .ndo_del_vxlan_port = i40e_del_vxlan_port,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index 5730f8091e1b..f2cea3d25de3 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -696,7 +696,7 @@ i40e_status i40e_nvmupd_command(struct i40e_hw *hw,
696 i40e_debug(hw, I40E_DEBUG_NVM, "%s state %d nvm_release_on_hold %d cmd 0x%08x config 0x%08x offset 0x%08x data_size 0x%08x\n", 696 i40e_debug(hw, I40E_DEBUG_NVM, "%s state %d nvm_release_on_hold %d cmd 0x%08x config 0x%08x offset 0x%08x data_size 0x%08x\n",
697 i40e_nvm_update_state_str[upd_cmd], 697 i40e_nvm_update_state_str[upd_cmd],
698 hw->nvmupd_state, 698 hw->nvmupd_state,
699 hw->aq.nvm_release_on_done, 699 hw->nvm_release_on_done,
700 cmd->command, cmd->config, cmd->offset, cmd->data_size); 700 cmd->command, cmd->config, cmd->offset, cmd->data_size);
701 701
702 if (upd_cmd == I40E_NVMUPD_INVALID) { 702 if (upd_cmd == I40E_NVMUPD_INVALID) {
@@ -799,7 +799,7 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,
799 if (status) { 799 if (status) {
800 i40e_release_nvm(hw); 800 i40e_release_nvm(hw);
801 } else { 801 } else {
802 hw->aq.nvm_release_on_done = true; 802 hw->nvm_release_on_done = true;
803 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT; 803 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT;
804 } 804 }
805 } 805 }
@@ -815,7 +815,7 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,
815 if (status) { 815 if (status) {
816 i40e_release_nvm(hw); 816 i40e_release_nvm(hw);
817 } else { 817 } else {
818 hw->aq.nvm_release_on_done = true; 818 hw->nvm_release_on_done = true;
819 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT; 819 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT;
820 } 820 }
821 } 821 }
@@ -849,7 +849,7 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,
849 -EIO; 849 -EIO;
850 i40e_release_nvm(hw); 850 i40e_release_nvm(hw);
851 } else { 851 } else {
852 hw->aq.nvm_release_on_done = true; 852 hw->nvm_release_on_done = true;
853 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT; 853 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT;
854 } 854 }
855 } 855 }
@@ -953,7 +953,7 @@ retry:
953 -EIO; 953 -EIO;
954 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; 954 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
955 } else { 955 } else {
956 hw->aq.nvm_release_on_done = true; 956 hw->nvm_release_on_done = true;
957 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT; 957 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT;
958 } 958 }
959 break; 959 break;
@@ -980,7 +980,7 @@ retry:
980 -EIO; 980 -EIO;
981 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; 981 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
982 } else { 982 } else {
983 hw->aq.nvm_release_on_done = true; 983 hw->nvm_release_on_done = true;
984 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT; 984 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT_WAIT;
985 } 985 }
986 break; 986 break;
@@ -1030,6 +1030,37 @@ retry:
1030} 1030}
1031 1031
1032/** 1032/**
1033 * i40e_nvmupd_check_wait_event - handle NVM update operation events
1034 * @hw: pointer to the hardware structure
1035 * @opcode: the event that just happened
1036 **/
1037void i40e_nvmupd_check_wait_event(struct i40e_hw *hw, u16 opcode)
1038{
1039 if (opcode == i40e_aqc_opc_nvm_erase ||
1040 opcode == i40e_aqc_opc_nvm_update) {
1041 i40e_debug(hw, I40E_DEBUG_NVM,
1042 "NVMUPD: clearing wait on opcode 0x%04x\n", opcode);
1043 if (hw->nvm_release_on_done) {
1044 i40e_release_nvm(hw);
1045 hw->nvm_release_on_done = false;
1046 }
1047
1048 switch (hw->nvmupd_state) {
1049 case I40E_NVMUPD_STATE_INIT_WAIT:
1050 hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
1051 break;
1052
1053 case I40E_NVMUPD_STATE_WRITE_WAIT:
1054 hw->nvmupd_state = I40E_NVMUPD_STATE_WRITING;
1055 break;
1056
1057 default:
1058 break;
1059 }
1060 }
1061}
1062
1063/**
1033 * i40e_nvmupd_validate_command - Validate given command 1064 * i40e_nvmupd_validate_command - Validate given command
1034 * @hw: pointer to hardware structure 1065 * @hw: pointer to hardware structure
1035 * @cmd: pointer to nvm update command buffer 1066 * @cmd: pointer to nvm update command buffer
diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
index d51eee5bf79a..134035f53f2c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
@@ -308,6 +308,7 @@ i40e_status i40e_validate_nvm_checksum(struct i40e_hw *hw,
308i40e_status i40e_nvmupd_command(struct i40e_hw *hw, 308i40e_status i40e_nvmupd_command(struct i40e_hw *hw,
309 struct i40e_nvm_access *cmd, 309 struct i40e_nvm_access *cmd,
310 u8 *bytes, int *); 310 u8 *bytes, int *);
311void i40e_nvmupd_check_wait_event(struct i40e_hw *hw, u16 opcode);
311void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status); 312void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
312 313
313extern struct i40e_rx_ptype_decoded i40e_ptype_lookup[]; 314extern struct i40e_rx_ptype_decoded i40e_ptype_lookup[];
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 5d5fa5359a1d..29ffed27e5a9 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -1703,7 +1703,9 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, const int budget)
1703 ? le16_to_cpu(rx_desc->wb.qword0.lo_dword.l2tag1) 1703 ? le16_to_cpu(rx_desc->wb.qword0.lo_dword.l2tag1)
1704 : 0; 1704 : 0;
1705#ifdef I40E_FCOE 1705#ifdef I40E_FCOE
1706 if (!i40e_fcoe_handle_offload(rx_ring, rx_desc, skb)) { 1706 if (unlikely(
1707 i40e_rx_is_fcoe(rx_ptype) &&
1708 !i40e_fcoe_handle_offload(rx_ring, rx_desc, skb))) {
1707 dev_kfree_skb_any(skb); 1709 dev_kfree_skb_any(skb);
1708 continue; 1710 continue;
1709 } 1711 }
@@ -1834,7 +1836,9 @@ static int i40e_clean_rx_irq_1buf(struct i40e_ring *rx_ring, int budget)
1834 ? le16_to_cpu(rx_desc->wb.qword0.lo_dword.l2tag1) 1836 ? le16_to_cpu(rx_desc->wb.qword0.lo_dword.l2tag1)
1835 : 0; 1837 : 0;
1836#ifdef I40E_FCOE 1838#ifdef I40E_FCOE
1837 if (!i40e_fcoe_handle_offload(rx_ring, rx_desc, skb)) { 1839 if (unlikely(
1840 i40e_rx_is_fcoe(rx_ptype) &&
1841 !i40e_fcoe_handle_offload(rx_ring, rx_desc, skb))) {
1838 dev_kfree_skb_any(skb); 1842 dev_kfree_skb_any(skb);
1839 continue; 1843 continue;
1840 } 1844 }
@@ -2252,15 +2256,13 @@ out:
2252 2256
2253/** 2257/**
2254 * i40e_tso - set up the tso context descriptor 2258 * i40e_tso - set up the tso context descriptor
2255 * @tx_ring: ptr to the ring to send
2256 * @skb: ptr to the skb we're sending 2259 * @skb: ptr to the skb we're sending
2257 * @hdr_len: ptr to the size of the packet header 2260 * @hdr_len: ptr to the size of the packet header
2258 * @cd_type_cmd_tso_mss: Quad Word 1 2261 * @cd_type_cmd_tso_mss: Quad Word 1
2259 * 2262 *
2260 * Returns 0 if no TSO can happen, 1 if tso is going, or error 2263 * Returns 0 if no TSO can happen, 1 if tso is going, or error
2261 **/ 2264 **/
2262static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb, 2265static int i40e_tso(struct sk_buff *skb, u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
2263 u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
2264{ 2266{
2265 u64 cd_cmd, cd_tso_len, cd_mss; 2267 u64 cd_cmd, cd_tso_len, cd_mss;
2266 union { 2268 union {
@@ -2408,7 +2410,7 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
2408 unsigned char *hdr; 2410 unsigned char *hdr;
2409 } l4; 2411 } l4;
2410 unsigned char *exthdr; 2412 unsigned char *exthdr;
2411 u32 offset, cmd = 0, tunnel = 0; 2413 u32 offset, cmd = 0;
2412 __be16 frag_off; 2414 __be16 frag_off;
2413 u8 l4_proto = 0; 2415 u8 l4_proto = 0;
2414 2416
@@ -2422,6 +2424,7 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
2422 offset = ((ip.hdr - skb->data) / 2) << I40E_TX_DESC_LENGTH_MACLEN_SHIFT; 2424 offset = ((ip.hdr - skb->data) / 2) << I40E_TX_DESC_LENGTH_MACLEN_SHIFT;
2423 2425
2424 if (skb->encapsulation) { 2426 if (skb->encapsulation) {
2427 u32 tunnel = 0;
2425 /* define outer network header type */ 2428 /* define outer network header type */
2426 if (*tx_flags & I40E_TX_FLAGS_IPV4) { 2429 if (*tx_flags & I40E_TX_FLAGS_IPV4) {
2427 tunnel |= (*tx_flags & I40E_TX_FLAGS_TSO) ? 2430 tunnel |= (*tx_flags & I40E_TX_FLAGS_TSO) ?
@@ -2931,7 +2934,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
2931 else if (protocol == htons(ETH_P_IPV6)) 2934 else if (protocol == htons(ETH_P_IPV6))
2932 tx_flags |= I40E_TX_FLAGS_IPV6; 2935 tx_flags |= I40E_TX_FLAGS_IPV6;
2933 2936
2934 tso = i40e_tso(tx_ring, skb, &hdr_len, &cd_type_cmd_tso_mss); 2937 tso = i40e_tso(skb, &hdr_len, &cd_type_cmd_tso_mss);
2935 2938
2936 if (tso < 0) 2939 if (tso < 0)
2937 goto out_drop; 2940 goto out_drop;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
index 9e654e611642..77ccdde56c0c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
@@ -448,4 +448,14 @@ static inline bool i40e_chk_linearize(struct sk_buff *skb, int count)
448 448
449 return __i40e_chk_linearize(skb); 449 return __i40e_chk_linearize(skb);
450} 450}
451
452/**
453 * i40e_rx_is_fcoe - returns true if the Rx packet type is FCoE
454 * @ptype: the packet type field from Rx descriptor write-back
455 **/
456static inline bool i40e_rx_is_fcoe(u16 ptype)
457{
458 return (ptype >= I40E_RX_PTYPE_L2_FCOE_PAY3) &&
459 (ptype <= I40E_RX_PTYPE_L2_FCOE_VFT_FCOTHER);
460}
451#endif /* _I40E_TXRX_H_ */ 461#endif /* _I40E_TXRX_H_ */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index 3335f9d13374..793036b259e5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -549,6 +549,7 @@ struct i40e_hw {
549 enum i40e_nvmupd_state nvmupd_state; 549 enum i40e_nvmupd_state nvmupd_state;
550 struct i40e_aq_desc nvm_wb_desc; 550 struct i40e_aq_desc nvm_wb_desc;
551 struct i40e_virt_mem nvm_buff; 551 struct i40e_virt_mem nvm_buff;
552 bool nvm_release_on_done;
552 553
553 /* HMC info */ 554 /* HMC info */
554 struct i40e_hmc_info hmc; /* HMC info struct */ 555 struct i40e_hmc_info hmc; /* HMC info struct */
@@ -1533,4 +1534,37 @@ struct i40e_lldp_variables {
1533 1534
1534/* RSS Hash Table Size */ 1535/* RSS Hash Table Size */
1535#define I40E_PFQF_CTL_0_HASHLUTSIZE_512 0x00010000 1536#define I40E_PFQF_CTL_0_HASHLUTSIZE_512 0x00010000
1537
1538/* INPUT SET MASK for RSS, flow director, and flexible payload */
1539#define I40E_L3_SRC_SHIFT 47
1540#define I40E_L3_SRC_MASK (0x3ULL << I40E_L3_SRC_SHIFT)
1541#define I40E_L3_V6_SRC_SHIFT 43
1542#define I40E_L3_V6_SRC_MASK (0xFFULL << I40E_L3_V6_SRC_SHIFT)
1543#define I40E_L3_DST_SHIFT 35
1544#define I40E_L3_DST_MASK (0x3ULL << I40E_L3_DST_SHIFT)
1545#define I40E_L3_V6_DST_SHIFT 35
1546#define I40E_L3_V6_DST_MASK (0xFFULL << I40E_L3_V6_DST_SHIFT)
1547#define I40E_L4_SRC_SHIFT 34
1548#define I40E_L4_SRC_MASK (0x1ULL << I40E_L4_SRC_SHIFT)
1549#define I40E_L4_DST_SHIFT 33
1550#define I40E_L4_DST_MASK (0x1ULL << I40E_L4_DST_SHIFT)
1551#define I40E_VERIFY_TAG_SHIFT 31
1552#define I40E_VERIFY_TAG_MASK (0x3ULL << I40E_VERIFY_TAG_SHIFT)
1553
1554#define I40E_FLEX_50_SHIFT 13
1555#define I40E_FLEX_50_MASK (0x1ULL << I40E_FLEX_50_SHIFT)
1556#define I40E_FLEX_51_SHIFT 12
1557#define I40E_FLEX_51_MASK (0x1ULL << I40E_FLEX_51_SHIFT)
1558#define I40E_FLEX_52_SHIFT 11
1559#define I40E_FLEX_52_MASK (0x1ULL << I40E_FLEX_52_SHIFT)
1560#define I40E_FLEX_53_SHIFT 10
1561#define I40E_FLEX_53_MASK (0x1ULL << I40E_FLEX_53_SHIFT)
1562#define I40E_FLEX_54_SHIFT 9
1563#define I40E_FLEX_54_MASK (0x1ULL << I40E_FLEX_54_SHIFT)
1564#define I40E_FLEX_55_SHIFT 8
1565#define I40E_FLEX_55_MASK (0x1ULL << I40E_FLEX_55_SHIFT)
1566#define I40E_FLEX_56_SHIFT 7
1567#define I40E_FLEX_56_MASK (0x1ULL << I40E_FLEX_56_SHIFT)
1568#define I40E_FLEX_57_SHIFT 6
1569#define I40E_FLEX_57_MASK (0x1ULL << I40E_FLEX_57_SHIFT)
1536#endif /* _I40E_TYPE_H_ */ 1570#endif /* _I40E_TYPE_H_ */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h
index ab866cf3dc18..c92a3bdee229 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h
@@ -80,10 +80,15 @@ enum i40e_virtchnl_ops {
80 I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE = 14, 80 I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE = 14,
81 I40E_VIRTCHNL_OP_GET_STATS = 15, 81 I40E_VIRTCHNL_OP_GET_STATS = 15,
82 I40E_VIRTCHNL_OP_FCOE = 16, 82 I40E_VIRTCHNL_OP_FCOE = 16,
83 I40E_VIRTCHNL_OP_EVENT = 17, 83 I40E_VIRTCHNL_OP_EVENT = 17, /* must ALWAYS be 17 */
84 I40E_VIRTCHNL_OP_IWARP = 20, 84 I40E_VIRTCHNL_OP_IWARP = 20,
85 I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21, 85 I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21,
86 I40E_VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP = 22, 86 I40E_VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP = 22,
87 I40E_VIRTCHNL_OP_CONFIG_RSS_KEY = 23,
88 I40E_VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
89 I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,
90 I40E_VIRTCHNL_OP_SET_RSS_HENA = 26,
91
87}; 92};
88 93
89/* Virtual channel message descriptor. This overlays the admin queue 94/* Virtual channel message descriptor. This overlays the admin queue
@@ -157,6 +162,7 @@ struct i40e_virtchnl_vsi_resource {
157#define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000 162#define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000
158#define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000 163#define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
159#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000 164#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
165#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
160 166
161struct i40e_virtchnl_vf_resource { 167struct i40e_virtchnl_vf_resource {
162 u16 num_vsis; 168 u16 num_vsis;
@@ -165,8 +171,8 @@ struct i40e_virtchnl_vf_resource {
165 u16 max_mtu; 171 u16 max_mtu;
166 172
167 u32 vf_offload_flags; 173 u32 vf_offload_flags;
168 u32 max_fcoe_contexts; 174 u32 rss_key_size;
169 u32 max_fcoe_filters; 175 u32 rss_lut_size;
170 176
171 struct i40e_virtchnl_vsi_resource vsi_res[1]; 177 struct i40e_virtchnl_vsi_resource vsi_res[1];
172}; 178};
@@ -325,6 +331,39 @@ struct i40e_virtchnl_promisc_info {
325 * PF replies with struct i40e_eth_stats in an external buffer. 331 * PF replies with struct i40e_eth_stats in an external buffer.
326 */ 332 */
327 333
334/* I40E_VIRTCHNL_OP_CONFIG_RSS_KEY
335 * I40E_VIRTCHNL_OP_CONFIG_RSS_LUT
336 * VF sends these messages to configure RSS. Only supported if both PF
337 * and VF drivers set the I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF bit during
338 * configuration negotiation. If this is the case, then the RSS fields in
339 * the VF resource struct are valid.
340 * Both the key and LUT are initialized to 0 by the PF, meaning that
341 * RSS is effectively disabled until set up by the VF.
342 */
343struct i40e_virtchnl_rss_key {
344 u16 vsi_id;
345 u16 key_len;
346 u8 key[1]; /* RSS hash key, packed bytes */
347};
348
349struct i40e_virtchnl_rss_lut {
350 u16 vsi_id;
351 u16 lut_entries;
352 u8 lut[1]; /* RSS lookup table*/
353};
354
355/* I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS
356 * I40E_VIRTCHNL_OP_SET_RSS_HENA
357 * VF sends these messages to get and set the hash filter enable bits for RSS.
358 * By default, the PF sets these to all possible traffic types that the
359 * hardware supports. The VF can query this value if it wants to change the
360 * traffic types that are hashed by the hardware.
361 * Traffic types are defined in the i40e_filter_pctype enum in i40e_type.h
362 */
363struct i40e_virtchnl_rss_hena {
364 u64 hena;
365};
366
328/* I40E_VIRTCHNL_OP_EVENT 367/* I40E_VIRTCHNL_OP_EVENT
329 * PF sends this message to inform the VF driver of events that may affect it. 368 * PF sends this message to inform the VF driver of events that may affect it.
330 * No direct response is expected from the VF, though it may generate other 369 * No direct response is expected from the VF, though it may generate other
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 9924503c88f5..30f8cbe6b54b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -941,6 +941,7 @@ void i40e_reset_vf(struct i40e_vf *vf, bool flr)
941 reg_idx = (hw->func_caps.vf_base_id + vf->vf_id) / 32; 941 reg_idx = (hw->func_caps.vf_base_id + vf->vf_id) / 32;
942 bit_idx = (hw->func_caps.vf_base_id + vf->vf_id) % 32; 942 bit_idx = (hw->func_caps.vf_base_id + vf->vf_id) % 32;
943 wr32(hw, I40E_GLGEN_VFLRSTAT(reg_idx), BIT(bit_idx)); 943 wr32(hw, I40E_GLGEN_VFLRSTAT(reg_idx), BIT(bit_idx));
944 i40e_flush(hw);
944 945
945 if (i40e_quiesce_vf_pci(vf)) 946 if (i40e_quiesce_vf_pci(vf))
946 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n", 947 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n",
@@ -1361,8 +1362,16 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
1361 I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2; 1362 I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2;
1362 } 1363 }
1363 1364
1364 if (vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING) 1365 if (vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING) {
1366 if (pf->flags & I40E_FLAG_MFP_ENABLED) {
1367 dev_err(&pf->pdev->dev,
1368 "VF %d requested polling mode: this feature is supported only when the device is running in single function per port (SFP) mode\n",
1369 vf->vf_id);
1370 ret = I40E_ERR_PARAM;
1371 goto err;
1372 }
1365 vfres->vf_offload_flags |= I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING; 1373 vfres->vf_offload_flags |= I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING;
1374 }
1366 1375
1367 if (pf->flags & I40E_FLAG_WB_ON_ITR_CAPABLE) { 1376 if (pf->flags & I40E_FLAG_WB_ON_ITR_CAPABLE) {
1368 if (vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) 1377 if (vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_WB_ON_ITR)
@@ -2762,3 +2771,45 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable)
2762out: 2771out:
2763 return ret; 2772 return ret;
2764} 2773}
2774
2775/**
2776 * i40e_ndo_set_vf_trust
2777 * @netdev: network interface device structure of the pf
2778 * @vf_id: VF identifier
2779 * @setting: trust setting
2780 *
2781 * Enable or disable VF trust setting
2782 **/
2783int i40e_ndo_set_vf_trust(struct net_device *netdev, int vf_id, bool setting)
2784{
2785 struct i40e_netdev_priv *np = netdev_priv(netdev);
2786 struct i40e_pf *pf = np->vsi->back;
2787 struct i40e_vf *vf;
2788 int ret = 0;
2789
2790 /* validate the request */
2791 if (vf_id >= pf->num_alloc_vfs) {
2792 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id);
2793 return -EINVAL;
2794 }
2795
2796 if (pf->flags & I40E_FLAG_MFP_ENABLED) {
2797 dev_err(&pf->pdev->dev, "Trusted VF not supported in MFP mode.\n");
2798 return -EINVAL;
2799 }
2800
2801 vf = &pf->vf[vf_id];
2802
2803 if (!vf)
2804 return -EINVAL;
2805 if (setting == vf->trusted)
2806 goto out;
2807
2808 vf->trusted = setting;
2809 i40e_vc_notify_vf_reset(vf);
2810 i40e_reset_vf(vf, false);
2811 dev_info(&pf->pdev->dev, "VF %u is now %strusted\n",
2812 vf_id, setting ? "" : "un");
2813out:
2814 return ret;
2815}
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
index e7b2fba0309e..838cbd2299a4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
@@ -88,6 +88,7 @@ struct i40e_vf {
88 struct i40e_virtchnl_ether_addr default_fcoe_addr; 88 struct i40e_virtchnl_ether_addr default_fcoe_addr;
89 u16 port_vlan_id; 89 u16 port_vlan_id;
90 bool pf_set_mac; /* The VMM admin set the VF MAC address */ 90 bool pf_set_mac; /* The VMM admin set the VF MAC address */
91 bool trusted;
91 92
92 /* VSI indices - actual VSI pointers are maintained in the PF structure 93 /* VSI indices - actual VSI pointers are maintained in the PF structure
93 * When assigned, these will be non-zero, because VSI 0 is always 94 * When assigned, these will be non-zero, because VSI 0 is always
@@ -127,6 +128,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
127 int vf_id, u16 vlan_id, u8 qos); 128 int vf_id, u16 vlan_id, u8 qos);
128int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate, 129int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,
129 int max_tx_rate); 130 int max_tx_rate);
131int i40e_ndo_set_vf_trust(struct net_device *netdev, int vf_id, bool setting);
130int i40e_ndo_get_vf_config(struct net_device *netdev, 132int i40e_ndo_get_vf_config(struct net_device *netdev,
131 int vf_id, struct ifla_vf_info *ivi); 133 int vf_id, struct ifla_vf_info *ivi);
132int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link); 134int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link);
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq.h b/drivers/net/ethernet/intel/i40evf/i40e_adminq.h
index a3eae5d9a2bd..1f9b3b5d946d 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_adminq.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq.h
@@ -97,7 +97,6 @@ struct i40e_adminq_info {
97 u32 fw_build; /* firmware build number */ 97 u32 fw_build; /* firmware build number */
98 u16 api_maj_ver; /* api major version */ 98 u16 api_maj_ver; /* api major version */
99 u16 api_min_ver; /* api minor version */ 99 u16 api_min_ver; /* api minor version */
100 bool nvm_release_on_done;
101 100
102 struct mutex asq_mutex; /* Send queue lock */ 101 struct mutex asq_mutex; /* Send queue lock */
103 struct mutex arq_mutex; /* Receive queue lock */ 102 struct mutex arq_mutex; /* Receive queue lock */
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index 04aabc52ba0d..0c912a4999db 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -1160,7 +1160,9 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, const int budget)
1160 ? le16_to_cpu(rx_desc->wb.qword0.lo_dword.l2tag1) 1160 ? le16_to_cpu(rx_desc->wb.qword0.lo_dword.l2tag1)
1161 : 0; 1161 : 0;
1162#ifdef I40E_FCOE 1162#ifdef I40E_FCOE
1163 if (!i40e_fcoe_handle_offload(rx_ring, rx_desc, skb)) { 1163 if (unlikely(
1164 i40e_rx_is_fcoe(rx_ptype) &&
1165 !i40e_fcoe_handle_offload(rx_ring, rx_desc, skb))) {
1164 dev_kfree_skb_any(skb); 1166 dev_kfree_skb_any(skb);
1165 continue; 1167 continue;
1166 } 1168 }
@@ -1519,15 +1521,13 @@ out:
1519 1521
1520/** 1522/**
1521 * i40e_tso - set up the tso context descriptor 1523 * i40e_tso - set up the tso context descriptor
1522 * @tx_ring: ptr to the ring to send
1523 * @skb: ptr to the skb we're sending 1524 * @skb: ptr to the skb we're sending
1524 * @hdr_len: ptr to the size of the packet header 1525 * @hdr_len: ptr to the size of the packet header
1525 * @cd_type_cmd_tso_mss: Quad Word 1 1526 * @cd_type_cmd_tso_mss: Quad Word 1
1526 * 1527 *
1527 * Returns 0 if no TSO can happen, 1 if tso is going, or error 1528 * Returns 0 if no TSO can happen, 1 if tso is going, or error
1528 **/ 1529 **/
1529static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb, 1530static int i40e_tso(struct sk_buff *skb, u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
1530 u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
1531{ 1531{
1532 u64 cd_cmd, cd_tso_len, cd_mss; 1532 u64 cd_cmd, cd_tso_len, cd_mss;
1533 union { 1533 union {
@@ -1633,7 +1633,7 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
1633 unsigned char *hdr; 1633 unsigned char *hdr;
1634 } l4; 1634 } l4;
1635 unsigned char *exthdr; 1635 unsigned char *exthdr;
1636 u32 offset, cmd = 0, tunnel = 0; 1636 u32 offset, cmd = 0;
1637 __be16 frag_off; 1637 __be16 frag_off;
1638 u8 l4_proto = 0; 1638 u8 l4_proto = 0;
1639 1639
@@ -1647,6 +1647,7 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
1647 offset = ((ip.hdr - skb->data) / 2) << I40E_TX_DESC_LENGTH_MACLEN_SHIFT; 1647 offset = ((ip.hdr - skb->data) / 2) << I40E_TX_DESC_LENGTH_MACLEN_SHIFT;
1648 1648
1649 if (skb->encapsulation) { 1649 if (skb->encapsulation) {
1650 u32 tunnel = 0;
1650 /* define outer network header type */ 1651 /* define outer network header type */
1651 if (*tx_flags & I40E_TX_FLAGS_IPV4) { 1652 if (*tx_flags & I40E_TX_FLAGS_IPV4) {
1652 tunnel |= (*tx_flags & I40E_TX_FLAGS_TSO) ? 1653 tunnel |= (*tx_flags & I40E_TX_FLAGS_TSO) ?
@@ -2149,7 +2150,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
2149 else if (protocol == htons(ETH_P_IPV6)) 2150 else if (protocol == htons(ETH_P_IPV6))
2150 tx_flags |= I40E_TX_FLAGS_IPV6; 2151 tx_flags |= I40E_TX_FLAGS_IPV6;
2151 2152
2152 tso = i40e_tso(tx_ring, skb, &hdr_len, &cd_type_cmd_tso_mss); 2153 tso = i40e_tso(skb, &hdr_len, &cd_type_cmd_tso_mss);
2153 2154
2154 if (tso < 0) 2155 if (tso < 0)
2155 goto out_drop; 2156 goto out_drop;
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h
index 3ec0ea5ea3db..84c28aa64fdf 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h
@@ -430,4 +430,14 @@ static inline bool i40e_chk_linearize(struct sk_buff *skb, int count)
430 430
431 return __i40evf_chk_linearize(skb); 431 return __i40evf_chk_linearize(skb);
432} 432}
433
434/**
435 * i40e_rx_is_fcoe - returns true if the Rx packet type is FCoE
436 * @ptype: the packet type field from Rx descriptor write-back
437 **/
438static inline bool i40e_rx_is_fcoe(u16 ptype)
439{
440 return (ptype >= I40E_RX_PTYPE_L2_FCOE_PAY3) &&
441 (ptype <= I40E_RX_PTYPE_L2_FCOE_VFT_FCOTHER);
442}
433#endif /* _I40E_TXRX_H_ */ 443#endif /* _I40E_TXRX_H_ */
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h
index 301fe2b6dd03..4a78c18e0b7b 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h
@@ -522,6 +522,7 @@ struct i40e_hw {
522 enum i40e_nvmupd_state nvmupd_state; 522 enum i40e_nvmupd_state nvmupd_state;
523 struct i40e_aq_desc nvm_wb_desc; 523 struct i40e_aq_desc nvm_wb_desc;
524 struct i40e_virt_mem nvm_buff; 524 struct i40e_virt_mem nvm_buff;
525 bool nvm_release_on_done;
525 526
526 /* HMC info */ 527 /* HMC info */
527 struct i40e_hmc_info hmc; /* HMC info struct */ 528 struct i40e_hmc_info hmc; /* HMC info struct */
@@ -1329,4 +1330,46 @@ enum i40e_reset_type {
1329 1330
1330/* RSS Hash Table Size */ 1331/* RSS Hash Table Size */
1331#define I40E_PFQF_CTL_0_HASHLUTSIZE_512 0x00010000 1332#define I40E_PFQF_CTL_0_HASHLUTSIZE_512 0x00010000
1333
1334/* INPUT SET MASK for RSS, flow director and flexible payload */
1335#define I40E_FD_INSET_L3_SRC_SHIFT 47
1336#define I40E_FD_INSET_L3_SRC_WORD_MASK (0x3ULL << \
1337 I40E_FD_INSET_L3_SRC_SHIFT)
1338#define I40E_FD_INSET_L3_DST_SHIFT 35
1339#define I40E_FD_INSET_L3_DST_WORD_MASK (0x3ULL << \
1340 I40E_FD_INSET_L3_DST_SHIFT)
1341#define I40E_FD_INSET_L4_SRC_SHIFT 34
1342#define I40E_FD_INSET_L4_SRC_WORD_MASK (0x1ULL << \
1343 I40E_FD_INSET_L4_SRC_SHIFT)
1344#define I40E_FD_INSET_L4_DST_SHIFT 33
1345#define I40E_FD_INSET_L4_DST_WORD_MASK (0x1ULL << \
1346 I40E_FD_INSET_L4_DST_SHIFT)
1347#define I40E_FD_INSET_VERIFY_TAG_SHIFT 31
1348#define I40E_FD_INSET_VERIFY_TAG_WORD_MASK (0x3ULL << \
1349 I40E_FD_INSET_VERIFY_TAG_SHIFT)
1350
1351#define I40E_FD_INSET_FLEX_WORD50_SHIFT 17
1352#define I40E_FD_INSET_FLEX_WORD50_MASK (0x1ULL << \
1353 I40E_FD_INSET_FLEX_WORD50_SHIFT)
1354#define I40E_FD_INSET_FLEX_WORD51_SHIFT 16
1355#define I40E_FD_INSET_FLEX_WORD51_MASK (0x1ULL << \
1356 I40E_FD_INSET_FLEX_WORD51_SHIFT)
1357#define I40E_FD_INSET_FLEX_WORD52_SHIFT 15
1358#define I40E_FD_INSET_FLEX_WORD52_MASK (0x1ULL << \
1359 I40E_FD_INSET_FLEX_WORD52_SHIFT)
1360#define I40E_FD_INSET_FLEX_WORD53_SHIFT 14
1361#define I40E_FD_INSET_FLEX_WORD53_MASK (0x1ULL << \
1362 I40E_FD_INSET_FLEX_WORD53_SHIFT)
1363#define I40E_FD_INSET_FLEX_WORD54_SHIFT 13
1364#define I40E_FD_INSET_FLEX_WORD54_MASK (0x1ULL << \
1365 I40E_FD_INSET_FLEX_WORD54_SHIFT)
1366#define I40E_FD_INSET_FLEX_WORD55_SHIFT 12
1367#define I40E_FD_INSET_FLEX_WORD55_MASK (0x1ULL << \
1368 I40E_FD_INSET_FLEX_WORD55_SHIFT)
1369#define I40E_FD_INSET_FLEX_WORD56_SHIFT 11
1370#define I40E_FD_INSET_FLEX_WORD56_MASK (0x1ULL << \
1371 I40E_FD_INSET_FLEX_WORD56_SHIFT)
1372#define I40E_FD_INSET_FLEX_WORD57_SHIFT 10
1373#define I40E_FD_INSET_FLEX_WORD57_MASK (0x1ULL << \
1374 I40E_FD_INSET_FLEX_WORD57_SHIFT)
1332#endif /* _I40E_TYPE_H_ */ 1375#endif /* _I40E_TYPE_H_ */
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h b/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h
index 3b9d2037456c..f04ce6cb70dc 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h
@@ -80,7 +80,12 @@ enum i40e_virtchnl_ops {
80 I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE = 14, 80 I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE = 14,
81 I40E_VIRTCHNL_OP_GET_STATS = 15, 81 I40E_VIRTCHNL_OP_GET_STATS = 15,
82 I40E_VIRTCHNL_OP_FCOE = 16, 82 I40E_VIRTCHNL_OP_FCOE = 16,
83 I40E_VIRTCHNL_OP_EVENT = 17, 83 I40E_VIRTCHNL_OP_EVENT = 17, /* must ALWAYS be 17 */
84 I40E_VIRTCHNL_OP_CONFIG_RSS_KEY = 23,
85 I40E_VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
86 I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,
87 I40E_VIRTCHNL_OP_SET_RSS_HENA = 26,
88
84}; 89};
85 90
86/* Virtual channel message descriptor. This overlays the admin queue 91/* Virtual channel message descriptor. This overlays the admin queue
@@ -154,6 +159,7 @@ struct i40e_virtchnl_vsi_resource {
154#define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000 159#define I40E_VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000
155#define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000 160#define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
156#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000 161#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
162#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
157 163
158struct i40e_virtchnl_vf_resource { 164struct i40e_virtchnl_vf_resource {
159 u16 num_vsis; 165 u16 num_vsis;
@@ -162,8 +168,8 @@ struct i40e_virtchnl_vf_resource {
162 u16 max_mtu; 168 u16 max_mtu;
163 169
164 u32 vf_offload_flags; 170 u32 vf_offload_flags;
165 u32 max_fcoe_contexts; 171 u32 rss_key_size;
166 u32 max_fcoe_filters; 172 u32 rss_lut_size;
167 173
168 struct i40e_virtchnl_vsi_resource vsi_res[1]; 174 struct i40e_virtchnl_vsi_resource vsi_res[1];
169}; 175};
@@ -322,6 +328,39 @@ struct i40e_virtchnl_promisc_info {
322 * PF replies with struct i40e_eth_stats in an external buffer. 328 * PF replies with struct i40e_eth_stats in an external buffer.
323 */ 329 */
324 330
331/* I40E_VIRTCHNL_OP_CONFIG_RSS_KEY
332 * I40E_VIRTCHNL_OP_CONFIG_RSS_LUT
333 * VF sends these messages to configure RSS. Only supported if both PF
334 * and VF drivers set the I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF bit during
335 * configuration negotiation. If this is the case, then the RSS fields in
336 * the VF resource struct are valid.
337 * Both the key and LUT are initialized to 0 by the PF, meaning that
338 * RSS is effectively disabled until set up by the VF.
339 */
340struct i40e_virtchnl_rss_key {
341 u16 vsi_id;
342 u16 key_len;
343 u8 key[1]; /* RSS hash key, packed bytes */
344};
345
346struct i40e_virtchnl_rss_lut {
347 u16 vsi_id;
348 u16 lut_entries;
349 u8 lut[1]; /* RSS lookup table*/
350};
351
352/* I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS
353 * I40E_VIRTCHNL_OP_SET_RSS_HENA
354 * VF sends these messages to get and set the hash filter enable bits for RSS.
355 * By default, the PF sets these to all possible traffic types that the
356 * hardware supports. The VF can query this value if it wants to change the
357 * traffic types that are hashed by the hardware.
358 * Traffic types are defined in the i40e_filter_pctype enum in i40e_type.h
359 */
360struct i40e_virtchnl_rss_hena {
361 u64 hena;
362};
363
325/* I40E_VIRTCHNL_OP_EVENT 364/* I40E_VIRTCHNL_OP_EVENT
326 * PF sends this message to inform the VF driver of events that may affect it. 365 * PF sends this message to inform the VF driver of events that may affect it.
327 * No direct response is expected from the VF, though it may generate other 366 * No direct response is expected from the VF, though it may generate other
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index f4dada02bbcf..9110319a8f00 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -38,7 +38,7 @@ static const char i40evf_driver_string[] =
38 38
39#define DRV_VERSION_MAJOR 1 39#define DRV_VERSION_MAJOR 1
40#define DRV_VERSION_MINOR 5 40#define DRV_VERSION_MINOR 5
41#define DRV_VERSION_BUILD 2 41#define DRV_VERSION_BUILD 5
42#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ 42#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
43 __stringify(DRV_VERSION_MINOR) "." \ 43 __stringify(DRV_VERSION_MINOR) "." \
44 __stringify(DRV_VERSION_BUILD) \ 44 __stringify(DRV_VERSION_BUILD) \
@@ -2323,29 +2323,20 @@ static int i40evf_check_reset_complete(struct i40e_hw *hw)
2323 **/ 2323 **/
2324int i40evf_process_config(struct i40evf_adapter *adapter) 2324int i40evf_process_config(struct i40evf_adapter *adapter)
2325{ 2325{
2326 struct i40e_virtchnl_vf_resource *vfres = adapter->vf_res;
2326 struct net_device *netdev = adapter->netdev; 2327 struct net_device *netdev = adapter->netdev;
2327 int i; 2328 int i;
2328 2329
2329 /* got VF config message back from PF, now we can parse it */ 2330 /* got VF config message back from PF, now we can parse it */
2330 for (i = 0; i < adapter->vf_res->num_vsis; i++) { 2331 for (i = 0; i < vfres->num_vsis; i++) {
2331 if (adapter->vf_res->vsi_res[i].vsi_type == I40E_VSI_SRIOV) 2332 if (vfres->vsi_res[i].vsi_type == I40E_VSI_SRIOV)
2332 adapter->vsi_res = &adapter->vf_res->vsi_res[i]; 2333 adapter->vsi_res = &vfres->vsi_res[i];
2333 } 2334 }
2334 if (!adapter->vsi_res) { 2335 if (!adapter->vsi_res) {
2335 dev_err(&adapter->pdev->dev, "No LAN VSI found\n"); 2336 dev_err(&adapter->pdev->dev, "No LAN VSI found\n");
2336 return -ENODEV; 2337 return -ENODEV;
2337 } 2338 }
2338 2339
2339 if (adapter->vf_res->vf_offload_flags
2340 & I40E_VIRTCHNL_VF_OFFLOAD_VLAN) {
2341 netdev->vlan_features = netdev->features &
2342 ~(NETIF_F_HW_VLAN_CTAG_TX |
2343 NETIF_F_HW_VLAN_CTAG_RX |
2344 NETIF_F_HW_VLAN_CTAG_FILTER);
2345 netdev->features |= NETIF_F_HW_VLAN_CTAG_TX |
2346 NETIF_F_HW_VLAN_CTAG_RX |
2347 NETIF_F_HW_VLAN_CTAG_FILTER;
2348 }
2349 netdev->features |= NETIF_F_HIGHDMA | 2340 netdev->features |= NETIF_F_HIGHDMA |
2350 NETIF_F_SG | 2341 NETIF_F_SG |
2351 NETIF_F_IP_CSUM | 2342 NETIF_F_IP_CSUM |
@@ -2354,7 +2345,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
2354 NETIF_F_TSO | 2345 NETIF_F_TSO |
2355 NETIF_F_TSO6 | 2346 NETIF_F_TSO6 |
2356 NETIF_F_TSO_ECN | 2347 NETIF_F_TSO_ECN |
2357 NETIF_F_GSO_GRE | 2348 NETIF_F_GSO_GRE |
2358 NETIF_F_GSO_UDP_TUNNEL | 2349 NETIF_F_GSO_UDP_TUNNEL |
2359 NETIF_F_RXCSUM | 2350 NETIF_F_RXCSUM |
2360 NETIF_F_GRO; 2351 NETIF_F_GRO;
@@ -2371,9 +2362,15 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
2371 if (adapter->flags & I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE) 2362 if (adapter->flags & I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE)
2372 netdev->features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; 2363 netdev->features |= NETIF_F_GSO_UDP_TUNNEL_CSUM;
2373 2364
2365 /* always clear VLAN features because they can change at every reset */
2366 netdev->features &= ~(I40EVF_VLAN_FEATURES);
2374 /* copy netdev features into list of user selectable features */ 2367 /* copy netdev features into list of user selectable features */
2375 netdev->hw_features |= netdev->features; 2368 netdev->hw_features |= netdev->features;
2376 netdev->hw_features &= ~NETIF_F_RXCSUM; 2369
2370 if (vfres->vf_offload_flags & I40E_VIRTCHNL_VF_OFFLOAD_VLAN) {
2371 netdev->vlan_features = netdev->features;
2372 netdev->features |= I40EVF_VLAN_FEATURES;
2373 }
2377 2374
2378 adapter->vsi.id = adapter->vsi_res->vsi_id; 2375 adapter->vsi.id = adapter->vsi_res->vsi_id;
2379 2376