From patchwork Tue Mar 24 13:05:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Zolotarov X-Patchwork-Id: 453816 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A2171140082 for ; Wed, 25 Mar 2015 00:06:12 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752504AbbCXNGK (ORCPT ); Tue, 24 Mar 2015 09:06:10 -0400 Received: from mail-we0-f179.google.com ([74.125.82.179]:34194 "EHLO mail-we0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752347AbbCXNGA (ORCPT ); Tue, 24 Mar 2015 09:06:00 -0400 Received: by wegp1 with SMTP id p1so162763511weg.1 for ; Tue, 24 Mar 2015 06:05:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ln3PEs39LKbgQheD3p2HhVakjpMrH/iFUW14eKdsdoY=; b=mVNvSdvU9mX58FdAZ96lSNoUfBQXC78hXwwgZ1HuFZEn+/yVAzMAfWeeYZOLatYTYS 4g1ByfI/7UIF224qsBXE6qYHU0w+i49OUeS20v0ENKJOTbzX8HJ+gsj4//5UJp2EGl5Y RrI/QA5/OYvLu4xwofiFdeOreIzbTbYjGOWkbg2UvMojqT4XB6RTh/ZPGqnu5pHAwLPP 7ukWqIrYbg4K1RiJGn7DU7Is7tDeRQZGwGJ4KOReSmMVeZAVG1B+ncBMBwrWCsNDl5iD 6NKZs1u7eMQr9bd+71nK8WhQliF1v3rodcAOCe8WoDeCftZzpKCJQl32vgKWvUZiPm7z 8iNA== X-Gm-Message-State: ALoCoQnL1qVR087WRLpT4EZqw5Yl9zZD8korowCKqMysxhmPJ0sCvix4rVxXEmYH/jLJIdRmDbzL X-Received: by 10.194.90.210 with SMTP id by18mr7727402wjb.80.1427202359046; Tue, 24 Mar 2015 06:05:59 -0700 (PDT) Received: from vladz-laptop.cloudius-systems.com. (system.cloudius-systems.com. [84.94.198.183]) by mx.google.com with ESMTPSA id dj4sm6049570wjc.13.2015.03.24.06.05.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Mar 2015 06:05:58 -0700 (PDT) From: Vlad Zolotarov To: netdev@vger.kernel.org Cc: jeffrey.t.kirsher@intel.com, avi@cloudius-systems.com, gleb@cloudius-systems.com, Vlad Zolotarov Subject: [PATCH net-next v7 5/7] ixgbe: Add GET_RSS_KEY command to VF-PF channel commands set Date: Tue, 24 Mar 2015 15:05:44 +0200 Message-Id: <1427202346-12502-6-git-send-email-vladz@cloudius-systems.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1427202346-12502-1-git-send-email-vladz@cloudius-systems.com> References: <1427202346-12502-1-git-send-email-vladz@cloudius-systems.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For 82599 and x540 VFs and PF share the same RSS Key. Therefore we will return the same RSS key for all VFs. x550 on the other hand has a separate RSS Key for every pool. Signed-off-by: Vlad Zolotarov --- New in v5: - Use a newly added netdev op to allow/prevent the RSS Hash Key querying on a per-VF basis. New in v3: - Added a support for x550 devices. New in v1 (compared to RFC): - Use "if-else" statement instead of a "switch-case" for a single option case (in ixgbe_get_vf_rss_key()). --- drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h | 2 ++ drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 27 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h index f9b5eae..3f14373 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h @@ -105,6 +105,8 @@ enum ixgbe_pfvf_api_rev { #define IXGBE_VF_RETA_SZ 1 /* Number of RETA DWs to bring */ #define IXGBE_VF_RETA_OFFSET 2 /* Offset in RETA */ +#define IXGBE_VF_GET_RSS_KEY 0x0b /* get RSS key */ + /* length of permanent address message returned from PF */ #define IXGBE_VF_PERMADDR_MSG_LEN 4 /* word in permanent address message with the current multicast type */ diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 301bb1b..78517a1 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -1016,6 +1016,30 @@ static int ixgbe_get_vf_reta(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) return 0; } +static int ixgbe_get_vf_rss_key(struct ixgbe_adapter *adapter, + u32 *msgbuf, u32 vf) +{ + struct ixgbe_hw *hw = &adapter->hw; + int i; + u32 *rss_key = &msgbuf[1]; + + /* verify the PF is supporting the correct API */ + if (!adapter->vfinfo[vf].rss_query_enabled || + (adapter->vfinfo[vf].vf_api != ixgbe_mbox_api_12)) + return -EPERM; + + /* Read the RSS KEY */ + if (hw->mac.type >= ixgbe_mac_X550) { + for (i = 0; i < 10; i++) + rss_key[i] = IXGBE_READ_REG(hw, + IXGBE_PFVFRSSRK(i, vf)); + } else + for (i = 0; i < 10; i++) + rss_key[i] = IXGBE_READ_REG(hw, IXGBE_RSSRK(i)); + + return 0; +} + static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) { u32 mbx_size = IXGBE_VFMAILBOX_SIZE; @@ -1075,6 +1099,9 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) case IXGBE_VF_GET_RETA: retval = ixgbe_get_vf_reta(adapter, msgbuf, vf); break; + case IXGBE_VF_GET_RSS_KEY: + retval = ixgbe_get_vf_rss_key(adapter, msgbuf, vf); + break; default: e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]); retval = IXGBE_ERR_MBX;