From patchwork Mon May 18 16:18:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Fastabend X-Patchwork-Id: 473464 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com 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 B686D1401B5 for ; Tue, 19 May 2015 02:19:29 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=c3g0W7BP; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 141A88D10A; Mon, 18 May 2015 16:19:29 +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 vHkpYFw3lZVW; Mon, 18 May 2015 16:19:28 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 7A3DA8CB01; Mon, 18 May 2015 16:19:28 +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 CB4191C0847 for ; Mon, 18 May 2015 16:19:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C0C2795200 for ; Mon, 18 May 2015 16:19:27 +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 QVVOQ1doQJkb for ; Mon, 18 May 2015 16:19:25 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ob0-f194.google.com (mail-ob0-f194.google.com [209.85.214.194]) by hemlock.osuosl.org (Postfix) with ESMTPS id 44FA8951FF for ; Mon, 18 May 2015 16:19:25 +0000 (UTC) Received: by obcwm4 with SMTP id wm4so589203obc.2 for ; Mon, 18 May 2015 09:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:cc:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=/Wj243cTi5sCtBPqQx6OPVdykjjkDyrkyqzayMaL0Bg=; b=c3g0W7BPtqm2MIJLlirKi/jYJrIqFqZk3PBPUtuwwrucQmGHEJwAZidT6D3zWYqI2L ns0sZOMx597nU+34OV4QgZmLpqoZLI4x+21OfTEypar7xMtr+g2aEJBeYDRjP5KzM17Q cgYY79392bgFRRreIipiVTKZr8b5Ljth5dTrWWJpm2b3KDusuyyWQcRKjm1yr7JYT6tO fWwtFHhJsyOcfHZ/lLKcpmzu1uIk+eGnezLzR+mXpCZ/7uf4CaMWVeL4PNW05te1sxqJ dn/c8L6EWIEsGf6NR/1SO+QHuN8qy99bMmPylfT0PNTntDbkLEOXJehGZiFUVs/4PjmH g33w== X-Received: by 10.202.57.137 with SMTP id g131mr10863047oia.122.1431965963887; Mon, 18 May 2015 09:19:23 -0700 (PDT) Received: from nitbit.x32 ([72.168.134.52]) by mx.google.com with ESMTPSA id kw2sm6481368obb.24.2015.05.18.09.19.17 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 18 May 2015 09:19:23 -0700 (PDT) From: John Fastabend X-Google-Original-From: John Fastabend To: alexander.h.duyck@redhat.com Date: Mon, 18 May 2015 09:18:58 -0700 Message-ID: <20150518161847.8927.65430.stgit@nitbit.x32> User-Agent: StGit/0.16 MIME-Version: 1.0 Cc: intel-wired-lan@lists.osuosl.org Subject: [Intel-wired-lan] [net-next PATCH v4 1/2] ethtool: Add helper routines to pass vf to rx_flow_spec 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: , Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" The ring_cookie is 64 bits wide which is much larger than can be used for actual queue index values. So provide some helper routines to pack a VF index into the cookie. This is useful to steer packets to a VF ring without having to know the queue layout of the device. Signed-off-by: John Fastabend Signed-off-by: John Fastabend Tested-by: Krishneil Singh --- include/uapi/linux/ethtool.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index 2e49fc8..b5b4287 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -796,6 +796,31 @@ struct ethtool_rx_flow_spec { __u32 location; }; +/* How rings are layed out when accessing virtual functions or + * offloaded queues is device specific. To allow users to do flow + * steering and specify these queues the ring cookie is partitioned + * into a 32bit queue index with an 8 bit virtual function id. + * This also leaves the 3bytes for further specifiers. It is possible + * future devices may support more than 256 virtual functions if + * devices start supporting PCIe w/ARI. However at the moment I + * do not know of any devices that support this so I do not reserve + * space for this at this time. If a future patch consumes the next + * byte it should be aware of this possiblity. + */ +#define ETHTOOL_RX_FLOW_SPEC_RING 0x00000000FFFFFFFF +#define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000 +#define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32 +static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie) +{ + return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie; +}; + +static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) +{ + return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >> + ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF; +}; + /** * struct ethtool_rxnfc - command to get or set RX flow classification rules * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,