Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * |
| 3 | * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver |
Mitch Williams | ef8693e | 2014-02-13 03:48:53 -0800 | [diff] [blame] | 4 | * Copyright(c) 2013 - 2014 Intel Corporation. |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 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 | * |
Jesse Brandeburg | b831607 | 2014-04-05 07:46:11 +0000 | [diff] [blame] | 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 | * |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 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 "i40evf.h" |
| 28 | #include "i40e_prototype.h" |
Mitch Williams | ed0e894 | 2017-01-24 10:23:59 -0800 | [diff] [blame^] | 29 | #include "i40evf_client.h" |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 30 | |
| 31 | /* busy wait delay in msec */ |
| 32 | #define I40EVF_BUSY_WAIT_DELAY 10 |
| 33 | #define I40EVF_BUSY_WAIT_COUNT 50 |
| 34 | |
| 35 | /** |
| 36 | * i40evf_send_pf_msg |
| 37 | * @adapter: adapter structure |
| 38 | * @op: virtual channel opcode |
| 39 | * @msg: pointer to message buffer |
| 40 | * @len: message length |
| 41 | * |
| 42 | * Send message to PF and print status if failure. |
| 43 | **/ |
| 44 | static int i40evf_send_pf_msg(struct i40evf_adapter *adapter, |
| 45 | enum i40e_virtchnl_ops op, u8 *msg, u16 len) |
| 46 | { |
| 47 | struct i40e_hw *hw = &adapter->hw; |
| 48 | i40e_status err; |
| 49 | |
Mitch Williams | ef8693e | 2014-02-13 03:48:53 -0800 | [diff] [blame] | 50 | if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) |
| 51 | return 0; /* nothing to see here, move along */ |
| 52 | |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 53 | err = i40e_aq_send_msg_to_pf(hw, op, 0, msg, len, NULL); |
| 54 | if (err) |
Shannon Nelson | f1c7e72 | 2015-06-04 16:24:01 -0400 | [diff] [blame] | 55 | dev_err(&adapter->pdev->dev, "Unable to send opcode %d to PF, err %s, aq_err %s\n", |
| 56 | op, i40evf_stat_str(hw, err), |
| 57 | i40evf_aq_str(hw, hw->aq.asq_last_status)); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 58 | return err; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * i40evf_send_api_ver |
| 63 | * @adapter: adapter structure |
| 64 | * |
| 65 | * Send API version admin queue message to the PF. The reply is not checked |
| 66 | * in this function. Returns 0 if the message was successfully |
| 67 | * sent, or one of the I40E_ADMIN_QUEUE_ERROR_ statuses if not. |
| 68 | **/ |
| 69 | int i40evf_send_api_ver(struct i40evf_adapter *adapter) |
| 70 | { |
| 71 | struct i40e_virtchnl_version_info vvi; |
| 72 | |
| 73 | vvi.major = I40E_VIRTCHNL_VERSION_MAJOR; |
| 74 | vvi.minor = I40E_VIRTCHNL_VERSION_MINOR; |
| 75 | |
| 76 | return i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_VERSION, (u8 *)&vvi, |
| 77 | sizeof(vvi)); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * i40evf_verify_api_ver |
| 82 | * @adapter: adapter structure |
| 83 | * |
| 84 | * Compare API versions with the PF. Must be called after admin queue is |
Mitch Williams | 6a8e93d | 2014-06-05 00:09:17 +0000 | [diff] [blame] | 85 | * initialized. Returns 0 if API versions match, -EIO if they do not, |
| 86 | * I40E_ERR_ADMIN_QUEUE_NO_WORK if the admin queue is empty, and any errors |
| 87 | * from the firmware are propagated. |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 88 | **/ |
| 89 | int i40evf_verify_api_ver(struct i40evf_adapter *adapter) |
| 90 | { |
| 91 | struct i40e_virtchnl_version_info *pf_vvi; |
| 92 | struct i40e_hw *hw = &adapter->hw; |
| 93 | struct i40e_arq_event_info event; |
Mitch Williams | f8d4db3 | 2014-10-25 03:24:33 +0000 | [diff] [blame] | 94 | enum i40e_virtchnl_ops op; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 95 | i40e_status err; |
| 96 | |
Mitch Williams | 1001dc3 | 2014-11-11 20:02:19 +0000 | [diff] [blame] | 97 | event.buf_len = I40EVF_MAX_AQ_BUF_SIZE; |
| 98 | event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 99 | if (!event.msg_buf) { |
| 100 | err = -ENOMEM; |
| 101 | goto out; |
| 102 | } |
| 103 | |
Mitch Williams | f8d4db3 | 2014-10-25 03:24:33 +0000 | [diff] [blame] | 104 | while (1) { |
| 105 | err = i40evf_clean_arq_element(hw, &event, NULL); |
| 106 | /* When the AQ is empty, i40evf_clean_arq_element will return |
| 107 | * nonzero and this loop will terminate. |
| 108 | */ |
| 109 | if (err) |
| 110 | goto out_alloc; |
| 111 | op = |
| 112 | (enum i40e_virtchnl_ops)le32_to_cpu(event.desc.cookie_high); |
| 113 | if (op == I40E_VIRTCHNL_OP_VERSION) |
| 114 | break; |
| 115 | } |
| 116 | |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 117 | |
| 118 | err = (i40e_status)le32_to_cpu(event.desc.cookie_low); |
Mitch Williams | 6a8e93d | 2014-06-05 00:09:17 +0000 | [diff] [blame] | 119 | if (err) |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 120 | goto out_alloc; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 121 | |
Mitch Williams | f8d4db3 | 2014-10-25 03:24:33 +0000 | [diff] [blame] | 122 | if (op != I40E_VIRTCHNL_OP_VERSION) { |
Mitch Williams | 6a8e93d | 2014-06-05 00:09:17 +0000 | [diff] [blame] | 123 | dev_info(&adapter->pdev->dev, "Invalid reply type %d from PF\n", |
Mitch Williams | f8d4db3 | 2014-10-25 03:24:33 +0000 | [diff] [blame] | 124 | op); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 125 | err = -EIO; |
| 126 | goto out_alloc; |
| 127 | } |
| 128 | |
| 129 | pf_vvi = (struct i40e_virtchnl_version_info *)event.msg_buf; |
Mitch Williams | ee1693e | 2015-06-04 16:23:59 -0400 | [diff] [blame] | 130 | adapter->pf_version = *pf_vvi; |
| 131 | |
| 132 | if ((pf_vvi->major > I40E_VIRTCHNL_VERSION_MAJOR) || |
| 133 | ((pf_vvi->major == I40E_VIRTCHNL_VERSION_MAJOR) && |
| 134 | (pf_vvi->minor > I40E_VIRTCHNL_VERSION_MINOR))) |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 135 | err = -EIO; |
| 136 | |
| 137 | out_alloc: |
| 138 | kfree(event.msg_buf); |
| 139 | out: |
| 140 | return err; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * i40evf_send_vf_config_msg |
| 145 | * @adapter: adapter structure |
| 146 | * |
| 147 | * Send VF configuration request admin queue message to the PF. The reply |
| 148 | * is not checked in this function. Returns 0 if the message was |
| 149 | * successfully sent, or one of the I40E_ADMIN_QUEUE_ERROR_ statuses if not. |
| 150 | **/ |
| 151 | int i40evf_send_vf_config_msg(struct i40evf_adapter *adapter) |
| 152 | { |
Mitch Williams | e6d038d | 2015-06-04 16:23:58 -0400 | [diff] [blame] | 153 | u32 caps; |
| 154 | |
| 155 | adapter->current_op = I40E_VIRTCHNL_OP_GET_VF_RESOURCES; |
| 156 | adapter->aq_required &= ~I40EVF_FLAG_AQ_GET_CONFIG; |
| 157 | caps = I40E_VIRTCHNL_VF_OFFLOAD_L2 | |
| 158 | I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ | |
| 159 | I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG | |
Anjali Singhai Jain | 1f01227 | 2015-09-03 17:18:53 -0400 | [diff] [blame] | 160 | I40E_VIRTCHNL_VF_OFFLOAD_VLAN | |
Anjali Singhai Jain | b9eacec | 2015-11-19 11:34:22 -0800 | [diff] [blame] | 161 | I40E_VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | |
| 162 | I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2; |
| 163 | |
Mitch Williams | e6d038d | 2015-06-04 16:23:58 -0400 | [diff] [blame] | 164 | adapter->current_op = I40E_VIRTCHNL_OP_GET_VF_RESOURCES; |
| 165 | adapter->aq_required &= ~I40EVF_FLAG_AQ_GET_CONFIG; |
| 166 | if (PF_IS_V11(adapter)) |
| 167 | return i40evf_send_pf_msg(adapter, |
| 168 | I40E_VIRTCHNL_OP_GET_VF_RESOURCES, |
| 169 | (u8 *)&caps, sizeof(caps)); |
| 170 | else |
| 171 | return i40evf_send_pf_msg(adapter, |
| 172 | I40E_VIRTCHNL_OP_GET_VF_RESOURCES, |
| 173 | NULL, 0); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | /** |
| 177 | * i40evf_get_vf_config |
| 178 | * @hw: pointer to the hardware structure |
| 179 | * @len: length of buffer |
| 180 | * |
| 181 | * Get VF configuration from PF and populate hw structure. Must be called after |
| 182 | * admin queue is initialized. Busy waits until response is received from PF, |
| 183 | * with maximum timeout. Response from PF is returned in the buffer for further |
| 184 | * processing by the caller. |
| 185 | **/ |
| 186 | int i40evf_get_vf_config(struct i40evf_adapter *adapter) |
| 187 | { |
| 188 | struct i40e_hw *hw = &adapter->hw; |
| 189 | struct i40e_arq_event_info event; |
Mitch Williams | f8d4db3 | 2014-10-25 03:24:33 +0000 | [diff] [blame] | 190 | enum i40e_virtchnl_ops op; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 191 | i40e_status err; |
Mitch Williams | f8d4db3 | 2014-10-25 03:24:33 +0000 | [diff] [blame] | 192 | u16 len; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 193 | |
| 194 | len = sizeof(struct i40e_virtchnl_vf_resource) + |
| 195 | I40E_MAX_VF_VSI * sizeof(struct i40e_virtchnl_vsi_resource); |
Mitch Williams | 1001dc3 | 2014-11-11 20:02:19 +0000 | [diff] [blame] | 196 | event.buf_len = len; |
| 197 | event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 198 | if (!event.msg_buf) { |
| 199 | err = -ENOMEM; |
| 200 | goto out; |
| 201 | } |
| 202 | |
Mitch Williams | f8d4db3 | 2014-10-25 03:24:33 +0000 | [diff] [blame] | 203 | while (1) { |
Mitch Williams | f8d4db3 | 2014-10-25 03:24:33 +0000 | [diff] [blame] | 204 | /* When the AQ is empty, i40evf_clean_arq_element will return |
| 205 | * nonzero and this loop will terminate. |
| 206 | */ |
| 207 | err = i40evf_clean_arq_element(hw, &event, NULL); |
| 208 | if (err) |
| 209 | goto out_alloc; |
| 210 | op = |
| 211 | (enum i40e_virtchnl_ops)le32_to_cpu(event.desc.cookie_high); |
| 212 | if (op == I40E_VIRTCHNL_OP_GET_VF_RESOURCES) |
| 213 | break; |
| 214 | } |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 215 | |
| 216 | err = (i40e_status)le32_to_cpu(event.desc.cookie_low); |
Mitch Williams | 1001dc3 | 2014-11-11 20:02:19 +0000 | [diff] [blame] | 217 | memcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len)); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 218 | |
| 219 | i40e_vf_parse_hw_config(hw, adapter->vf_res); |
| 220 | out_alloc: |
| 221 | kfree(event.msg_buf); |
| 222 | out: |
| 223 | return err; |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * i40evf_configure_queues |
| 228 | * @adapter: adapter structure |
| 229 | * |
| 230 | * Request that the PF set up our (previously allocated) queues. |
| 231 | **/ |
| 232 | void i40evf_configure_queues(struct i40evf_adapter *adapter) |
| 233 | { |
| 234 | struct i40e_virtchnl_vsi_queue_config_info *vqci; |
| 235 | struct i40e_virtchnl_queue_pair_info *vqpi; |
Mitch Williams | cc05292 | 2014-10-25 03:24:34 +0000 | [diff] [blame] | 236 | int pairs = adapter->num_active_queues; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 237 | int i, len; |
| 238 | |
| 239 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 240 | /* bail because we already have a command pending */ |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 241 | dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pending\n", |
| 242 | adapter->current_op); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 243 | return; |
| 244 | } |
| 245 | adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES; |
| 246 | len = sizeof(struct i40e_virtchnl_vsi_queue_config_info) + |
| 247 | (sizeof(struct i40e_virtchnl_queue_pair_info) * pairs); |
Mitch Williams | a85088d | 2015-11-06 15:26:04 -0800 | [diff] [blame] | 248 | vqci = kzalloc(len, GFP_KERNEL); |
Mitch Williams | 249c8b8 | 2014-05-10 04:49:04 +0000 | [diff] [blame] | 249 | if (!vqci) |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 250 | return; |
Mitch Williams | 249c8b8 | 2014-05-10 04:49:04 +0000 | [diff] [blame] | 251 | |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 252 | vqci->vsi_id = adapter->vsi_res->vsi_id; |
| 253 | vqci->num_queue_pairs = pairs; |
| 254 | vqpi = vqci->qpair; |
| 255 | /* Size check is not needed here - HW max is 16 queue pairs, and we |
| 256 | * can fit info for 31 of them into the AQ buffer before it overflows. |
| 257 | */ |
| 258 | for (i = 0; i < pairs; i++) { |
| 259 | vqpi->txq.vsi_id = vqci->vsi_id; |
| 260 | vqpi->txq.queue_id = i; |
Mitch Williams | 0dd438d | 2015-10-26 19:44:40 -0400 | [diff] [blame] | 261 | vqpi->txq.ring_len = adapter->tx_rings[i].count; |
| 262 | vqpi->txq.dma_ring_addr = adapter->tx_rings[i].dma; |
Ashish Shah | 5d29896 | 2014-05-22 06:31:25 +0000 | [diff] [blame] | 263 | vqpi->txq.headwb_enabled = 1; |
| 264 | vqpi->txq.dma_headwb_addr = vqpi->txq.dma_ring_addr + |
| 265 | (vqpi->txq.ring_len * sizeof(struct i40e_tx_desc)); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 266 | |
| 267 | vqpi->rxq.vsi_id = vqci->vsi_id; |
| 268 | vqpi->rxq.queue_id = i; |
Mitch Williams | 0dd438d | 2015-10-26 19:44:40 -0400 | [diff] [blame] | 269 | vqpi->rxq.ring_len = adapter->rx_rings[i].count; |
| 270 | vqpi->rxq.dma_ring_addr = adapter->rx_rings[i].dma; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 271 | vqpi->rxq.max_pkt_size = adapter->netdev->mtu |
| 272 | + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN; |
Mitch Williams | 0dd438d | 2015-10-26 19:44:40 -0400 | [diff] [blame] | 273 | vqpi->rxq.databuffer_size = adapter->rx_rings[i].rx_buf_len; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 274 | vqpi++; |
| 275 | } |
| 276 | |
Mitch Williams | fc86a97 | 2014-06-04 20:41:38 +0000 | [diff] [blame] | 277 | adapter->aq_required &= ~I40EVF_FLAG_AQ_CONFIGURE_QUEUES; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 278 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES, |
| 279 | (u8 *)vqci, len); |
| 280 | kfree(vqci); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | /** |
| 284 | * i40evf_enable_queues |
| 285 | * @adapter: adapter structure |
| 286 | * |
| 287 | * Request that the PF enable all of our queues. |
| 288 | **/ |
| 289 | void i40evf_enable_queues(struct i40evf_adapter *adapter) |
| 290 | { |
| 291 | struct i40e_virtchnl_queue_select vqs; |
| 292 | |
| 293 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 294 | /* bail because we already have a command pending */ |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 295 | dev_err(&adapter->pdev->dev, "Cannot enable queues, command %d pending\n", |
| 296 | adapter->current_op); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 297 | return; |
| 298 | } |
| 299 | adapter->current_op = I40E_VIRTCHNL_OP_ENABLE_QUEUES; |
| 300 | vqs.vsi_id = adapter->vsi_res->vsi_id; |
Jesse Brandeburg | 41a1d04 | 2015-06-04 16:24:02 -0400 | [diff] [blame] | 301 | vqs.tx_queues = BIT(adapter->num_active_queues) - 1; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 302 | vqs.rx_queues = vqs.tx_queues; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 303 | adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_QUEUES; |
Mitch Williams | fc86a97 | 2014-06-04 20:41:38 +0000 | [diff] [blame] | 304 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ENABLE_QUEUES, |
| 305 | (u8 *)&vqs, sizeof(vqs)); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | /** |
| 309 | * i40evf_disable_queues |
| 310 | * @adapter: adapter structure |
| 311 | * |
| 312 | * Request that the PF disable all of our queues. |
| 313 | **/ |
| 314 | void i40evf_disable_queues(struct i40evf_adapter *adapter) |
| 315 | { |
| 316 | struct i40e_virtchnl_queue_select vqs; |
| 317 | |
| 318 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 319 | /* bail because we already have a command pending */ |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 320 | dev_err(&adapter->pdev->dev, "Cannot disable queues, command %d pending\n", |
| 321 | adapter->current_op); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 322 | return; |
| 323 | } |
| 324 | adapter->current_op = I40E_VIRTCHNL_OP_DISABLE_QUEUES; |
| 325 | vqs.vsi_id = adapter->vsi_res->vsi_id; |
Jesse Brandeburg | 41a1d04 | 2015-06-04 16:24:02 -0400 | [diff] [blame] | 326 | vqs.tx_queues = BIT(adapter->num_active_queues) - 1; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 327 | vqs.rx_queues = vqs.tx_queues; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 328 | adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_QUEUES; |
Mitch Williams | fc86a97 | 2014-06-04 20:41:38 +0000 | [diff] [blame] | 329 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DISABLE_QUEUES, |
| 330 | (u8 *)&vqs, sizeof(vqs)); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 331 | } |
| 332 | |
| 333 | /** |
| 334 | * i40evf_map_queues |
| 335 | * @adapter: adapter structure |
| 336 | * |
| 337 | * Request that the PF map queues to interrupt vectors. Misc causes, including |
| 338 | * admin queue, are always mapped to vector 0. |
| 339 | **/ |
| 340 | void i40evf_map_queues(struct i40evf_adapter *adapter) |
| 341 | { |
| 342 | struct i40e_virtchnl_irq_map_info *vimi; |
| 343 | int v_idx, q_vectors, len; |
| 344 | struct i40e_q_vector *q_vector; |
| 345 | |
| 346 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 347 | /* bail because we already have a command pending */ |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 348 | dev_err(&adapter->pdev->dev, "Cannot map queues to vectors, command %d pending\n", |
| 349 | adapter->current_op); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 350 | return; |
| 351 | } |
| 352 | adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP; |
| 353 | |
| 354 | q_vectors = adapter->num_msix_vectors - NONQ_VECS; |
| 355 | |
| 356 | len = sizeof(struct i40e_virtchnl_irq_map_info) + |
| 357 | (adapter->num_msix_vectors * |
| 358 | sizeof(struct i40e_virtchnl_vector_map)); |
Mitch Williams | a85088d | 2015-11-06 15:26:04 -0800 | [diff] [blame] | 359 | vimi = kzalloc(len, GFP_KERNEL); |
Mitch Williams | 249c8b8 | 2014-05-10 04:49:04 +0000 | [diff] [blame] | 360 | if (!vimi) |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 361 | return; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 362 | |
| 363 | vimi->num_vectors = adapter->num_msix_vectors; |
| 364 | /* Queue vectors first */ |
| 365 | for (v_idx = 0; v_idx < q_vectors; v_idx++) { |
Mitch Williams | 7d96ba1 | 2015-10-26 19:44:39 -0400 | [diff] [blame] | 366 | q_vector = adapter->q_vectors + v_idx; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 367 | vimi->vecmap[v_idx].vsi_id = adapter->vsi_res->vsi_id; |
| 368 | vimi->vecmap[v_idx].vector_id = v_idx + NONQ_VECS; |
| 369 | vimi->vecmap[v_idx].txq_map = q_vector->ring_mask; |
| 370 | vimi->vecmap[v_idx].rxq_map = q_vector->ring_mask; |
| 371 | } |
| 372 | /* Misc vector last - this is only for AdminQ messages */ |
| 373 | vimi->vecmap[v_idx].vsi_id = adapter->vsi_res->vsi_id; |
| 374 | vimi->vecmap[v_idx].vector_id = 0; |
| 375 | vimi->vecmap[v_idx].txq_map = 0; |
| 376 | vimi->vecmap[v_idx].rxq_map = 0; |
| 377 | |
Mitch Williams | fc86a97 | 2014-06-04 20:41:38 +0000 | [diff] [blame] | 378 | adapter->aq_required &= ~I40EVF_FLAG_AQ_MAP_VECTORS; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 379 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP, |
| 380 | (u8 *)vimi, len); |
| 381 | kfree(vimi); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 382 | } |
| 383 | |
| 384 | /** |
| 385 | * i40evf_add_ether_addrs |
| 386 | * @adapter: adapter structure |
| 387 | * @addrs: the MAC address filters to add (contiguous) |
| 388 | * @count: number of filters |
| 389 | * |
| 390 | * Request that the PF add one or more addresses to our filters. |
| 391 | **/ |
| 392 | void i40evf_add_ether_addrs(struct i40evf_adapter *adapter) |
| 393 | { |
| 394 | struct i40e_virtchnl_ether_addr_list *veal; |
| 395 | int len, i = 0, count = 0; |
| 396 | struct i40evf_mac_filter *f; |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 397 | bool more = false; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 398 | |
| 399 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 400 | /* bail because we already have a command pending */ |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 401 | dev_err(&adapter->pdev->dev, "Cannot add filters, command %d pending\n", |
| 402 | adapter->current_op); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 403 | return; |
| 404 | } |
| 405 | list_for_each_entry(f, &adapter->mac_filter_list, list) { |
| 406 | if (f->add) |
| 407 | count++; |
| 408 | } |
| 409 | if (!count) { |
| 410 | adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER; |
| 411 | return; |
| 412 | } |
| 413 | adapter->current_op = I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS; |
| 414 | |
| 415 | len = sizeof(struct i40e_virtchnl_ether_addr_list) + |
| 416 | (count * sizeof(struct i40e_virtchnl_ether_addr)); |
| 417 | if (len > I40EVF_MAX_AQ_BUF_SIZE) { |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 418 | dev_warn(&adapter->pdev->dev, "Too many add MAC changes in one request\n"); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 419 | count = (I40EVF_MAX_AQ_BUF_SIZE - |
| 420 | sizeof(struct i40e_virtchnl_ether_addr_list)) / |
| 421 | sizeof(struct i40e_virtchnl_ether_addr); |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 422 | len = sizeof(struct i40e_virtchnl_ether_addr_list) + |
| 423 | (count * sizeof(struct i40e_virtchnl_ether_addr)); |
| 424 | more = true; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 425 | } |
| 426 | |
Mitch Williams | a85088d | 2015-11-06 15:26:04 -0800 | [diff] [blame] | 427 | veal = kzalloc(len, GFP_KERNEL); |
Mitch Williams | 249c8b8 | 2014-05-10 04:49:04 +0000 | [diff] [blame] | 428 | if (!veal) |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 429 | return; |
Mitch Williams | 249c8b8 | 2014-05-10 04:49:04 +0000 | [diff] [blame] | 430 | |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 431 | veal->vsi_id = adapter->vsi_res->vsi_id; |
| 432 | veal->num_elements = count; |
| 433 | list_for_each_entry(f, &adapter->mac_filter_list, list) { |
| 434 | if (f->add) { |
Greg Rose | 9a17390 | 2014-05-22 06:32:02 +0000 | [diff] [blame] | 435 | ether_addr_copy(veal->list[i].addr, f->macaddr); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 436 | i++; |
| 437 | f->add = false; |
Mitch Williams | 0e8d95f89 | 2016-05-16 10:26:36 -0700 | [diff] [blame] | 438 | if (i == count) |
| 439 | break; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 440 | } |
| 441 | } |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 442 | if (!more) |
| 443 | adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 444 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS, |
| 445 | (u8 *)veal, len); |
| 446 | kfree(veal); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 447 | } |
| 448 | |
| 449 | /** |
| 450 | * i40evf_del_ether_addrs |
| 451 | * @adapter: adapter structure |
| 452 | * @addrs: the MAC address filters to remove (contiguous) |
| 453 | * @count: number of filtes |
| 454 | * |
| 455 | * Request that the PF remove one or more addresses from our filters. |
| 456 | **/ |
| 457 | void i40evf_del_ether_addrs(struct i40evf_adapter *adapter) |
| 458 | { |
| 459 | struct i40e_virtchnl_ether_addr_list *veal; |
| 460 | struct i40evf_mac_filter *f, *ftmp; |
| 461 | int len, i = 0, count = 0; |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 462 | bool more = false; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 463 | |
| 464 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 465 | /* bail because we already have a command pending */ |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 466 | dev_err(&adapter->pdev->dev, "Cannot remove filters, command %d pending\n", |
| 467 | adapter->current_op); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 468 | return; |
| 469 | } |
| 470 | list_for_each_entry(f, &adapter->mac_filter_list, list) { |
| 471 | if (f->remove) |
| 472 | count++; |
| 473 | } |
| 474 | if (!count) { |
| 475 | adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER; |
| 476 | return; |
| 477 | } |
| 478 | adapter->current_op = I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS; |
| 479 | |
| 480 | len = sizeof(struct i40e_virtchnl_ether_addr_list) + |
| 481 | (count * sizeof(struct i40e_virtchnl_ether_addr)); |
| 482 | if (len > I40EVF_MAX_AQ_BUF_SIZE) { |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 483 | dev_warn(&adapter->pdev->dev, "Too many delete MAC changes in one request\n"); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 484 | count = (I40EVF_MAX_AQ_BUF_SIZE - |
| 485 | sizeof(struct i40e_virtchnl_ether_addr_list)) / |
| 486 | sizeof(struct i40e_virtchnl_ether_addr); |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 487 | len = sizeof(struct i40e_virtchnl_ether_addr_list) + |
| 488 | (count * sizeof(struct i40e_virtchnl_ether_addr)); |
| 489 | more = true; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 490 | } |
Mitch Williams | a85088d | 2015-11-06 15:26:04 -0800 | [diff] [blame] | 491 | veal = kzalloc(len, GFP_KERNEL); |
Mitch Williams | 249c8b8 | 2014-05-10 04:49:04 +0000 | [diff] [blame] | 492 | if (!veal) |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 493 | return; |
Mitch Williams | 249c8b8 | 2014-05-10 04:49:04 +0000 | [diff] [blame] | 494 | |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 495 | veal->vsi_id = adapter->vsi_res->vsi_id; |
| 496 | veal->num_elements = count; |
| 497 | list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { |
| 498 | if (f->remove) { |
Greg Rose | 9a17390 | 2014-05-22 06:32:02 +0000 | [diff] [blame] | 499 | ether_addr_copy(veal->list[i].addr, f->macaddr); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 500 | i++; |
| 501 | list_del(&f->list); |
| 502 | kfree(f); |
Mitch Williams | 0e8d95f89 | 2016-05-16 10:26:36 -0700 | [diff] [blame] | 503 | if (i == count) |
| 504 | break; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 505 | } |
| 506 | } |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 507 | if (!more) |
| 508 | adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 509 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS, |
| 510 | (u8 *)veal, len); |
| 511 | kfree(veal); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 512 | } |
| 513 | |
| 514 | /** |
| 515 | * i40evf_add_vlans |
| 516 | * @adapter: adapter structure |
| 517 | * @vlans: the VLANs to add |
| 518 | * @count: number of VLANs |
| 519 | * |
| 520 | * Request that the PF add one or more VLAN filters to our VSI. |
| 521 | **/ |
| 522 | void i40evf_add_vlans(struct i40evf_adapter *adapter) |
| 523 | { |
| 524 | struct i40e_virtchnl_vlan_filter_list *vvfl; |
| 525 | int len, i = 0, count = 0; |
| 526 | struct i40evf_vlan_filter *f; |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 527 | bool more = false; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 528 | |
| 529 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 530 | /* bail because we already have a command pending */ |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 531 | dev_err(&adapter->pdev->dev, "Cannot add VLANs, command %d pending\n", |
| 532 | adapter->current_op); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 533 | return; |
| 534 | } |
| 535 | |
| 536 | list_for_each_entry(f, &adapter->vlan_filter_list, list) { |
| 537 | if (f->add) |
| 538 | count++; |
| 539 | } |
| 540 | if (!count) { |
| 541 | adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER; |
| 542 | return; |
| 543 | } |
| 544 | adapter->current_op = I40E_VIRTCHNL_OP_ADD_VLAN; |
| 545 | |
| 546 | len = sizeof(struct i40e_virtchnl_vlan_filter_list) + |
| 547 | (count * sizeof(u16)); |
| 548 | if (len > I40EVF_MAX_AQ_BUF_SIZE) { |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 549 | dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 550 | count = (I40EVF_MAX_AQ_BUF_SIZE - |
| 551 | sizeof(struct i40e_virtchnl_vlan_filter_list)) / |
| 552 | sizeof(u16); |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 553 | len = sizeof(struct i40e_virtchnl_vlan_filter_list) + |
| 554 | (count * sizeof(u16)); |
| 555 | more = true; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 556 | } |
Mitch Williams | a85088d | 2015-11-06 15:26:04 -0800 | [diff] [blame] | 557 | vvfl = kzalloc(len, GFP_KERNEL); |
Mitch Williams | 249c8b8 | 2014-05-10 04:49:04 +0000 | [diff] [blame] | 558 | if (!vvfl) |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 559 | return; |
Mitch Williams | 249c8b8 | 2014-05-10 04:49:04 +0000 | [diff] [blame] | 560 | |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 561 | vvfl->vsi_id = adapter->vsi_res->vsi_id; |
| 562 | vvfl->num_elements = count; |
| 563 | list_for_each_entry(f, &adapter->vlan_filter_list, list) { |
| 564 | if (f->add) { |
| 565 | vvfl->vlan_id[i] = f->vlan; |
| 566 | i++; |
| 567 | f->add = false; |
Mitch Williams | 0e8d95f89 | 2016-05-16 10:26:36 -0700 | [diff] [blame] | 568 | if (i == count) |
| 569 | break; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 570 | } |
| 571 | } |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 572 | if (!more) |
| 573 | adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER; |
Mitch Williams | fc86a97 | 2014-06-04 20:41:38 +0000 | [diff] [blame] | 574 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len); |
| 575 | kfree(vvfl); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 576 | } |
| 577 | |
| 578 | /** |
| 579 | * i40evf_del_vlans |
| 580 | * @adapter: adapter structure |
| 581 | * @vlans: the VLANs to remove |
| 582 | * @count: number of VLANs |
| 583 | * |
| 584 | * Request that the PF remove one or more VLAN filters from our VSI. |
| 585 | **/ |
| 586 | void i40evf_del_vlans(struct i40evf_adapter *adapter) |
| 587 | { |
| 588 | struct i40e_virtchnl_vlan_filter_list *vvfl; |
| 589 | struct i40evf_vlan_filter *f, *ftmp; |
| 590 | int len, i = 0, count = 0; |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 591 | bool more = false; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 592 | |
| 593 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 594 | /* bail because we already have a command pending */ |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 595 | dev_err(&adapter->pdev->dev, "Cannot remove VLANs, command %d pending\n", |
| 596 | adapter->current_op); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 597 | return; |
| 598 | } |
| 599 | |
| 600 | list_for_each_entry(f, &adapter->vlan_filter_list, list) { |
| 601 | if (f->remove) |
| 602 | count++; |
| 603 | } |
| 604 | if (!count) { |
| 605 | adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER; |
| 606 | return; |
| 607 | } |
| 608 | adapter->current_op = I40E_VIRTCHNL_OP_DEL_VLAN; |
| 609 | |
| 610 | len = sizeof(struct i40e_virtchnl_vlan_filter_list) + |
| 611 | (count * sizeof(u16)); |
| 612 | if (len > I40EVF_MAX_AQ_BUF_SIZE) { |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 613 | dev_warn(&adapter->pdev->dev, "Too many delete VLAN changes in one request\n"); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 614 | count = (I40EVF_MAX_AQ_BUF_SIZE - |
| 615 | sizeof(struct i40e_virtchnl_vlan_filter_list)) / |
| 616 | sizeof(u16); |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 617 | len = sizeof(struct i40e_virtchnl_vlan_filter_list) + |
| 618 | (count * sizeof(u16)); |
| 619 | more = true; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 620 | } |
Mitch Williams | a85088d | 2015-11-06 15:26:04 -0800 | [diff] [blame] | 621 | vvfl = kzalloc(len, GFP_KERNEL); |
Mitch Williams | 249c8b8 | 2014-05-10 04:49:04 +0000 | [diff] [blame] | 622 | if (!vvfl) |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 623 | return; |
Mitch Williams | 249c8b8 | 2014-05-10 04:49:04 +0000 | [diff] [blame] | 624 | |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 625 | vvfl->vsi_id = adapter->vsi_res->vsi_id; |
| 626 | vvfl->num_elements = count; |
| 627 | list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { |
| 628 | if (f->remove) { |
| 629 | vvfl->vlan_id[i] = f->vlan; |
| 630 | i++; |
| 631 | list_del(&f->list); |
| 632 | kfree(f); |
Mitch Williams | 0e8d95f89 | 2016-05-16 10:26:36 -0700 | [diff] [blame] | 633 | if (i == count) |
| 634 | break; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 635 | } |
| 636 | } |
Mitch Williams | 1418c34 | 2015-10-21 19:47:12 -0400 | [diff] [blame] | 637 | if (!more) |
| 638 | adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER; |
Mitch Williams | fc86a97 | 2014-06-04 20:41:38 +0000 | [diff] [blame] | 639 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len); |
| 640 | kfree(vvfl); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 641 | } |
| 642 | |
| 643 | /** |
| 644 | * i40evf_set_promiscuous |
| 645 | * @adapter: adapter structure |
| 646 | * @flags: bitmask to control unicast/multicast promiscuous. |
| 647 | * |
| 648 | * Request that the PF enable promiscuous mode for our VSI. |
| 649 | **/ |
| 650 | void i40evf_set_promiscuous(struct i40evf_adapter *adapter, int flags) |
| 651 | { |
| 652 | struct i40e_virtchnl_promisc_info vpi; |
Anjali Singhai Jain | f42a5c7 | 2016-05-03 15:13:10 -0700 | [diff] [blame] | 653 | int promisc_all; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 654 | |
| 655 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 656 | /* bail because we already have a command pending */ |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 657 | dev_err(&adapter->pdev->dev, "Cannot set promiscuous mode, command %d pending\n", |
| 658 | adapter->current_op); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 659 | return; |
| 660 | } |
Anjali Singhai Jain | 47d3483 | 2016-04-12 08:30:52 -0700 | [diff] [blame] | 661 | |
Anjali Singhai Jain | f42a5c7 | 2016-05-03 15:13:10 -0700 | [diff] [blame] | 662 | promisc_all = I40E_FLAG_VF_UNICAST_PROMISC | |
| 663 | I40E_FLAG_VF_MULTICAST_PROMISC; |
| 664 | if ((flags & promisc_all) == promisc_all) { |
Anjali Singhai Jain | 47d3483 | 2016-04-12 08:30:52 -0700 | [diff] [blame] | 665 | adapter->flags |= I40EVF_FLAG_PROMISC_ON; |
| 666 | adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_PROMISC; |
| 667 | dev_info(&adapter->pdev->dev, "Entering promiscuous mode\n"); |
Anjali Singhai Jain | f42a5c7 | 2016-05-03 15:13:10 -0700 | [diff] [blame] | 668 | } |
| 669 | |
| 670 | if (flags & I40E_FLAG_VF_MULTICAST_PROMISC) { |
| 671 | adapter->flags |= I40EVF_FLAG_ALLMULTI_ON; |
| 672 | adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_ALLMULTI; |
| 673 | dev_info(&adapter->pdev->dev, "Entering multicast promiscuous mode\n"); |
| 674 | } |
| 675 | |
| 676 | if (!flags) { |
Anjali Singhai Jain | 47d3483 | 2016-04-12 08:30:52 -0700 | [diff] [blame] | 677 | adapter->flags &= ~I40EVF_FLAG_PROMISC_ON; |
| 678 | adapter->aq_required &= ~I40EVF_FLAG_AQ_RELEASE_PROMISC; |
| 679 | dev_info(&adapter->pdev->dev, "Leaving promiscuous mode\n"); |
| 680 | } |
| 681 | |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 682 | adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE; |
| 683 | vpi.vsi_id = adapter->vsi_res->vsi_id; |
| 684 | vpi.flags = flags; |
| 685 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE, |
| 686 | (u8 *)&vpi, sizeof(vpi)); |
| 687 | } |
| 688 | |
| 689 | /** |
| 690 | * i40evf_request_stats |
| 691 | * @adapter: adapter structure |
| 692 | * |
| 693 | * Request VSI statistics from PF. |
| 694 | **/ |
| 695 | void i40evf_request_stats(struct i40evf_adapter *adapter) |
| 696 | { |
| 697 | struct i40e_virtchnl_queue_select vqs; |
Mitch Williams | 75a6443 | 2014-11-11 20:02:42 +0000 | [diff] [blame] | 698 | |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 699 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 700 | /* no error message, this isn't crucial */ |
| 701 | return; |
| 702 | } |
| 703 | adapter->current_op = I40E_VIRTCHNL_OP_GET_STATS; |
| 704 | vqs.vsi_id = adapter->vsi_res->vsi_id; |
| 705 | /* queue maps are ignored for this message - only the vsi is used */ |
| 706 | if (i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_GET_STATS, |
| 707 | (u8 *)&vqs, sizeof(vqs))) |
| 708 | /* if the request failed, don't lock out others */ |
| 709 | adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; |
| 710 | } |
Mitch Williams | 43a3d9b | 2016-04-12 08:30:44 -0700 | [diff] [blame] | 711 | |
| 712 | /** |
| 713 | * i40evf_get_hena |
| 714 | * @adapter: adapter structure |
| 715 | * |
| 716 | * Request hash enable capabilities from PF |
| 717 | **/ |
| 718 | void i40evf_get_hena(struct i40evf_adapter *adapter) |
| 719 | { |
| 720 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 721 | /* bail because we already have a command pending */ |
| 722 | dev_err(&adapter->pdev->dev, "Cannot get RSS hash capabilities, command %d pending\n", |
| 723 | adapter->current_op); |
| 724 | return; |
| 725 | } |
| 726 | adapter->current_op = I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS; |
| 727 | adapter->aq_required &= ~I40EVF_FLAG_AQ_GET_HENA; |
| 728 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS, |
| 729 | NULL, 0); |
| 730 | } |
| 731 | |
| 732 | /** |
| 733 | * i40evf_set_hena |
| 734 | * @adapter: adapter structure |
| 735 | * |
| 736 | * Request the PF to set our RSS hash capabilities |
| 737 | **/ |
| 738 | void i40evf_set_hena(struct i40evf_adapter *adapter) |
| 739 | { |
| 740 | struct i40e_virtchnl_rss_hena vrh; |
| 741 | |
| 742 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 743 | /* bail because we already have a command pending */ |
| 744 | dev_err(&adapter->pdev->dev, "Cannot set RSS hash enable, command %d pending\n", |
| 745 | adapter->current_op); |
| 746 | return; |
| 747 | } |
| 748 | vrh.hena = adapter->hena; |
| 749 | adapter->current_op = I40E_VIRTCHNL_OP_SET_RSS_HENA; |
| 750 | adapter->aq_required &= ~I40EVF_FLAG_AQ_SET_HENA; |
| 751 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_SET_RSS_HENA, |
| 752 | (u8 *)&vrh, sizeof(vrh)); |
| 753 | } |
| 754 | |
| 755 | /** |
| 756 | * i40evf_set_rss_key |
| 757 | * @adapter: adapter structure |
| 758 | * |
| 759 | * Request the PF to set our RSS hash key |
| 760 | **/ |
| 761 | void i40evf_set_rss_key(struct i40evf_adapter *adapter) |
| 762 | { |
| 763 | struct i40e_virtchnl_rss_key *vrk; |
| 764 | int len; |
| 765 | |
| 766 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 767 | /* bail because we already have a command pending */ |
| 768 | dev_err(&adapter->pdev->dev, "Cannot set RSS key, command %d pending\n", |
| 769 | adapter->current_op); |
| 770 | return; |
| 771 | } |
| 772 | len = sizeof(struct i40e_virtchnl_rss_key) + |
| 773 | (adapter->rss_key_size * sizeof(u8)) - 1; |
| 774 | vrk = kzalloc(len, GFP_KERNEL); |
| 775 | if (!vrk) |
| 776 | return; |
| 777 | vrk->vsi_id = adapter->vsi.id; |
| 778 | vrk->key_len = adapter->rss_key_size; |
| 779 | memcpy(vrk->key, adapter->rss_key, adapter->rss_key_size); |
| 780 | |
| 781 | adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_RSS_KEY; |
| 782 | adapter->aq_required &= ~I40EVF_FLAG_AQ_SET_RSS_KEY; |
| 783 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_RSS_KEY, |
| 784 | (u8 *)vrk, len); |
| 785 | kfree(vrk); |
| 786 | } |
| 787 | |
| 788 | /** |
| 789 | * i40evf_set_rss_lut |
| 790 | * @adapter: adapter structure |
| 791 | * |
| 792 | * Request the PF to set our RSS lookup table |
| 793 | **/ |
| 794 | void i40evf_set_rss_lut(struct i40evf_adapter *adapter) |
| 795 | { |
| 796 | struct i40e_virtchnl_rss_lut *vrl; |
| 797 | int len; |
| 798 | |
| 799 | if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { |
| 800 | /* bail because we already have a command pending */ |
| 801 | dev_err(&adapter->pdev->dev, "Cannot set RSS LUT, command %d pending\n", |
| 802 | adapter->current_op); |
| 803 | return; |
| 804 | } |
| 805 | len = sizeof(struct i40e_virtchnl_rss_lut) + |
| 806 | (adapter->rss_lut_size * sizeof(u8)) - 1; |
| 807 | vrl = kzalloc(len, GFP_KERNEL); |
| 808 | if (!vrl) |
| 809 | return; |
| 810 | vrl->vsi_id = adapter->vsi.id; |
| 811 | vrl->lut_entries = adapter->rss_lut_size; |
| 812 | memcpy(vrl->lut, adapter->rss_lut, adapter->rss_lut_size); |
| 813 | adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_RSS_LUT; |
| 814 | adapter->aq_required &= ~I40EVF_FLAG_AQ_SET_RSS_LUT; |
| 815 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_RSS_LUT, |
| 816 | (u8 *)vrl, len); |
| 817 | kfree(vrl); |
| 818 | } |
| 819 | |
Mitch Williams | 625777e | 2014-02-20 19:29:05 -0800 | [diff] [blame] | 820 | /** |
Mitch Williams | fe458e5 | 2016-08-04 11:37:02 -0700 | [diff] [blame] | 821 | * i40evf_print_link_message - print link up or down |
| 822 | * @adapter: adapter structure |
| 823 | * |
| 824 | * Log a message telling the world of our wonderous link status |
| 825 | */ |
| 826 | static void i40evf_print_link_message(struct i40evf_adapter *adapter) |
| 827 | { |
| 828 | struct net_device *netdev = adapter->netdev; |
| 829 | char *speed = "Unknown "; |
| 830 | |
| 831 | if (!adapter->link_up) { |
| 832 | netdev_info(netdev, "NIC Link is Down\n"); |
| 833 | return; |
| 834 | } |
| 835 | |
| 836 | switch (adapter->link_speed) { |
| 837 | case I40E_LINK_SPEED_40GB: |
| 838 | speed = "40 G"; |
| 839 | break; |
Carolyn Wyborny | 3123237 | 2016-11-21 13:03:48 -0800 | [diff] [blame] | 840 | case I40E_LINK_SPEED_25GB: |
| 841 | speed = "25 G"; |
| 842 | break; |
Mitch Williams | fe458e5 | 2016-08-04 11:37:02 -0700 | [diff] [blame] | 843 | case I40E_LINK_SPEED_20GB: |
| 844 | speed = "20 G"; |
| 845 | break; |
| 846 | case I40E_LINK_SPEED_10GB: |
| 847 | speed = "10 G"; |
| 848 | break; |
| 849 | case I40E_LINK_SPEED_1GB: |
| 850 | speed = "1000 M"; |
| 851 | break; |
| 852 | case I40E_LINK_SPEED_100MB: |
| 853 | speed = "100 M"; |
| 854 | break; |
| 855 | default: |
| 856 | break; |
| 857 | } |
| 858 | |
| 859 | netdev_info(netdev, "NIC Link is Up %sbps Full Duplex\n", speed); |
| 860 | } |
| 861 | |
| 862 | /** |
Mitch Williams | 625777e | 2014-02-20 19:29:05 -0800 | [diff] [blame] | 863 | * i40evf_request_reset |
| 864 | * @adapter: adapter structure |
| 865 | * |
| 866 | * Request that the PF reset this VF. No response is expected. |
| 867 | **/ |
| 868 | void i40evf_request_reset(struct i40evf_adapter *adapter) |
| 869 | { |
| 870 | /* Don't check CURRENT_OP - this is always higher priority */ |
| 871 | i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_RESET_VF, NULL, 0); |
| 872 | adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; |
| 873 | } |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 874 | |
| 875 | /** |
| 876 | * i40evf_virtchnl_completion |
| 877 | * @adapter: adapter structure |
| 878 | * @v_opcode: opcode sent by PF |
| 879 | * @v_retval: retval sent by PF |
| 880 | * @msg: message sent by PF |
| 881 | * @msglen: message length |
| 882 | * |
| 883 | * Asynchronous completion function for admin queue messages. Rather than busy |
| 884 | * wait, we fire off our requests and assume that no errors will be returned. |
| 885 | * This function handles the reply messages. |
| 886 | **/ |
| 887 | void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, |
| 888 | enum i40e_virtchnl_ops v_opcode, |
| 889 | i40e_status v_retval, |
| 890 | u8 *msg, u16 msglen) |
| 891 | { |
| 892 | struct net_device *netdev = adapter->netdev; |
| 893 | |
| 894 | if (v_opcode == I40E_VIRTCHNL_OP_EVENT) { |
| 895 | struct i40e_virtchnl_pf_event *vpe = |
| 896 | (struct i40e_virtchnl_pf_event *)msg; |
| 897 | switch (vpe->event) { |
| 898 | case I40E_VIRTCHNL_EVENT_LINK_CHANGE: |
Mitch Williams | fe458e5 | 2016-08-04 11:37:02 -0700 | [diff] [blame] | 899 | adapter->link_speed = |
| 900 | vpe->event_data.link_event.link_speed; |
| 901 | if (adapter->link_up != |
| 902 | vpe->event_data.link_event.link_status) { |
| 903 | adapter->link_up = |
| 904 | vpe->event_data.link_event.link_status; |
Sridhar Samudrala | 3f341ac | 2016-09-01 22:27:27 +0200 | [diff] [blame] | 905 | if (adapter->link_up) { |
| 906 | netif_tx_start_all_queues(netdev); |
| 907 | netif_carrier_on(netdev); |
| 908 | } else { |
| 909 | netif_tx_stop_all_queues(netdev); |
| 910 | netif_carrier_off(netdev); |
| 911 | } |
Mitch Williams | fe458e5 | 2016-08-04 11:37:02 -0700 | [diff] [blame] | 912 | i40evf_print_link_message(adapter); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 913 | } |
| 914 | break; |
| 915 | case I40E_VIRTCHNL_EVENT_RESET_IMPENDING: |
Mitch Williams | ef8693e | 2014-02-13 03:48:53 -0800 | [diff] [blame] | 916 | dev_info(&adapter->pdev->dev, "PF reset warning received\n"); |
| 917 | if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) { |
| 918 | adapter->flags |= I40EVF_FLAG_RESET_PENDING; |
| 919 | dev_info(&adapter->pdev->dev, "Scheduling reset task\n"); |
| 920 | schedule_work(&adapter->reset_task); |
| 921 | } |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 922 | break; |
| 923 | default: |
Shannon Nelson | fb43201f | 2015-08-26 15:14:17 -0400 | [diff] [blame] | 924 | dev_err(&adapter->pdev->dev, "Unknown event %d from PF\n", |
| 925 | vpe->event); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 926 | break; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 927 | } |
| 928 | return; |
| 929 | } |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 930 | if (v_retval) { |
Mitch Williams | 8d8f229 | 2015-10-21 19:47:11 -0400 | [diff] [blame] | 931 | switch (v_opcode) { |
| 932 | case I40E_VIRTCHNL_OP_ADD_VLAN: |
| 933 | dev_err(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n", |
| 934 | i40evf_stat_str(&adapter->hw, v_retval)); |
| 935 | break; |
| 936 | case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS: |
| 937 | dev_err(&adapter->pdev->dev, "Failed to add MAC filter, error %s\n", |
| 938 | i40evf_stat_str(&adapter->hw, v_retval)); |
| 939 | break; |
| 940 | case I40E_VIRTCHNL_OP_DEL_VLAN: |
| 941 | dev_err(&adapter->pdev->dev, "Failed to delete VLAN filter, error %s\n", |
| 942 | i40evf_stat_str(&adapter->hw, v_retval)); |
| 943 | break; |
| 944 | case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS: |
| 945 | dev_err(&adapter->pdev->dev, "Failed to delete MAC filter, error %s\n", |
| 946 | i40evf_stat_str(&adapter->hw, v_retval)); |
| 947 | break; |
| 948 | default: |
| 949 | dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n", |
| 950 | v_retval, |
| 951 | i40evf_stat_str(&adapter->hw, v_retval), |
| 952 | v_opcode); |
| 953 | } |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 954 | } |
| 955 | switch (v_opcode) { |
| 956 | case I40E_VIRTCHNL_OP_GET_STATS: { |
| 957 | struct i40e_eth_stats *stats = |
| 958 | (struct i40e_eth_stats *)msg; |
| 959 | adapter->net_stats.rx_packets = stats->rx_unicast + |
| 960 | stats->rx_multicast + |
| 961 | stats->rx_broadcast; |
| 962 | adapter->net_stats.tx_packets = stats->tx_unicast + |
| 963 | stats->tx_multicast + |
| 964 | stats->tx_broadcast; |
| 965 | adapter->net_stats.rx_bytes = stats->rx_bytes; |
| 966 | adapter->net_stats.tx_bytes = stats->tx_bytes; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 967 | adapter->net_stats.tx_errors = stats->tx_errors; |
Shannon Nelson | 03da6f6 | 2014-04-23 04:50:19 +0000 | [diff] [blame] | 968 | adapter->net_stats.rx_dropped = stats->rx_discards; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 969 | adapter->net_stats.tx_dropped = stats->tx_discards; |
| 970 | adapter->current_stats = *stats; |
| 971 | } |
| 972 | break; |
Mitch Williams | e6d038d | 2015-06-04 16:23:58 -0400 | [diff] [blame] | 973 | case I40E_VIRTCHNL_OP_GET_VF_RESOURCES: { |
| 974 | u16 len = sizeof(struct i40e_virtchnl_vf_resource) + |
| 975 | I40E_MAX_VF_VSI * |
| 976 | sizeof(struct i40e_virtchnl_vsi_resource); |
| 977 | memcpy(adapter->vf_res, msg, min(msglen, len)); |
| 978 | i40e_vf_parse_hw_config(&adapter->hw, adapter->vf_res); |
Mitch Williams | 8552d85 | 2015-08-31 19:54:51 -0400 | [diff] [blame] | 979 | /* restore current mac address */ |
| 980 | ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); |
Mitch Williams | e6d038d | 2015-06-04 16:23:58 -0400 | [diff] [blame] | 981 | i40evf_process_config(adapter); |
| 982 | } |
| 983 | break; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 984 | case I40E_VIRTCHNL_OP_ENABLE_QUEUES: |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 985 | /* enable transmits */ |
| 986 | i40evf_irq_enable(adapter, true); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 987 | break; |
| 988 | case I40E_VIRTCHNL_OP_DISABLE_QUEUES: |
Mitch Williams | e284fc8 | 2015-03-27 00:12:09 -0700 | [diff] [blame] | 989 | i40evf_free_all_tx_resources(adapter); |
| 990 | i40evf_free_all_rx_resources(adapter); |
Mitch Williams | 209dc4d | 2015-12-09 15:50:27 -0800 | [diff] [blame] | 991 | if (adapter->state == __I40EVF_DOWN_PENDING) |
| 992 | adapter->state = __I40EVF_DOWN; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 993 | break; |
Mitch Williams | ed63696 | 2015-04-07 19:45:32 -0400 | [diff] [blame] | 994 | case I40E_VIRTCHNL_OP_VERSION: |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 995 | case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP: |
Mitch Williams | ed63696 | 2015-04-07 19:45:32 -0400 | [diff] [blame] | 996 | /* Don't display an error if we get these out of sequence. |
| 997 | * If the firmware needed to get kicked, we'll get these and |
| 998 | * it's no problem. |
| 999 | */ |
| 1000 | if (v_opcode != adapter->current_op) |
| 1001 | return; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 1002 | break; |
Mitch Williams | ed0e894 | 2017-01-24 10:23:59 -0800 | [diff] [blame^] | 1003 | case I40E_VIRTCHNL_OP_IWARP: |
| 1004 | /* Gobble zero-length replies from the PF. They indicate that |
| 1005 | * a previous message was received OK, and the client doesn't |
| 1006 | * care about that. |
| 1007 | */ |
| 1008 | if (msglen && CLIENT_ENABLED(adapter)) |
| 1009 | i40evf_notify_client_message(&adapter->vsi, |
| 1010 | msg, msglen); |
| 1011 | break; |
| 1012 | |
Mitch Williams | e5f77f4 | 2017-02-09 23:35:18 -0800 | [diff] [blame] | 1013 | case I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP: |
| 1014 | adapter->client_pending &= |
| 1015 | ~(BIT(I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP)); |
| 1016 | break; |
Mitch Williams | 43a3d9b | 2016-04-12 08:30:44 -0700 | [diff] [blame] | 1017 | case I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS: { |
| 1018 | struct i40e_virtchnl_rss_hena *vrh = |
| 1019 | (struct i40e_virtchnl_rss_hena *)msg; |
| 1020 | if (msglen == sizeof(*vrh)) |
| 1021 | adapter->hena = vrh->hena; |
| 1022 | else |
| 1023 | dev_warn(&adapter->pdev->dev, |
| 1024 | "Invalid message %d from PF\n", v_opcode); |
| 1025 | } |
| 1026 | break; |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 1027 | default: |
Mitch Williams | ed0e894 | 2017-01-24 10:23:59 -0800 | [diff] [blame^] | 1028 | if (adapter->current_op && (v_opcode != adapter->current_op)) |
Mitch Williams | ed63696 | 2015-04-07 19:45:32 -0400 | [diff] [blame] | 1029 | dev_warn(&adapter->pdev->dev, "Expected response %d from PF, received %d\n", |
| 1030 | adapter->current_op, v_opcode); |
Greg Rose | 62683ab | 2013-12-21 06:13:01 +0000 | [diff] [blame] | 1031 | break; |
| 1032 | } /* switch v_opcode */ |
| 1033 | adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; |
| 1034 | } |