From patchwork Sun Mar 29 16:16:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Zolotarov X-Patchwork-Id: 455819 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id AABA11400DE for ; Mon, 30 Mar 2015 03:16:55 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E4CDF915D2 for ; Sun, 29 Mar 2015 16:16:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PYqM-MGc917l for ; Sun, 29 Mar 2015 16:16:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id E8FDD8D6CE for ; Sun, 29 Mar 2015 16:16:53 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id B900D1C2982 for ; Sun, 29 Mar 2015 16:16:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B53AE94D27 for ; Sun, 29 Mar 2015 16:16:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HJw+4zS7ru1D for ; Sun, 29 Mar 2015 16:16:51 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) by hemlock.osuosl.org (Postfix) with ESMTPS id 8C0C094D26 for ; Sun, 29 Mar 2015 16:16:51 +0000 (UTC) Received: by wgbdm7 with SMTP id dm7so40297197wgb.1 for ; Sun, 29 Mar 2015 09:16:50 -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=IQelgyselc92H/tYem5N4o2IoT+FSxCfPQ0Zc5QWEa4=; b=Ppar/TvN6Pg7KNXvJ1lHULUcUfLWPWjzvhaVYPwL+MssTVpHXorR299hLrumn3R93X E4WdP3I14JK6ll86dpoC0QAXFJwqyXttWHwnFBv8QlCjC2hRgQFFyjdVqhN/Qg9+E/lh ZkW4vFQcHd+0caTeKbN0D8XjgqTsnmqwFeiLAWfuZVXUY+up56yvUgrPOlyPzgTZkUV7 9IpHheBiQZa89AQcT1w7kvggC/ptDwJVuXj513/bSQnDeii2qUnA/CzkgDeT9liMhUhW ng0MjuBhON2JfIkwuzfaaFdkGaB0iEVaeY/vxWevHUELu67+cjzQNR/WRBW4Jag1JY6u HYWw== X-Gm-Message-State: ALoCoQl1nKYIrtNZjsPzRhp6Gf5xsuImHntE4mQnob7ePZw83uV/cTcXvGWtFKLmvtcM/BSCtsL+ X-Received: by 10.180.109.70 with SMTP id hq6mr14366208wib.16.1427645810227; Sun, 29 Mar 2015 09:16:50 -0700 (PDT) Received: from vladz-laptop.cloudius-systems.com. ([212.143.139.214]) by mx.google.com with ESMTPSA id gy9sm2471285wib.12.2015.03.29.09.16.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Mar 2015 09:16:49 -0700 (PDT) From: Vlad Zolotarov To: intel-wired-lan@lists.osuosl.org Date: Sun, 29 Mar 2015 19:16:35 +0300 Message-Id: <1427645797-10832-6-git-send-email-vladz@cloudius-systems.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1427645797-10832-1-git-send-email-vladz@cloudius-systems.com> References: <1427645797-10832-1-git-send-email-vladz@cloudius-systems.com> Subject: [Intel-wired-lan] [PATCH net-next v9 5/7] ixgbe: Add GET_RSS_KEY command to VF-PF channel commands set X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" For 82599 and x540 VFs and PF share the same RSS Key. Therefore we will return the same RSS key for all VFs. Support for other devices will be added later. Signed-off-by: Vlad Zolotarov --- New in v9: - Reduce the support to 82599 and x540 devices only. - Get rid of registers access in GET_VF_RSS_KEY flow: - Get the RSS HASH Key value from the PF's adapter->rss_key[]. 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 | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h index 3522f53..b1e4703 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h @@ -100,6 +100,7 @@ enum ixgbe_pfvf_api_rev { /* mailbox API, version 1.2 VF requests */ #define IXGBE_VF_GET_RETA 0x0a /* VF request for 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 diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 8424e7f..4d87458 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -996,6 +996,28 @@ 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; + 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. + * We only support 82599 and x540 devices at the moment. + */ + if (hw->mac.type >= ixgbe_mac_X550) + return -1; + + memcpy(rss_key, adapter->rss_key, sizeof(adapter->rss_key)); + + return 0; +} + static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) { u32 mbx_size = IXGBE_VFMAILBOX_SIZE; @@ -1055,6 +1077,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;