From patchwork Mon May 18 15:31:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Fastabend X-Patchwork-Id: 473438 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 4916E14027F for ; Tue, 19 May 2015 01:32:26 +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=Xmhw3PQi; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8EF7932DDB; Mon, 18 May 2015 15:32:25 +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 qfmI5ZUFc7a0; Mon, 18 May 2015 15:32:24 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 913C230D7B; Mon, 18 May 2015 15:32:24 +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 B0A5A1C0EC7 for ; Mon, 18 May 2015 15:32:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A736A8C33D for ; Mon, 18 May 2015 15:32:23 +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 EQ5cElWpMSsy for ; Mon, 18 May 2015 15:32:22 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ob0-f195.google.com (mail-ob0-f195.google.com [209.85.214.195]) by whitealder.osuosl.org (Postfix) with ESMTPS id 8BED58C0F2 for ; Mon, 18 May 2015 15:32:21 +0000 (UTC) Received: by obbgq1 with SMTP id gq1so349236obb.0 for ; Mon, 18 May 2015 08:32:20 -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=E38MIw0oU1Oibt+v07ZCq0HW8UHvhnK1qNFzF6i1aNE=; b=Xmhw3PQiVfcDpTSOvW5dLltgrxau8IEWSy+crzRT1iiGDo8RIEs4MK+Uzic+oLVN0k FbsGsn41iSVT6zlJlOAVcfkVfVECsLsao4ew08ANDyIGxKJvRKhkJXCERGUf5P+rlLTE ygw7UNczGaAmmz4hjkDaKpIUXPKuJQ/lGtAcrlw0A3Qpob7GboTcEw3KZlhKVLjGqt3Z 0b99cOW3Bx4BTZrxvsiMhMbVOw9p5EYGCeuF7Lgrd/Yi6Rt2tfsX+biiAsfvQcOoyeRB CJCVRPdVejReDL0iKOC/He3HikTOX7U3/Gp89m9cJinx2KhYf7SrICpqleNJw/jIWYva A9MA== X-Received: by 10.60.42.161 with SMTP id p1mr20518860oel.7.1431963140904; Mon, 18 May 2015 08:32:20 -0700 (PDT) Received: from nitbit.x32 ([72.168.134.52]) by mx.google.com with ESMTPSA id zk5sm6413748obc.22.2015.05.18.08.32.15 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 18 May 2015 08:32:20 -0700 (PDT) From: John Fastabend X-Google-Original-From: John Fastabend To: alexander.h.duyck@redhat.com Date: Mon, 18 May 2015 08:31:50 -0700 Message-ID: <20150518153138.2807.96111.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 v3 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 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index 2e49fc8..ecc658d 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -796,6 +796,26 @@ 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 flow + * steering and specify these queues though break the ring cookie + * into a 32bit queue index with an 8 bit virtual function id. + * This also leaves the 3bytes for further specifiers. + */ +#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,