|
@@ -325,6 +325,60 @@ int ixgbevf_get_reta_locked(struct ixgbe_hw *hw, u32 *reta, int num_rx_queues)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * ixgbevf_get_rss_key_locked - get the RSS Random Key
|
|
|
+ * @hw: pointer to the HW structure
|
|
|
+ * @rss_key: buffer to fill with RSS Hash Key contents.
|
|
|
+ *
|
|
|
+ * The "rss_key" buffer should be big enough to contain 10 registers.
|
|
|
+ *
|
|
|
+ * Returns: 0 on success.
|
|
|
+ * if API doesn't support this operation - (-EOPNOTSUPP).
|
|
|
+ */
|
|
|
+int ixgbevf_get_rss_key_locked(struct ixgbe_hw *hw, u8 *rss_key)
|
|
|
+{
|
|
|
+ int err;
|
|
|
+ u32 msgbuf[IXGBE_VFMAILBOX_SIZE];
|
|
|
+
|
|
|
+ /* We currently support the RSS Random Key retrieval for 82599 and x540
|
|
|
+ * devices only.
|
|
|
+ *
|
|
|
+ * Thus return an error if API doesn't support RSS Random Key retrieval
|
|
|
+ * or if the operation is not supported for this device type.
|
|
|
+ */
|
|
|
+ if (hw->api_version != ixgbe_mbox_api_12 ||
|
|
|
+ hw->mac.type >= ixgbe_mac_X550_vf)
|
|
|
+ return -EOPNOTSUPP;
|
|
|
+
|
|
|
+ msgbuf[0] = IXGBE_VF_GET_RSS_KEY;
|
|
|
+ err = hw->mbx.ops.write_posted(hw, msgbuf, 1);
|
|
|
+
|
|
|
+ if (err)
|
|
|
+ return err;
|
|
|
+
|
|
|
+ err = hw->mbx.ops.read_posted(hw, msgbuf, 11);
|
|
|
+
|
|
|
+ if (err)
|
|
|
+ return err;
|
|
|
+
|
|
|
+ msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
|
|
|
+
|
|
|
+ /* If the operation has been refused by a PF return -EPERM */
|
|
|
+ if (msgbuf[0] == (IXGBE_VF_GET_RETA | IXGBE_VT_MSGTYPE_NACK))
|
|
|
+ return -EPERM;
|
|
|
+
|
|
|
+ /* If we didn't get an ACK there must have been
|
|
|
+ * some sort of mailbox error so we should treat it
|
|
|
+ * as such.
|
|
|
+ */
|
|
|
+ if (msgbuf[0] != (IXGBE_VF_GET_RSS_KEY | IXGBE_VT_MSGTYPE_ACK))
|
|
|
+ return IXGBE_ERR_MBX;
|
|
|
+
|
|
|
+ memcpy(rss_key, msgbuf + 1, IXGBEVF_RSS_HASH_KEY_SIZE);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* ixgbevf_set_rar_vf - set device MAC address
|
|
|
* @hw: pointer to hardware structure
|