Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2015-03-07

This series contains updates to i40e and i40evf only.

Most notably, Greg provides the patch to remove the dreaded configfs
changes in the driver.

Shannon cleans up a sparse warning by simply straighting out the code
so it is less convoluted. Fixes an issue where the vector allocation
was trying too hard to save vectors for VMDq, to the point of not giving
the PF enough when in a tight situation, such as an NPAR partition.
Changed the driver to make sure that the PF will get all the queues and
vectors it wants to fill out its destiny. Cleans up reporting to only
print the port and VEB stats if it is the first partition of a
multiplexed port.

Catherine cleans up some duplicated code by simply removing the duplicate
code.

Kamil cleans up the driver by removing an un-needed endian conversion
because it is already done by a register read function.

Jesse fixes a variable width of a datatype, where a u16 should have been
a u32. Also cleans up debug_read_register() to resolve some sparse
warnings. Updates the driver to use prefetch() to get the next Tx
descriptor, like in ixgbe, to improve performance.

Akeem moves around code to enable/disable loopback so that other non-SRIOV
supported driver functions can take advantage of the changes.

Anjali cleans up the logging for adding/deleting FD-SB filters, since
ethtool shows all the filters on an interface. Updates the driver to
use l4_tunnel type generically to keep code flow simple. Simplifies
the RSS code since the driver initializes the rss_size_max in sw_init.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+283 -569
-9
drivers/net/ethernet/intel/Kconfig
··· 303 303 304 304 If unsure, say N. 305 305 306 - config I40E_CONFIGFS_FS 307 - bool "Config File System Support (configfs)" 308 - default n 309 - depends on I40E && CONFIGFS_FS && !(I40E=y && CONFIGFS_FS=m) 310 - ---help--- 311 - Provides support for the configfs file system for additional 312 - driver configuration. Say Y here if you want to use the 313 - configuration file system in the driver. 314 - 315 306 config I40EVF 316 307 tristate "Intel(R) XL710 X710 Virtual Function Ethernet support" 317 308 depends on PCI_MSI
-1
drivers/net/ethernet/intel/i40e/Makefile
··· 37 37 i40e_hmc.o \ 38 38 i40e_lan_hmc.o \ 39 39 i40e_nvm.o \ 40 - i40e_configfs.o \ 41 40 i40e_debugfs.o \ 42 41 i40e_diag.o \ 43 42 i40e_txrx.o \
+6 -8
drivers/net/ethernet/intel/i40e/i40e.h
··· 175 175 #define I40E_FDIR_MAX_RAW_PACKET_SIZE 512 176 176 #define I40E_FDIR_BUFFER_FULL_MARGIN 10 177 177 #define I40E_FDIR_BUFFER_HEAD_ROOM 32 178 + #define I40E_FDIR_BUFFER_HEAD_ROOM_FOR_ATR (I40E_FDIR_BUFFER_HEAD_ROOM * 4) 178 179 179 180 enum i40e_fd_stat_idx { 180 181 I40E_FD_STAT_ATR, ··· 277 276 enum i40e_interrupt_policy int_policy; 278 277 u16 rx_itr_default; 279 278 u16 tx_itr_default; 280 - u16 msg_enable; 279 + u32 msg_enable; 281 280 char int_name[I40E_INT_NAME_STR_LEN]; 282 281 u16 adminq_work_limit; /* num of admin receive queue desc to process */ 283 282 unsigned long service_timer_period; ··· 637 636 int i40e_add_del_fdir(struct i40e_vsi *vsi, 638 637 struct i40e_fdir_filter *input, bool add); 639 638 void i40e_fdir_check_and_reenable(struct i40e_pf *pf); 640 - int i40e_get_current_fd_count(struct i40e_pf *pf); 641 - int i40e_get_cur_guaranteed_fd_count(struct i40e_pf *pf); 642 - int i40e_get_current_atr_cnt(struct i40e_pf *pf); 639 + u32 i40e_get_current_fd_count(struct i40e_pf *pf); 640 + u32 i40e_get_cur_guaranteed_fd_count(struct i40e_pf *pf); 641 + u32 i40e_get_current_atr_cnt(struct i40e_pf *pf); 642 + u32 i40e_get_global_fd_count(struct i40e_pf *pf); 643 643 bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features); 644 644 void i40e_set_ethtool_ops(struct net_device *netdev); 645 645 struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi, ··· 749 747 void i40e_ptp_init(struct i40e_pf *pf); 750 748 void i40e_ptp_stop(struct i40e_pf *pf); 751 749 int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi); 752 - #if IS_ENABLED(CONFIG_I40E_CONFIGFS_FS) 753 - int i40e_configfs_init(void); 754 - void i40e_configfs_exit(void); 755 - #endif /* CONFIG_I40E_CONFIGFS_FS */ 756 750 i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf); 757 751 i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf); 758 752 i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf);
+29 -31
drivers/net/ethernet/intel/i40e/i40e_common.c
··· 85 85 { 86 86 struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; 87 87 u16 len = le16_to_cpu(aq_desc->datalen); 88 - u8 *aq_buffer = (u8 *)buffer; 89 - u32 data[4]; 90 - u32 i = 0; 88 + u8 *buf = (u8 *)buffer; 89 + u16 i = 0; 91 90 92 91 if ((!(mask & hw->debug_mask)) || (desc == NULL)) 93 92 return; ··· 108 109 le32_to_cpu(aq_desc->params.external.addr_low)); 109 110 110 111 if ((buffer != NULL) && (aq_desc->datalen != 0)) { 111 - memset(data, 0, sizeof(data)); 112 112 i40e_debug(hw, mask, "AQ CMD Buffer:\n"); 113 113 if (buf_len < len) 114 114 len = buf_len; 115 - for (i = 0; i < len; i++) { 116 - data[((i % 16) / 4)] |= 117 - ((u32)aq_buffer[i]) << (8 * (i % 4)); 118 - if ((i % 16) == 15) { 119 - i40e_debug(hw, mask, 120 - "\t0x%04X %08X %08X %08X %08X\n", 121 - i - 15, le32_to_cpu(data[0]), 122 - le32_to_cpu(data[1]), 123 - le32_to_cpu(data[2]), 124 - le32_to_cpu(data[3])); 125 - memset(data, 0, sizeof(data)); 126 - } 115 + /* write the full 16-byte chunks */ 116 + for (i = 0; i < (len - 16); i += 16) 117 + i40e_debug(hw, mask, 118 + "\t0x%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", 119 + i, buf[i], buf[i + 1], buf[i + 2], 120 + buf[i + 3], buf[i + 4], buf[i + 5], 121 + buf[i + 6], buf[i + 7], buf[i + 8], 122 + buf[i + 9], buf[i + 10], buf[i + 11], 123 + buf[i + 12], buf[i + 13], buf[i + 14], 124 + buf[i + 15]); 125 + /* write whatever's left over without overrunning the buffer */ 126 + if (i < len) { 127 + char d_buf[80]; 128 + int j = 0; 129 + 130 + memset(d_buf, 0, sizeof(d_buf)); 131 + j += sprintf(d_buf, "\t0x%04X ", i); 132 + while (i < len) 133 + j += sprintf(&d_buf[j], " %02X", buf[i++]); 134 + i40e_debug(hw, mask, "%s\n", d_buf); 127 135 } 128 - if ((i % 16) != 0) 129 - i40e_debug(hw, mask, "\t0x%04X %08X %08X %08X %08X\n", 130 - i - (i % 16), le32_to_cpu(data[0]), 131 - le32_to_cpu(data[1]), 132 - le32_to_cpu(data[2]), 133 - le32_to_cpu(data[3])); 134 136 } 135 137 } 136 138 ··· 2126 2126 * Read the register using the admin queue commands 2127 2127 **/ 2128 2128 i40e_status i40e_aq_debug_read_register(struct i40e_hw *hw, 2129 - u32 reg_addr, u64 *reg_val, 2129 + u32 reg_addr, u64 *reg_val, 2130 2130 struct i40e_asq_cmd_details *cmd_details) 2131 2131 { 2132 2132 struct i40e_aq_desc desc; ··· 2137 2137 if (reg_val == NULL) 2138 2138 return I40E_ERR_PARAM; 2139 2139 2140 - i40e_fill_default_direct_cmd_desc(&desc, 2141 - i40e_aqc_opc_debug_read_reg); 2140 + i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_debug_read_reg); 2142 2141 2143 2142 cmd_resp->address = cpu_to_le32(reg_addr); 2144 2143 2145 2144 status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); 2146 2145 2147 2146 if (!status) { 2148 - *reg_val = ((u64)cmd_resp->value_high << 32) | 2149 - (u64)cmd_resp->value_low; 2150 - *reg_val = le64_to_cpu(*reg_val); 2147 + *reg_val = ((u64)le32_to_cpu(cmd_resp->value_high) << 32) | 2148 + (u64)le32_to_cpu(cmd_resp->value_low); 2151 2149 } 2152 2150 2153 2151 return status; ··· 3407 3409 * is not passed then only register at 'reg_addr0' is read. 3408 3410 * 3409 3411 **/ 3410 - i40e_status i40e_aq_alternate_read(struct i40e_hw *hw, 3411 - u32 reg_addr0, u32 *reg_val0, 3412 - u32 reg_addr1, u32 *reg_val1) 3412 + static i40e_status i40e_aq_alternate_read(struct i40e_hw *hw, 3413 + u32 reg_addr0, u32 *reg_val0, 3414 + u32 reg_addr1, u32 *reg_val1) 3413 3415 { 3414 3416 struct i40e_aq_desc desc; 3415 3417 struct i40e_aqc_alternate_write *cmd_resp =
-354
drivers/net/ethernet/intel/i40e/i40e_configfs.c
··· 1 - /******************************************************************************* 2 - * 3 - * Intel Ethernet Controller XL710 Family Linux Driver 4 - * Copyright(c) 2013 - 2015 Intel Corporation. 5 - * 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, 8 - * version 2, as published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope it will be useful, but WITHOUT 11 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 - * more details. 14 - * 15 - * You should have received a copy of the GNU General Public License along 16 - * with this program. If not, see <http://www.gnu.org/licenses/>. 17 - * 18 - * The full GNU General Public License is included in this distribution in 19 - * the file called "COPYING". 20 - * 21 - * Contact Information: 22 - * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> 23 - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 24 - * 25 - ******************************************************************************/ 26 - 27 - #include <linux/configfs.h> 28 - #include "i40e.h" 29 - 30 - #if IS_ENABLED(CONFIG_I40E_CONFIGFS_FS) 31 - 32 - /** 33 - * configfs structure for i40e 34 - * 35 - * This file adds code for configfs support for the i40e driver. This sets 36 - * up a filesystem under /sys/kernel/config in which configuration changes 37 - * can be made for the driver's netdevs. 38 - * 39 - * The initialization in this code creates the "i40e" entry in the configfs 40 - * system. After that, the user needs to use mkdir to create configurations 41 - * for specific netdev ports; for example "mkdir eth3". This code will verify 42 - * that such a netdev exists and that it is owned by i40e. 43 - * 44 - **/ 45 - 46 - struct i40e_cfgfs_vsi { 47 - struct config_item item; 48 - struct i40e_vsi *vsi; 49 - }; 50 - 51 - static inline struct i40e_cfgfs_vsi *to_i40e_cfgfs_vsi(struct config_item *item) 52 - { 53 - return item ? container_of(item, struct i40e_cfgfs_vsi, item) : NULL; 54 - } 55 - 56 - static struct configfs_attribute i40e_cfgfs_vsi_attr_min_bw = { 57 - .ca_owner = THIS_MODULE, 58 - .ca_name = "min_bw", 59 - .ca_mode = S_IRUGO | S_IWUSR, 60 - }; 61 - 62 - static struct configfs_attribute i40e_cfgfs_vsi_attr_max_bw = { 63 - .ca_owner = THIS_MODULE, 64 - .ca_name = "max_bw", 65 - .ca_mode = S_IRUGO | S_IWUSR, 66 - }; 67 - 68 - static struct configfs_attribute i40e_cfgfs_vsi_attr_commit = { 69 - .ca_owner = THIS_MODULE, 70 - .ca_name = "commit", 71 - .ca_mode = S_IRUGO | S_IWUSR, 72 - }; 73 - 74 - static struct configfs_attribute i40e_cfgfs_vsi_attr_port_count = { 75 - .ca_owner = THIS_MODULE, 76 - .ca_name = "ports", 77 - .ca_mode = S_IRUGO | S_IWUSR, 78 - }; 79 - 80 - static struct configfs_attribute i40e_cfgfs_vsi_attr_part_count = { 81 - .ca_owner = THIS_MODULE, 82 - .ca_name = "partitions", 83 - .ca_mode = S_IRUGO | S_IWUSR, 84 - }; 85 - 86 - static struct configfs_attribute *i40e_cfgfs_vsi_attrs[] = { 87 - &i40e_cfgfs_vsi_attr_min_bw, 88 - &i40e_cfgfs_vsi_attr_max_bw, 89 - &i40e_cfgfs_vsi_attr_commit, 90 - &i40e_cfgfs_vsi_attr_port_count, 91 - &i40e_cfgfs_vsi_attr_part_count, 92 - NULL, 93 - }; 94 - 95 - /** 96 - * i40e_cfgfs_vsi_attr_show - Show a VSI's NPAR BW partition info 97 - * @item: A pointer back to the configfs item created on driver load 98 - * @attr: A pointer to this item's configuration attribute 99 - * @page: A pointer to the output buffer 100 - **/ 101 - static ssize_t i40e_cfgfs_vsi_attr_show(struct config_item *item, 102 - struct configfs_attribute *attr, 103 - char *page) 104 - { 105 - struct i40e_cfgfs_vsi *i40e_cfgfs_vsi = to_i40e_cfgfs_vsi(item); 106 - struct i40e_pf *pf = i40e_cfgfs_vsi->vsi->back; 107 - ssize_t count; 108 - 109 - if (i40e_cfgfs_vsi->vsi != pf->vsi[pf->lan_vsi]) 110 - return 0; 111 - 112 - if (strncmp(attr->ca_name, "min_bw", 6) == 0) 113 - count = sprintf(page, "%s %s %d%%\n", 114 - i40e_cfgfs_vsi->vsi->netdev->name, 115 - (pf->npar_min_bw & I40E_ALT_BW_RELATIVE_MASK) ? 116 - "Relative Min BW" : "Absolute Min BW", 117 - pf->npar_min_bw & I40E_ALT_BW_VALUE_MASK); 118 - else if (strncmp(attr->ca_name, "max_bw", 6) == 0) 119 - count = sprintf(page, "%s %s %d%%\n", 120 - i40e_cfgfs_vsi->vsi->netdev->name, 121 - (pf->npar_max_bw & I40E_ALT_BW_RELATIVE_MASK) ? 122 - "Relative Max BW" : "Absolute Max BW", 123 - pf->npar_max_bw & I40E_ALT_BW_VALUE_MASK); 124 - else if (strncmp(attr->ca_name, "ports", 5) == 0) 125 - count = sprintf(page, "%d\n", 126 - pf->hw.num_ports); 127 - else if (strncmp(attr->ca_name, "partitions", 10) == 0) 128 - count = sprintf(page, "%d\n", 129 - pf->hw.num_partitions); 130 - else 131 - return 0; 132 - 133 - return count; 134 - } 135 - 136 - /** 137 - * i40e_cfgfs_vsi_attr_store - Show a VSI's NPAR BW partition info 138 - * @item: A pointer back to the configfs item created on driver load 139 - * @attr: A pointer to this item's configuration attribute 140 - * @page: A pointer to the user input buffer holding the user input values 141 - **/ 142 - static ssize_t i40e_cfgfs_vsi_attr_store(struct config_item *item, 143 - struct configfs_attribute *attr, 144 - const char *page, size_t count) 145 - { 146 - struct i40e_cfgfs_vsi *i40e_cfgfs_vsi = to_i40e_cfgfs_vsi(item); 147 - struct i40e_pf *pf = i40e_cfgfs_vsi->vsi->back; 148 - char *p = (char *)page; 149 - int rc; 150 - unsigned long tmp; 151 - 152 - if (i40e_cfgfs_vsi->vsi != pf->vsi[pf->lan_vsi]) 153 - return 0; 154 - 155 - if (!p || (*p && (*p == '\n'))) 156 - return -EINVAL; 157 - 158 - rc = kstrtoul(p, 10, &tmp); 159 - if (rc) 160 - return rc; 161 - if (tmp > 100) 162 - return -ERANGE; 163 - 164 - if (strncmp(attr->ca_name, "min_bw", 6) == 0) { 165 - if (tmp > (pf->npar_max_bw & I40E_ALT_BW_VALUE_MASK)) 166 - return -ERANGE; 167 - /* Preserve the valid and relative BW bits - the rest is 168 - * don't care. 169 - */ 170 - pf->npar_min_bw &= (I40E_ALT_BW_RELATIVE_MASK | 171 - I40E_ALT_BW_VALID_MASK); 172 - pf->npar_min_bw |= (tmp & I40E_ALT_BW_VALUE_MASK); 173 - i40e_set_npar_bw_setting(pf); 174 - } else if (strncmp(attr->ca_name, "max_bw", 6) == 0) { 175 - if (tmp < 1 || 176 - tmp < (pf->npar_min_bw & I40E_ALT_BW_VALUE_MASK)) 177 - return -ERANGE; 178 - /* Preserve the valid and relative BW bits - the rest is 179 - * don't care. 180 - */ 181 - pf->npar_max_bw &= (I40E_ALT_BW_RELATIVE_MASK | 182 - I40E_ALT_BW_VALID_MASK); 183 - pf->npar_max_bw |= (tmp & I40E_ALT_BW_VALUE_MASK); 184 - i40e_set_npar_bw_setting(pf); 185 - } else if (strncmp(attr->ca_name, "commit", 6) == 0 && tmp == 1) { 186 - if (i40e_commit_npar_bw_setting(pf)) 187 - return -EIO; 188 - } 189 - 190 - return count; 191 - } 192 - 193 - /** 194 - * i40e_cfgfs_vsi_release - Free up the configuration item memory 195 - * @item: A pointer back to the configfs item created on driver load 196 - **/ 197 - static void i40e_cfgfs_vsi_release(struct config_item *item) 198 - { 199 - kfree(to_i40e_cfgfs_vsi(item)); 200 - } 201 - 202 - static struct configfs_item_operations i40e_cfgfs_vsi_item_ops = { 203 - .release = i40e_cfgfs_vsi_release, 204 - .show_attribute = i40e_cfgfs_vsi_attr_show, 205 - .store_attribute = i40e_cfgfs_vsi_attr_store, 206 - }; 207 - 208 - static struct config_item_type i40e_cfgfs_vsi_type = { 209 - .ct_item_ops = &i40e_cfgfs_vsi_item_ops, 210 - .ct_attrs = i40e_cfgfs_vsi_attrs, 211 - .ct_owner = THIS_MODULE, 212 - }; 213 - 214 - struct i40e_cfgfs_group { 215 - struct config_group group; 216 - }; 217 - 218 - /** 219 - * to_i40e_cfgfs_group - Get the group pointer from the config item 220 - * @item: A pointer back to the configfs item created on driver load 221 - **/ 222 - static inline struct i40e_cfgfs_group * 223 - to_i40e_cfgfs_group(struct config_item *item) 224 - { 225 - return item ? container_of(to_config_group(item), 226 - struct i40e_cfgfs_group, group) : NULL; 227 - } 228 - 229 - /** 230 - * i40e_cfgfs_group_make_item - Create the configfs item with group container 231 - * @group: A pointer to our configfs group 232 - * @name: A pointer to the nume of the device we're looking for 233 - **/ 234 - static struct config_item * 235 - i40e_cfgfs_group_make_item(struct config_group *group, const char *name) 236 - { 237 - struct i40e_cfgfs_vsi *i40e_cfgfs_vsi; 238 - struct net_device *netdev; 239 - struct i40e_netdev_priv *np; 240 - 241 - read_lock(&dev_base_lock); 242 - netdev = first_net_device(&init_net); 243 - while (netdev) { 244 - if (strncmp(netdev->name, name, sizeof(netdev->name)) == 0) 245 - break; 246 - netdev = next_net_device(netdev); 247 - } 248 - read_unlock(&dev_base_lock); 249 - 250 - if (!netdev) 251 - return ERR_PTR(-ENODEV); 252 - 253 - /* is this netdev owned by i40e? */ 254 - if (netdev->netdev_ops->ndo_open != i40e_open) 255 - return ERR_PTR(-EACCES); 256 - 257 - i40e_cfgfs_vsi = kzalloc(sizeof(*i40e_cfgfs_vsi), GFP_KERNEL); 258 - if (!i40e_cfgfs_vsi) 259 - return ERR_PTR(-ENOMEM); 260 - 261 - np = netdev_priv(netdev); 262 - i40e_cfgfs_vsi->vsi = np->vsi; 263 - config_item_init_type_name(&i40e_cfgfs_vsi->item, name, 264 - &i40e_cfgfs_vsi_type); 265 - 266 - return &i40e_cfgfs_vsi->item; 267 - } 268 - 269 - static struct configfs_attribute i40e_cfgfs_group_attr_description = { 270 - .ca_owner = THIS_MODULE, 271 - .ca_name = "description", 272 - .ca_mode = S_IRUGO, 273 - }; 274 - 275 - static struct configfs_attribute *i40e_cfgfs_group_attrs[] = { 276 - &i40e_cfgfs_group_attr_description, 277 - NULL, 278 - }; 279 - 280 - static ssize_t i40e_cfgfs_group_attr_show(struct config_item *item, 281 - struct configfs_attribute *attr, 282 - char *page) 283 - { 284 - return sprintf(page, 285 - "i40e\n" 286 - "\n" 287 - "This subsystem allows the modification of network port configurations.\n" 288 - "To start, use the name of the network port to be configured in a 'mkdir'\n" 289 - "command, e.g. 'mkdir eth3'.\n"); 290 - } 291 - 292 - static void i40e_cfgfs_group_release(struct config_item *item) 293 - { 294 - kfree(to_i40e_cfgfs_group(item)); 295 - } 296 - 297 - static struct configfs_item_operations i40e_cfgfs_group_item_ops = { 298 - .release = i40e_cfgfs_group_release, 299 - .show_attribute = i40e_cfgfs_group_attr_show, 300 - }; 301 - 302 - /* Note that, since no extra work is required on ->drop_item(), 303 - * no ->drop_item() is provided. 304 - */ 305 - static struct configfs_group_operations i40e_cfgfs_group_ops = { 306 - .make_item = i40e_cfgfs_group_make_item, 307 - }; 308 - 309 - static struct config_item_type i40e_cfgfs_group_type = { 310 - .ct_item_ops = &i40e_cfgfs_group_item_ops, 311 - .ct_group_ops = &i40e_cfgfs_group_ops, 312 - .ct_attrs = i40e_cfgfs_group_attrs, 313 - .ct_owner = THIS_MODULE, 314 - }; 315 - 316 - static struct configfs_subsystem i40e_cfgfs_group_subsys = { 317 - .su_group = { 318 - .cg_item = { 319 - .ci_namebuf = "i40e", 320 - .ci_type = &i40e_cfgfs_group_type, 321 - }, 322 - }, 323 - }; 324 - 325 - /** 326 - * i40e_configfs_init - Initialize configfs support for our driver 327 - **/ 328 - int i40e_configfs_init(void) 329 - { 330 - int ret; 331 - struct configfs_subsystem *subsys; 332 - 333 - subsys = &i40e_cfgfs_group_subsys; 334 - 335 - config_group_init(&subsys->su_group); 336 - mutex_init(&subsys->su_mutex); 337 - ret = configfs_register_subsystem(subsys); 338 - if (ret) { 339 - pr_err("Error %d while registering configfs subsystem %s\n", 340 - ret, subsys->su_group.cg_item.ci_namebuf); 341 - return ret; 342 - } 343 - 344 - return 0; 345 - } 346 - 347 - /** 348 - * i40e_configfs_init - Bail out - unregister configfs subsystem and release 349 - **/ 350 - void i40e_configfs_exit(void) 351 - { 352 - configfs_unregister_subsystem(&i40e_cfgfs_group_subsys); 353 - } 354 - #endif /* IS_ENABLED(CONFIG_I40E_CONFIGFS_FS) */
+3 -3
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
··· 1224 1224 case ETH_SS_TEST: 1225 1225 return I40E_TEST_LEN; 1226 1226 case ETH_SS_STATS: 1227 - if (vsi == pf->vsi[pf->lan_vsi]) { 1227 + if (vsi == pf->vsi[pf->lan_vsi] && pf->hw.partition_id == 1) { 1228 1228 int len = I40E_PF_STATS_LEN(netdev); 1229 1229 1230 1230 if (pf->lan_veb != I40E_NO_VEB) ··· 1297 1297 i += 2; 1298 1298 } 1299 1299 rcu_read_unlock(); 1300 - if (vsi != pf->vsi[pf->lan_vsi]) 1300 + if (vsi != pf->vsi[pf->lan_vsi] || pf->hw.partition_id != 1) 1301 1301 return; 1302 1302 1303 1303 if (pf->lan_veb != I40E_NO_VEB) { ··· 1370 1370 snprintf(p, ETH_GSTRING_LEN, "rx-%u.rx_bytes", i); 1371 1371 p += ETH_GSTRING_LEN; 1372 1372 } 1373 - if (vsi != pf->vsi[pf->lan_vsi]) 1373 + if (vsi != pf->vsi[pf->lan_vsi] || pf->hw.partition_id != 1) 1374 1374 return; 1375 1375 1376 1376 if (pf->lan_veb != I40E_NO_VEB) {
+170 -55
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 39 39 40 40 #define DRV_VERSION_MAJOR 1 41 41 #define DRV_VERSION_MINOR 2 42 - #define DRV_VERSION_BUILD 11 42 + #define DRV_VERSION_BUILD 12 43 43 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ 44 44 __stringify(DRV_VERSION_MINOR) "." \ 45 45 __stringify(DRV_VERSION_BUILD) DRV_KERN ··· 1541 1541 vsi->tc_config.tc_info[i].qoffset = offset; 1542 1542 vsi->tc_config.tc_info[i].qcount = qcount; 1543 1543 1544 - /* find the power-of-2 of the number of queue pairs */ 1544 + /* find the next higher power-of-2 of num queue pairs */ 1545 1545 num_qps = qcount; 1546 1546 pow = 0; 1547 1547 while (num_qps && ((1 << pow) < qcount)) { ··· 5345 5345 * i40e_get_cur_guaranteed_fd_count - Get the consumed guaranteed FD filters 5346 5346 * @pf: board private structure 5347 5347 **/ 5348 - int i40e_get_cur_guaranteed_fd_count(struct i40e_pf *pf) 5348 + u32 i40e_get_cur_guaranteed_fd_count(struct i40e_pf *pf) 5349 5349 { 5350 - int val, fcnt_prog; 5350 + u32 val, fcnt_prog; 5351 5351 5352 5352 val = rd32(&pf->hw, I40E_PFQF_FDSTAT); 5353 5353 fcnt_prog = (val & I40E_PFQF_FDSTAT_GUARANT_CNT_MASK); ··· 5355 5355 } 5356 5356 5357 5357 /** 5358 - * i40e_get_current_fd_count - Get the count of total FD filters programmed 5358 + * i40e_get_current_fd_count - Get total FD filters programmed for this PF 5359 5359 * @pf: board private structure 5360 5360 **/ 5361 - int i40e_get_current_fd_count(struct i40e_pf *pf) 5361 + u32 i40e_get_current_fd_count(struct i40e_pf *pf) 5362 5362 { 5363 - int val, fcnt_prog; 5363 + u32 val, fcnt_prog; 5364 + 5364 5365 val = rd32(&pf->hw, I40E_PFQF_FDSTAT); 5365 5366 fcnt_prog = (val & I40E_PFQF_FDSTAT_GUARANT_CNT_MASK) + 5366 5367 ((val & I40E_PFQF_FDSTAT_BEST_CNT_MASK) >> 5367 5368 I40E_PFQF_FDSTAT_BEST_CNT_SHIFT); 5369 + return fcnt_prog; 5370 + } 5371 + 5372 + /** 5373 + * i40e_get_global_fd_count - Get total FD filters programmed on device 5374 + * @pf: board private structure 5375 + **/ 5376 + u32 i40e_get_global_fd_count(struct i40e_pf *pf) 5377 + { 5378 + u32 val, fcnt_prog; 5379 + 5380 + val = rd32(&pf->hw, I40E_GLQF_FDCNT_0); 5381 + fcnt_prog = (val & I40E_GLQF_FDCNT_0_GUARANT_CNT_MASK) + 5382 + ((val & I40E_GLQF_FDCNT_0_BESTCNT_MASK) >> 5383 + I40E_GLQF_FDCNT_0_BESTCNT_SHIFT); 5368 5384 return fcnt_prog; 5369 5385 } 5370 5386 ··· 5398 5382 /* Check if, FD SB or ATR was auto disabled and if there is enough room 5399 5383 * to re-enable 5400 5384 */ 5401 - fcnt_prog = i40e_get_cur_guaranteed_fd_count(pf); 5385 + fcnt_prog = i40e_get_global_fd_count(pf); 5402 5386 fcnt_avail = pf->fdir_pf_filter_count; 5403 5387 if ((fcnt_prog < (fcnt_avail - I40E_FDIR_BUFFER_HEAD_ROOM)) || 5404 5388 (pf->fd_add_err == 0) || ··· 5420 5404 } 5421 5405 5422 5406 #define I40E_MIN_FD_FLUSH_INTERVAL 10 5407 + #define I40E_MIN_FD_FLUSH_SB_ATR_UNSTABLE 30 5423 5408 /** 5424 5409 * i40e_fdir_flush_and_replay - Function to flush all FD filters and replay SB 5425 5410 * @pf: board private structure 5426 5411 **/ 5427 5412 static void i40e_fdir_flush_and_replay(struct i40e_pf *pf) 5428 5413 { 5414 + unsigned long min_flush_time; 5429 5415 int flush_wait_retry = 50; 5416 + bool disable_atr = false; 5417 + int fd_room; 5430 5418 int reg; 5431 5419 5432 5420 if (!(pf->flags & (I40E_FLAG_FD_SB_ENABLED | I40E_FLAG_FD_ATR_ENABLED))) ··· 5438 5418 5439 5419 if (time_after(jiffies, pf->fd_flush_timestamp + 5440 5420 (I40E_MIN_FD_FLUSH_INTERVAL * HZ))) { 5441 - set_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state); 5421 + /* If the flush is happening too quick and we have mostly 5422 + * SB rules we should not re-enable ATR for some time. 5423 + */ 5424 + min_flush_time = pf->fd_flush_timestamp 5425 + + (I40E_MIN_FD_FLUSH_SB_ATR_UNSTABLE * HZ); 5426 + fd_room = pf->fdir_pf_filter_count - pf->fdir_pf_active_filters; 5427 + 5428 + if (!(time_after(jiffies, min_flush_time)) && 5429 + (fd_room < I40E_FDIR_BUFFER_HEAD_ROOM_FOR_ATR)) { 5430 + dev_info(&pf->pdev->dev, "ATR disabled, not enough FD filter space.\n"); 5431 + disable_atr = true; 5432 + } 5433 + 5442 5434 pf->fd_flush_timestamp = jiffies; 5443 - pf->auto_disable_flags |= I40E_FLAG_FD_SB_ENABLED; 5444 5435 pf->flags &= ~I40E_FLAG_FD_ATR_ENABLED; 5445 5436 /* flush all filters */ 5446 5437 wr32(&pf->hw, I40E_PFQF_CTL_1, ··· 5471 5440 } else { 5472 5441 /* replay sideband filters */ 5473 5442 i40e_fdir_filter_restore(pf->vsi[pf->lan_vsi]); 5474 - 5475 - pf->flags |= I40E_FLAG_FD_ATR_ENABLED; 5476 - pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED; 5477 - pf->auto_disable_flags &= ~I40E_FLAG_FD_SB_ENABLED; 5443 + if (!disable_atr) 5444 + pf->flags |= I40E_FLAG_FD_ATR_ENABLED; 5478 5445 clear_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state); 5479 5446 dev_info(&pf->pdev->dev, "FD Filter table flushed and FD-SB replayed.\n"); 5480 5447 } ··· 5483 5454 * i40e_get_current_atr_count - Get the count of total FD ATR filters programmed 5484 5455 * @pf: board private structure 5485 5456 **/ 5486 - int i40e_get_current_atr_cnt(struct i40e_pf *pf) 5457 + u32 i40e_get_current_atr_cnt(struct i40e_pf *pf) 5487 5458 { 5488 5459 return i40e_get_current_fd_count(pf) - pf->fdir_pf_active_filters; 5489 5460 } ··· 5509 5480 if (!(pf->flags & (I40E_FLAG_FD_SB_ENABLED | I40E_FLAG_FD_ATR_ENABLED))) 5510 5481 return; 5511 5482 5512 - if ((pf->fd_add_err >= I40E_MAX_FD_PROGRAM_ERROR) && 5513 - (i40e_get_current_atr_cnt(pf) >= pf->fd_atr_cnt) && 5514 - (i40e_get_current_atr_cnt(pf) > pf->fdir_pf_filter_count)) 5483 + if (test_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state)) 5515 5484 i40e_fdir_flush_and_replay(pf); 5516 5485 5517 5486 i40e_fdir_check_and_reenable(pf); ··· 5936 5909 if (!err && test_bit(__I40E_BAD_EEPROM, &pf->state)) { 5937 5910 dev_info(&pf->pdev->dev, "eeprom check passed, Tx/Rx traffic enabled\n"); 5938 5911 clear_bit(__I40E_BAD_EEPROM, &pf->state); 5912 + } 5913 + } 5914 + 5915 + /** 5916 + * i40e_enable_pf_switch_lb 5917 + * @pf: pointer to the pf structure 5918 + * 5919 + * enable switch loop back or die - no point in a return value 5920 + **/ 5921 + static void i40e_enable_pf_switch_lb(struct i40e_pf *pf) 5922 + { 5923 + struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; 5924 + struct i40e_vsi_context ctxt; 5925 + int aq_ret; 5926 + 5927 + ctxt.seid = pf->main_vsi_seid; 5928 + ctxt.pf_num = pf->hw.pf_id; 5929 + ctxt.vf_num = 0; 5930 + aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); 5931 + if (aq_ret) { 5932 + dev_info(&pf->pdev->dev, 5933 + "%s couldn't get pf vsi config, err %d, aq_err %d\n", 5934 + __func__, aq_ret, pf->hw.aq.asq_last_status); 5935 + return; 5936 + } 5937 + ctxt.flags = I40E_AQ_VSI_TYPE_PF; 5938 + ctxt.info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID); 5939 + ctxt.info.switch_id |= cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); 5940 + 5941 + aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); 5942 + if (aq_ret) { 5943 + dev_info(&pf->pdev->dev, 5944 + "%s: update vsi switch failed, aq_err=%d\n", 5945 + __func__, vsi->back->hw.aq.asq_last_status); 5946 + } 5947 + } 5948 + 5949 + /** 5950 + * i40e_disable_pf_switch_lb 5951 + * @pf: pointer to the pf structure 5952 + * 5953 + * disable switch loop back or die - no point in a return value 5954 + **/ 5955 + static void i40e_disable_pf_switch_lb(struct i40e_pf *pf) 5956 + { 5957 + struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; 5958 + struct i40e_vsi_context ctxt; 5959 + int aq_ret; 5960 + 5961 + ctxt.seid = pf->main_vsi_seid; 5962 + ctxt.pf_num = pf->hw.pf_id; 5963 + ctxt.vf_num = 0; 5964 + aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); 5965 + if (aq_ret) { 5966 + dev_info(&pf->pdev->dev, 5967 + "%s couldn't get pf vsi config, err %d, aq_err %d\n", 5968 + __func__, aq_ret, pf->hw.aq.asq_last_status); 5969 + return; 5970 + } 5971 + ctxt.flags = I40E_AQ_VSI_TYPE_PF; 5972 + ctxt.info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID); 5973 + ctxt.info.switch_id &= ~cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); 5974 + 5975 + aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); 5976 + if (aq_ret) { 5977 + dev_info(&pf->pdev->dev, 5978 + "%s: update vsi switch failed, aq_err=%d\n", 5979 + __func__, vsi->back->hw.aq.asq_last_status); 5939 5980 } 5940 5981 } 5941 5982 ··· 7035 6940 static int i40e_init_msix(struct i40e_pf *pf) 7036 6941 { 7037 6942 struct i40e_hw *hw = &pf->hw; 7038 - int other_vecs = 0; 6943 + int vectors_left; 7039 6944 int v_budget, i; 7040 6945 int v_actual; 7041 6946 ··· 7059 6964 * If we can't get what we want, we'll simplify to nearly nothing 7060 6965 * and try again. If that still fails, we punt. 7061 6966 */ 7062 - pf->num_lan_msix = min_t(int, num_online_cpus(), 7063 - hw->func_caps.num_msix_vectors); 7064 - pf->num_vmdq_msix = pf->num_vmdq_qps; 7065 - other_vecs = 1; 7066 - other_vecs += (pf->num_vmdq_vsis * pf->num_vmdq_msix); 7067 - if (pf->flags & I40E_FLAG_FD_SB_ENABLED) 7068 - other_vecs++; 6967 + vectors_left = hw->func_caps.num_msix_vectors; 6968 + v_budget = 0; 7069 6969 7070 - /* Scale down if necessary, and the rings will share vectors */ 7071 - pf->num_lan_msix = min_t(int, pf->num_lan_msix, 7072 - (hw->func_caps.num_msix_vectors - other_vecs)); 7073 - v_budget = pf->num_lan_msix + other_vecs; 6970 + /* reserve one vector for miscellaneous handler */ 6971 + if (vectors_left) { 6972 + v_budget++; 6973 + vectors_left--; 6974 + } 6975 + 6976 + /* reserve vectors for the main PF traffic queues */ 6977 + pf->num_lan_msix = min_t(int, num_online_cpus(), vectors_left); 6978 + vectors_left -= pf->num_lan_msix; 6979 + v_budget += pf->num_lan_msix; 6980 + 6981 + /* reserve one vector for sideband flow director */ 6982 + if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { 6983 + if (vectors_left) { 6984 + v_budget++; 6985 + vectors_left--; 6986 + } else { 6987 + pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; 6988 + } 6989 + } 7074 6990 7075 6991 #ifdef I40E_FCOE 6992 + /* can we reserve enough for FCoE? */ 7076 6993 if (pf->flags & I40E_FLAG_FCOE_ENABLED) { 7077 - pf->num_fcoe_msix = pf->num_fcoe_qps; 6994 + if (!vectors_left) 6995 + pf->num_fcoe_msix = 0; 6996 + else if (vectors_left >= pf->num_fcoe_qps) 6997 + pf->num_fcoe_msix = pf->num_fcoe_qps; 6998 + else 6999 + pf->num_fcoe_msix = 1; 7078 7000 v_budget += pf->num_fcoe_msix; 7001 + vectors_left -= pf->num_fcoe_msix; 7079 7002 } 7003 + 7080 7004 #endif 7005 + /* any vectors left over go for VMDq support */ 7006 + if (pf->flags & I40E_FLAG_VMDQ_ENABLED) { 7007 + int vmdq_vecs_wanted = pf->num_vmdq_vsis * pf->num_vmdq_qps; 7008 + int vmdq_vecs = min_t(int, vectors_left, vmdq_vecs_wanted); 7009 + 7010 + /* if we're short on vectors for what's desired, we limit 7011 + * the queues per vmdq. If this is still more than are 7012 + * available, the user will need to change the number of 7013 + * queues/vectors used by the PF later with the ethtool 7014 + * channels command 7015 + */ 7016 + if (vmdq_vecs < vmdq_vecs_wanted) 7017 + pf->num_vmdq_qps = 1; 7018 + pf->num_vmdq_msix = pf->num_vmdq_qps; 7019 + 7020 + v_budget += vmdq_vecs; 7021 + vectors_left -= vmdq_vecs; 7022 + } 7081 7023 7082 7024 pf->msix_entries = kcalloc(v_budget, sizeof(struct msix_entry), 7083 7025 GFP_KERNEL); ··· 7160 7028 /* Scale vector usage down */ 7161 7029 pf->num_vmdq_msix = 1; /* force VMDqs to only one vector */ 7162 7030 pf->num_vmdq_vsis = 1; 7031 + pf->num_vmdq_qps = 1; 7032 + pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; 7163 7033 7164 7034 /* partition out the remaining vectors */ 7165 7035 switch (vec) { ··· 7187 7053 vec--; 7188 7054 } 7189 7055 #endif 7190 - pf->num_lan_msix = min_t(int, (vec / 2), 7191 - pf->num_lan_qps); 7192 - pf->num_vmdq_vsis = min_t(int, (vec - pf->num_lan_msix), 7193 - I40E_DEFAULT_NUM_VMDQ_VSI); 7056 + /* give the rest to the PF */ 7057 + pf->num_lan_msix = min_t(int, vec, pf->num_lan_qps); 7194 7058 break; 7195 7059 } 7196 7060 } ··· 7398 7266 7399 7267 /* Check capability and Set table size and register per hw expectation*/ 7400 7268 reg_val = rd32(hw, I40E_PFQF_CTL_0); 7401 - if (hw->func_caps.rss_table_size == 512) { 7269 + if (pf->rss_table_size == 512) 7402 7270 reg_val |= I40E_PFQF_CTL_0_HASHLUTSIZE_512; 7403 - pf->rss_table_size = 512; 7404 - } else { 7405 - pf->rss_table_size = 128; 7271 + else 7406 7272 reg_val &= ~I40E_PFQF_CTL_0_HASHLUTSIZE_512; 7407 - } 7408 7273 wr32(hw, I40E_PFQF_CTL_0, reg_val); 7409 7274 7410 7275 /* Populate the LUT with max no. of queues in round robin fashion */ ··· 8052 7923 } 8053 7924 #endif /* HAVE_BRIDGE_ATTRIBS */ 8054 7925 8055 - const struct net_device_ops i40e_netdev_ops = { 7926 + static const struct net_device_ops i40e_netdev_ops = { 8056 7927 .ndo_open = i40e_open, 8057 7928 .ndo_stop = i40e_close, 8058 7929 .ndo_start_xmit = i40e_lan_xmit_frame, ··· 9371 9242 pf->fc_autoneg_status = ((pf->hw.phy.link_info.an_info & 9372 9243 I40E_AQ_AN_COMPLETED) ? true : false); 9373 9244 9374 - /* fill in link information and enable LSE reporting */ 9375 - i40e_aq_get_link_info(&pf->hw, true, NULL, NULL); 9376 - i40e_link_event(pf); 9377 - 9378 - /* Initialize user-specific link properties */ 9379 - pf->fc_autoneg_status = ((pf->hw.phy.link_info.an_info & 9380 - I40E_AQ_AN_COMPLETED) ? true : false); 9381 - 9382 9245 i40e_ptp_init(pf); 9383 9246 9384 9247 return ret; ··· 10287 10166 i40e_driver_string, i40e_driver_version_str); 10288 10167 pr_info("%s: %s\n", i40e_driver_name, i40e_copyright); 10289 10168 10290 - #if IS_ENABLED(CONFIG_I40E_CONFIGFS_FS) 10291 - i40e_configfs_init(); 10292 - #endif /* CONFIG_I40E_CONFIGFS_FS */ 10293 10169 i40e_dbg_init(); 10294 10170 return pci_register_driver(&i40e_driver); 10295 10171 } ··· 10302 10184 { 10303 10185 pci_unregister_driver(&i40e_driver); 10304 10186 i40e_dbg_exit(); 10305 - #if IS_ENABLED(CONFIG_I40E_CONFIGFS_FS) 10306 - i40e_configfs_exit(); 10307 - #endif /* CONFIG_I40E_CONFIGFS_FS */ 10308 10187 } 10309 10188 module_exit(i40e_exit_module);
+4 -5
drivers/net/ethernet/intel/i40e/i40e_nvm.c
··· 171 171 * 172 172 * Reads one 16 bit word from the Shadow RAM using the GLNVM_SRCTL register. 173 173 **/ 174 - i40e_status i40e_read_nvm_word_srctl(struct i40e_hw *hw, u16 offset, 175 - u16 *data) 174 + static i40e_status i40e_read_nvm_word_srctl(struct i40e_hw *hw, u16 offset, 175 + u16 *data) 176 176 { 177 177 i40e_status ret_code = I40E_ERR_TIMEOUT; 178 178 u32 sr_reg; ··· 200 200 *data = (u16)((sr_reg & 201 201 I40E_GLNVM_SRDATA_RDDATA_MASK) 202 202 >> I40E_GLNVM_SRDATA_RDDATA_SHIFT); 203 - *data = le16_to_cpu(*data); 204 203 } 205 204 } 206 205 if (ret_code) ··· 236 237 * method. The buffer read is preceded by the NVM ownership take 237 238 * and followed by the release. 238 239 **/ 239 - i40e_status i40e_read_nvm_buffer_srctl(struct i40e_hw *hw, u16 offset, 240 - u16 *words, u16 *data) 240 + static i40e_status i40e_read_nvm_buffer_srctl(struct i40e_hw *hw, u16 offset, 241 + u16 *words, u16 *data) 241 242 { 242 243 i40e_status ret_code = 0; 243 244 u16 index, word;
+35 -7
drivers/net/ethernet/intel/i40e/i40e_txrx.c
··· 228 228 "PCTYPE:%d, Filter command send failed for fd_id:%d (ret = %d)\n", 229 229 fd_data->pctype, fd_data->fd_id, ret); 230 230 err = true; 231 - } else { 231 + } else if (I40E_DEBUG_FD & pf->hw.debug_mask) { 232 232 if (add) 233 233 dev_info(&pf->pdev->dev, 234 234 "Filter OK for PCTYPE %d loc = %d\n", ··· 303 303 "PCTYPE:%d, Filter command send failed for fd_id:%d (ret = %d)\n", 304 304 fd_data->pctype, fd_data->fd_id, ret); 305 305 err = true; 306 - } else { 306 + } else if (I40E_DEBUG_FD & pf->hw.debug_mask) { 307 307 if (add) 308 308 dev_info(&pf->pdev->dev, "Filter OK for PCTYPE %d loc = %d)\n", 309 309 fd_data->pctype, fd_data->fd_id); ··· 376 376 "PCTYPE:%d, Filter command send failed for fd_id:%d (ret = %d)\n", 377 377 fd_data->pctype, fd_data->fd_id, ret); 378 378 err = true; 379 - } else { 379 + } else if (I40E_DEBUG_FD & pf->hw.debug_mask) { 380 380 if (add) 381 381 dev_info(&pf->pdev->dev, 382 382 "Filter OK for PCTYPE %d loc = %d\n", ··· 471 471 dev_warn(&pdev->dev, "ntuple filter loc = %d, could not be added\n", 472 472 rx_desc->wb.qword0.hi_dword.fd_id); 473 473 474 + /* Check if the programming error is for ATR. 475 + * If so, auto disable ATR and set a state for 476 + * flush in progress. Next time we come here if flush is in 477 + * progress do nothing, once flush is complete the state will 478 + * be cleared. 479 + */ 480 + if (test_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state)) 481 + return; 482 + 474 483 pf->fd_add_err++; 475 484 /* store the current atr filter count */ 476 485 pf->fd_atr_cnt = i40e_get_current_atr_cnt(pf); 477 486 487 + if ((rx_desc->wb.qword0.hi_dword.fd_id == 0) && 488 + (pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED)) { 489 + pf->auto_disable_flags |= I40E_FLAG_FD_ATR_ENABLED; 490 + set_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state); 491 + } 492 + 478 493 /* filter programming failed most likely due to table full */ 479 - fcnt_prog = i40e_get_cur_guaranteed_fd_count(pf); 494 + fcnt_prog = i40e_get_global_fd_count(pf); 480 495 fcnt_avail = pf->fdir_pf_filter_count; 481 496 /* If ATR is running fcnt_prog can quickly change, 482 497 * if we are very close to full, it makes sense to disable ··· 769 754 tx_buf = tx_ring->tx_bi; 770 755 tx_desc = I40E_TX_DESC(tx_ring, 0); 771 756 } 757 + 758 + prefetch(tx_desc); 772 759 773 760 /* update budget accounting */ 774 761 budget--; ··· 1061 1044 for (i = 0; i < rx_ring->count; i++) { 1062 1045 rx_bi = &rx_ring->rx_bi[i]; 1063 1046 rx_bi->dma = 0; 1064 - rx_bi->hdr_buf = 0; 1047 + rx_bi->hdr_buf = NULL; 1065 1048 } 1066 1049 } 1067 1050 } ··· 1943 1926 if (!(pf->flags & I40E_FLAG_FD_ATR_ENABLED)) 1944 1927 return; 1945 1928 1929 + if ((pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED)) 1930 + return; 1931 + 1946 1932 /* if sampling is disabled do nothing */ 1947 1933 if (!tx_ring->atr_sample_rate) 1948 1934 return; ··· 2218 2198 struct iphdr *this_ip_hdr; 2219 2199 u32 network_hdr_len; 2220 2200 u8 l4_hdr = 0; 2201 + u32 l4_tunnel = 0; 2221 2202 2222 2203 if (skb->encapsulation) { 2204 + switch (ip_hdr(skb)->protocol) { 2205 + case IPPROTO_UDP: 2206 + l4_tunnel = I40E_TXD_CTX_UDP_TUNNELING; 2207 + break; 2208 + default: 2209 + return; 2210 + } 2223 2211 network_hdr_len = skb_inner_network_header_len(skb); 2224 2212 this_ip_hdr = inner_ip_hdr(skb); 2225 2213 this_ipv6_hdr = inner_ipv6_hdr(skb); ··· 2250 2222 2251 2223 /* Now set the ctx descriptor fields */ 2252 2224 *cd_tunneling |= (skb_network_header_len(skb) >> 2) << 2253 - I40E_TXD_CTX_QW0_EXT_IPLEN_SHIFT | 2254 - I40E_TXD_CTX_UDP_TUNNELING | 2225 + I40E_TXD_CTX_QW0_EXT_IPLEN_SHIFT | 2226 + l4_tunnel | 2255 2227 ((skb_inner_network_offset(skb) - 2256 2228 skb_transport_offset(skb)) >> 1) << 2257 2229 I40E_TXD_CTX_QW0_NATLEN_SHIFT;
-68
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
··· 710 710 } 711 711 712 712 /** 713 - * i40e_enable_pf_switch_lb 714 - * @pf: pointer to the pf structure 715 - * 716 - * enable switch loop back or die - no point in a return value 717 - **/ 718 - void i40e_enable_pf_switch_lb(struct i40e_pf *pf) 719 - { 720 - struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; 721 - struct i40e_vsi_context ctxt; 722 - int aq_ret; 723 - 724 - ctxt.seid = pf->main_vsi_seid; 725 - ctxt.pf_num = pf->hw.pf_id; 726 - ctxt.vf_num = 0; 727 - aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); 728 - if (aq_ret) { 729 - dev_info(&pf->pdev->dev, 730 - "%s couldn't get pf vsi config, err %d, aq_err %d\n", 731 - __func__, aq_ret, pf->hw.aq.asq_last_status); 732 - return; 733 - } 734 - ctxt.flags = I40E_AQ_VSI_TYPE_PF; 735 - ctxt.info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID); 736 - ctxt.info.switch_id |= cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); 737 - 738 - aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); 739 - if (aq_ret) { 740 - dev_info(&pf->pdev->dev, 741 - "%s: update vsi switch failed, aq_err=%d\n", 742 - __func__, vsi->back->hw.aq.asq_last_status); 743 - } 744 - } 745 - 746 - /** 747 - * i40e_disable_pf_switch_lb 748 - * @pf: pointer to the pf structure 749 - * 750 - * disable switch loop back or die - no point in a return value 751 - **/ 752 - void i40e_disable_pf_switch_lb(struct i40e_pf *pf) 753 - { 754 - struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; 755 - struct i40e_vsi_context ctxt; 756 - int aq_ret; 757 - 758 - ctxt.seid = pf->main_vsi_seid; 759 - ctxt.pf_num = pf->hw.pf_id; 760 - ctxt.vf_num = 0; 761 - aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); 762 - if (aq_ret) { 763 - dev_info(&pf->pdev->dev, 764 - "%s couldn't get pf vsi config, err %d, aq_err %d\n", 765 - __func__, aq_ret, pf->hw.aq.asq_last_status); 766 - return; 767 - } 768 - ctxt.flags = I40E_AQ_VSI_TYPE_PF; 769 - ctxt.info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID); 770 - ctxt.info.switch_id &= ~cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); 771 - 772 - aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); 773 - if (aq_ret) { 774 - dev_info(&pf->pdev->dev, 775 - "%s: update vsi switch failed, aq_err=%d\n", 776 - __func__, vsi->back->hw.aq.asq_last_status); 777 - } 778 - } 779 - 780 - /** 781 713 * i40e_free_vfs 782 714 * @pf: pointer to the pf structure 783 715 *
-2
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
··· 126 126 127 127 void i40e_vc_notify_link_state(struct i40e_pf *pf); 128 128 void i40e_vc_notify_reset(struct i40e_pf *pf); 129 - void i40e_enable_pf_switch_lb(struct i40e_pf *pf); 130 - void i40e_disable_pf_switch_lb(struct i40e_pf *pf); 131 129 132 130 #endif /* _I40E_VIRTCHNL_PF_H_ */
+22 -22
drivers/net/ethernet/intel/i40evf/i40e_common.c
··· 85 85 { 86 86 struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; 87 87 u16 len = le16_to_cpu(aq_desc->datalen); 88 - u8 *aq_buffer = (u8 *)buffer; 89 - u32 data[4]; 90 - u32 i = 0; 88 + u8 *buf = (u8 *)buffer; 89 + u16 i = 0; 91 90 92 91 if ((!(mask & hw->debug_mask)) || (desc == NULL)) 93 92 return; ··· 108 109 le32_to_cpu(aq_desc->params.external.addr_low)); 109 110 110 111 if ((buffer != NULL) && (aq_desc->datalen != 0)) { 111 - memset(data, 0, sizeof(data)); 112 112 i40e_debug(hw, mask, "AQ CMD Buffer:\n"); 113 113 if (buf_len < len) 114 114 len = buf_len; 115 - for (i = 0; i < len; i++) { 116 - data[((i % 16) / 4)] |= 117 - ((u32)aq_buffer[i]) << (8 * (i % 4)); 118 - if ((i % 16) == 15) { 119 - i40e_debug(hw, mask, 120 - "\t0x%04X %08X %08X %08X %08X\n", 121 - i - 15, le32_to_cpu(data[0]), 122 - le32_to_cpu(data[1]), 123 - le32_to_cpu(data[2]), 124 - le32_to_cpu(data[3])); 125 - memset(data, 0, sizeof(data)); 126 - } 115 + /* write the full 16-byte chunks */ 116 + for (i = 0; i < (len - 16); i += 16) 117 + i40e_debug(hw, mask, 118 + "\t0x%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", 119 + i, buf[i], buf[i + 1], buf[i + 2], 120 + buf[i + 3], buf[i + 4], buf[i + 5], 121 + buf[i + 6], buf[i + 7], buf[i + 8], 122 + buf[i + 9], buf[i + 10], buf[i + 11], 123 + buf[i + 12], buf[i + 13], buf[i + 14], 124 + buf[i + 15]); 125 + /* write whatever's left over without overrunning the buffer */ 126 + if (i < len) { 127 + char d_buf[80]; 128 + int j = 0; 129 + 130 + memset(d_buf, 0, sizeof(d_buf)); 131 + j += sprintf(d_buf, "\t0x%04X ", i); 132 + while (i < len) 133 + j += sprintf(&d_buf[j], " %02X", buf[i++]); 134 + i40e_debug(hw, mask, "%s\n", d_buf); 127 135 } 128 - if ((i % 16) != 0) 129 - i40e_debug(hw, mask, "\t0x%04X %08X %08X %08X %08X\n", 130 - i - (i % 16), le32_to_cpu(data[0]), 131 - le32_to_cpu(data[1]), 132 - le32_to_cpu(data[2]), 133 - le32_to_cpu(data[3])); 134 136 } 135 137 } 136 138
+13 -3
drivers/net/ethernet/intel/i40evf/i40e_txrx.c
··· 289 289 tx_desc = I40E_TX_DESC(tx_ring, 0); 290 290 } 291 291 292 + prefetch(tx_desc); 293 + 292 294 /* update budget accounting */ 293 295 budget--; 294 296 } while (likely(budget)); ··· 544 542 for (i = 0; i < rx_ring->count; i++) { 545 543 rx_bi = &rx_ring->rx_bi[i]; 546 544 rx_bi->dma = 0; 547 - rx_bi->hdr_buf = 0; 545 + rx_bi->hdr_buf = NULL; 548 546 } 549 547 } 550 548 } ··· 1463 1461 struct iphdr *this_ip_hdr; 1464 1462 u32 network_hdr_len; 1465 1463 u8 l4_hdr = 0; 1464 + u32 l4_tunnel = 0; 1466 1465 1467 1466 if (skb->encapsulation) { 1467 + switch (ip_hdr(skb)->protocol) { 1468 + case IPPROTO_UDP: 1469 + l4_tunnel = I40E_TXD_CTX_UDP_TUNNELING; 1470 + break; 1471 + default: 1472 + return; 1473 + } 1468 1474 network_hdr_len = skb_inner_network_header_len(skb); 1469 1475 this_ip_hdr = inner_ip_hdr(skb); 1470 1476 this_ipv6_hdr = inner_ipv6_hdr(skb); ··· 1495 1485 1496 1486 /* Now set the ctx descriptor fields */ 1497 1487 *cd_tunneling |= (skb_network_header_len(skb) >> 2) << 1498 - I40E_TXD_CTX_QW0_EXT_IPLEN_SHIFT | 1499 - I40E_TXD_CTX_UDP_TUNNELING | 1488 + I40E_TXD_CTX_QW0_EXT_IPLEN_SHIFT | 1489 + l4_tunnel | 1500 1490 ((skb_inner_network_offset(skb) - 1501 1491 skb_transport_offset(skb)) >> 1) << 1502 1492 I40E_TXD_CTX_QW0_NATLEN_SHIFT;
+1 -1
drivers/net/ethernet/intel/i40evf/i40evf_main.c
··· 36 36 static const char i40evf_driver_string[] = 37 37 "Intel(R) XL710/X710 Virtual Function Network Driver"; 38 38 39 - #define DRV_VERSION "1.2.5" 39 + #define DRV_VERSION "1.2.6" 40 40 const char i40evf_driver_version[] = DRV_VERSION; 41 41 static const char i40evf_copyright[] = 42 42 "Copyright (c) 2013 - 2014 Intel Corporation.";