diff options
author | Vlad Zolotarov <vladz@cloudius-systems.com> | 2015-03-30 14:35:28 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2015-04-11 14:39:19 -0400 |
commit | ad1431e2db5590bcc32ded8a27b3b5c0ced9add7 (patch) | |
tree | e8baa876c22344b4f5d3a3de072c3962e47b2afe /drivers/net/ethernet/intel/ixgbevf | |
parent | 3c0841a9229d9d3c33bab06b661314b82896c2d9 (diff) |
ixgbevf: Add RSS Key query code
Add the ixgbevf_get_rss_key() function that queries the PF for an RSS
Random Key using a new VF-PF channel IXGBE_VF_GET_RSS_KEY command.
This patch adds the support for 82599 and x540 devices only. Support for
other devices will be added later.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ixgbevf')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/mbx.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/vf.c | 54 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/vf.h | 1 |
4 files changed, 57 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h index 0cea5e942494..775d08900949 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | |||
@@ -146,6 +146,7 @@ struct ixgbevf_ring { | |||
146 | #define MAX_TX_QUEUES IXGBE_VF_MAX_TX_QUEUES | 146 | #define MAX_TX_QUEUES IXGBE_VF_MAX_TX_QUEUES |
147 | #define IXGBEVF_MAX_RSS_QUEUES 2 | 147 | #define IXGBEVF_MAX_RSS_QUEUES 2 |
148 | #define IXGBEVF_82599_RETA_SIZE 128 | 148 | #define IXGBEVF_82599_RETA_SIZE 128 |
149 | #define IXGBEVF_RSS_HASH_KEY_SIZE 40 | ||
149 | 150 | ||
150 | #define IXGBEVF_DEFAULT_TXD 1024 | 151 | #define IXGBEVF_DEFAULT_TXD 1024 |
151 | #define IXGBEVF_DEFAULT_RXD 512 | 152 | #define IXGBEVF_DEFAULT_RXD 512 |
diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.h b/drivers/net/ethernet/intel/ixgbevf/mbx.h index 66e138b4908d..82f44e06e5fc 100644 --- a/drivers/net/ethernet/intel/ixgbevf/mbx.h +++ b/drivers/net/ethernet/intel/ixgbevf/mbx.h | |||
@@ -110,6 +110,7 @@ enum ixgbe_pfvf_api_rev { | |||
110 | 110 | ||
111 | /* mailbox API, version 1.2 VF requests */ | 111 | /* mailbox API, version 1.2 VF requests */ |
112 | #define IXGBE_VF_GET_RETA 0x0a /* VF request for RETA */ | 112 | #define IXGBE_VF_GET_RETA 0x0a /* VF request for RETA */ |
113 | #define IXGBE_VF_GET_RSS_KEY 0x0b /* get RSS hash key */ | ||
113 | 114 | ||
114 | /* length of permanent address message returned from PF */ | 115 | /* length of permanent address message returned from PF */ |
115 | #define IXGBE_VF_PERMADDR_MSG_LEN 4 | 116 | #define IXGBE_VF_PERMADDR_MSG_LEN 4 |
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c index 7e43f88accc9..d1339b050627 100644 --- a/drivers/net/ethernet/intel/ixgbevf/vf.c +++ b/drivers/net/ethernet/intel/ixgbevf/vf.c | |||
@@ -326,6 +326,60 @@ int ixgbevf_get_reta_locked(struct ixgbe_hw *hw, u32 *reta, int num_rx_queues) | |||
326 | } | 326 | } |
327 | 327 | ||
328 | /** | 328 | /** |
329 | * ixgbevf_get_rss_key_locked - get the RSS Random Key | ||
330 | * @hw: pointer to the HW structure | ||
331 | * @rss_key: buffer to fill with RSS Hash Key contents. | ||
332 | * | ||
333 | * The "rss_key" buffer should be big enough to contain 10 registers. | ||
334 | * | ||
335 | * Returns: 0 on success. | ||
336 | * if API doesn't support this operation - (-EOPNOTSUPP). | ||
337 | */ | ||
338 | int ixgbevf_get_rss_key_locked(struct ixgbe_hw *hw, u8 *rss_key) | ||
339 | { | ||
340 | int err; | ||
341 | u32 msgbuf[IXGBE_VFMAILBOX_SIZE]; | ||
342 | |||
343 | /* We currently support the RSS Random Key retrieval for 82599 and x540 | ||
344 | * devices only. | ||
345 | * | ||
346 | * Thus return an error if API doesn't support RSS Random Key retrieval | ||
347 | * or if the operation is not supported for this device type. | ||
348 | */ | ||
349 | if (hw->api_version != ixgbe_mbox_api_12 || | ||
350 | hw->mac.type >= ixgbe_mac_X550_vf) | ||
351 | return -EOPNOTSUPP; | ||
352 | |||
353 | msgbuf[0] = IXGBE_VF_GET_RSS_KEY; | ||
354 | err = hw->mbx.ops.write_posted(hw, msgbuf, 1); | ||
355 | |||
356 | if (err) | ||
357 | return err; | ||
358 | |||
359 | err = hw->mbx.ops.read_posted(hw, msgbuf, 11); | ||
360 | |||
361 | if (err) | ||
362 | return err; | ||
363 | |||
364 | msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; | ||
365 | |||
366 | /* If the operation has been refused by a PF return -EPERM */ | ||
367 | if (msgbuf[0] == (IXGBE_VF_GET_RETA | IXGBE_VT_MSGTYPE_NACK)) | ||
368 | return -EPERM; | ||
369 | |||
370 | /* If we didn't get an ACK there must have been | ||
371 | * some sort of mailbox error so we should treat it | ||
372 | * as such. | ||
373 | */ | ||
374 | if (msgbuf[0] != (IXGBE_VF_GET_RSS_KEY | IXGBE_VT_MSGTYPE_ACK)) | ||
375 | return IXGBE_ERR_MBX; | ||
376 | |||
377 | memcpy(rss_key, msgbuf + 1, IXGBEVF_RSS_HASH_KEY_SIZE); | ||
378 | |||
379 | return 0; | ||
380 | } | ||
381 | |||
382 | /** | ||
329 | * ixgbevf_set_rar_vf - set device MAC address | 383 | * ixgbevf_set_rar_vf - set device MAC address |
330 | * @hw: pointer to hardware structure | 384 | * @hw: pointer to hardware structure |
331 | * @index: Receive address register to write | 385 | * @index: Receive address register to write |
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h index e17f9eb47b78..d40f036b6df0 100644 --- a/drivers/net/ethernet/intel/ixgbevf/vf.h +++ b/drivers/net/ethernet/intel/ixgbevf/vf.h | |||
@@ -211,4 +211,5 @@ int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api); | |||
211 | int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, | 211 | int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, |
212 | unsigned int *default_tc); | 212 | unsigned int *default_tc); |
213 | int ixgbevf_get_reta_locked(struct ixgbe_hw *hw, u32 *reta, int num_rx_queues); | 213 | int ixgbevf_get_reta_locked(struct ixgbe_hw *hw, u32 *reta, int num_rx_queues); |
214 | int ixgbevf_get_rss_key_locked(struct ixgbe_hw *hw, u8 *rss_key); | ||
214 | #endif /* __IXGBE_VF_H__ */ | 215 | #endif /* __IXGBE_VF_H__ */ |