From patchwork Mon Jan 5 14:46:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Zolotarov X-Patchwork-Id: 425344 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 EC5C1140081 for ; Tue, 6 Jan 2015 01:47:02 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754009AbbAEOq5 (ORCPT ); Mon, 5 Jan 2015 09:46:57 -0500 Received: from mail-wi0-f179.google.com ([209.85.212.179]:42953 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753804AbbAEOq4 (ORCPT ); Mon, 5 Jan 2015 09:46:56 -0500 Received: by mail-wi0-f179.google.com with SMTP id ex7so3437730wid.6 for ; Mon, 05 Jan 2015 06:46:55 -0800 (PST) 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=acJeK0ZVdz2V2PbVdB2W7NqcBn9Em0pS23mNwQxXEUo=; b=Kc1u66RQdNidpAGtLL8NdDQ0Ggvs3LTj2cE/dmRRoc+j0Ql+tK4ycnGHMUR4F0Z+Nw 248b1utc4Ne6KQQmBL9fqbhFo+hBWiyXiDnnSIyOhkVEbMeZgx2VcyDrAfm2C/rw6Wtv Oh9c54YwrzGdi99S3/Co67WmObsRkHmIX+Xr/dPAwA7ZkHUGGAJBvvFr4izRo3nI8fzW ttHSMaNXPYzzMcEpg6A8InJ8MeGfETd0ZsMQrgfSSjZoIMFE2lmbfh69kEWKPa+ANUWC KzTFZ2MHyBLsu7+rYSb2JaZeurFKUmQp1YoBnIacLZshfYA8dXUUXMTe5deid4elahbO xORw== X-Gm-Message-State: ALoCoQnLaJnettHqTFlnEDgf1vgNpwUSn0Pk8VO6oE+k2QHdZGPzVZfxcnRqcCpR5QDXWXuDVqW6 X-Received: by 10.180.24.167 with SMTP id v7mr26928653wif.5.1420469214240; Mon, 05 Jan 2015 06:46:54 -0800 (PST) Received: from vladz-laptop.cloudius-systems.com. (system.cloudius-systems.com. [84.94.198.183]) by mx.google.com with ESMTPSA id hn2sm75697066wjc.5.2015.01.05.06.46.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jan 2015 06:46:53 -0800 (PST) From: Vlad Zolotarov To: netdev@vger.kernel.org Cc: gleb@cloudius-systems.com, avi@cloudius-systems.com, jeffrey.t.kirsher@intel.com, Vlad Zolotarov Subject: [PATCH net-next v4 3/5] ixgbe: Add GET_RSS_KEY command to VF-PF channel commands set Date: Mon, 5 Jan 2015 16:46:40 +0200 Message-Id: <1420469202-1847-4-git-send-email-vladz@cloudius-systems.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1420469202-1847-1-git-send-email-vladz@cloudius-systems.com> References: <1420469202-1847-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 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 | 26 ++++++++++++++++++++++++++ 2 files changed, 28 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 8d6ebb3..d29cd36 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -1005,6 +1005,29 @@ 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].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; @@ -1064,6 +1087,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;