From patchwork Tue May 26 15:22:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Fastabend X-Patchwork-Id: 476511 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 1FF8414027C for ; Wed, 27 May 2015 01:23:20 +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=wShVYl01; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4A87A334AD; Tue, 26 May 2015 15:23:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mfUZzpsOzJ79; Tue, 26 May 2015 15:23:18 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 5CEC03345D; Tue, 26 May 2015 15:23:18 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id AC2C71C2236 for ; Tue, 26 May 2015 15:23:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A6360919C0 for ; Tue, 26 May 2015 15:23:16 +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 huAT3CXN1GhP for ; Tue, 26 May 2015 15:23:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ob0-f177.google.com (mail-ob0-f177.google.com [209.85.214.177]) by whitealder.osuosl.org (Postfix) with ESMTPS id 27B0F919BF for ; Tue, 26 May 2015 15:23:15 +0000 (UTC) Received: by obbnx5 with SMTP id nx5so77019646obb.0 for ; Tue, 26 May 2015 08:23:14 -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=cjdSErI/2YKCz5tqdr2IOBmQLfOHuisFir9qS2NZQ7M=; b=wShVYl01ilg+4B0FWyHpC8VnEQmsewe0ilCW5ZoA9GeB9/kYwR1nOXRY1xTCqQwmgL GALq4G7h2wSIoW43tIJ297hR7kznevaaMrpgZbn+p/QMhCM3XMi7IIm+dh+laqjx1xED zP88aF0WHnXsTWI8cDGpu5MD2D3IW0No6j5jNFgJ8XQkXr4OwndO4t/JYRMMzb6Mz55K 2KLuisul/kBe14qvoj0lW1QE84CfKCUEXGolH9EbpninheBSVkIi16Q/NiwzGd21RibR Ot9GcJidEBF023mJEGSzSngdrQ8m6mR0+k7P3tbtVY1pvMBYn4/ZUNEjCaWxIgGMBjkS IHtw== X-Received: by 10.60.62.105 with SMTP id x9mr22040634oer.1.1432653794635; Tue, 26 May 2015 08:23:14 -0700 (PDT) Received: from nitbit.x32 ([72.168.133.140]) by mx.google.com with ESMTPSA id x9sm6911506oev.17.2015.05.26.08.23.09 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 26 May 2015 08:23:14 -0700 (PDT) From: John Fastabend X-Google-Original-From: John Fastabend To: alexander.h.duyck@redhat.com Date: Tue, 26 May 2015 08:22:49 -0700 Message-ID: <20150526152231.29428.81833.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 v5 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 --- 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..e367dfe 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 0x00000000FFFFFFFFLL +#define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000LL +#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,