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