From patchwork Tue May 26 15:23:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Fastabend X-Patchwork-Id: 476516 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 63A1814027C for ; Wed, 27 May 2015 01:24:10 +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=UmDlMNJX; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 89FFA334B3; Tue, 26 May 2015 15:24:09 +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 4dUTA4RDIICS; Tue, 26 May 2015 15:24:08 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id EF80E334B5; Tue, 26 May 2015 15:24:07 +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 E7D541C2236 for ; Tue, 26 May 2015 15:24:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E1AAE8BEEC for ; Tue, 26 May 2015 15:24:05 +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 vAhhlPoXCOzC for ; Tue, 26 May 2015 15:24:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by whitealder.osuosl.org (Postfix) with ESMTPS id AB41F8BE56 for ; Tue, 26 May 2015 15:24:04 +0000 (UTC) Received: by oihb142 with SMTP id b142so80321417oih.3 for ; Tue, 26 May 2015 08:24:04 -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:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=SDlKsueVbtprN209eMqjT7tS0y9tt50IGnlxYls4Wb4=; b=UmDlMNJXnC/KymIk8ar8VIpCwhMUfA005nLh4C7q8qmntewbVDTY6dj9oyGU7yg4vO iuDUTFuNzaQBAkB71uc9V4QcZWwuDlgXNWWtncpoAMNMzoB9gC7aK54JMp+Ern4YKx3c siEpKhSWrujszgwmAP4RPkqZ7iPhRwW5x610+axJn+CictfGZHWqbBarLwQQ3iT15KTI cvEQqHcZtJbc2L9CwkWB/wD+Uiq/c3E8Hr5QW1sXYvbLhHGhaPIm/pNuJArALcupjtbd HKqKCYnxRF0EmiqpYwM2wupXYZZTxgb6KM1ibtBwEbgjaPzxeoRd5RU3hBJHB9NdNi/T iplA== X-Received: by 10.60.47.165 with SMTP id e5mr21897163oen.52.1432653843948; Tue, 26 May 2015 08:24:03 -0700 (PDT) Received: from nitbit.x32 ([72.168.133.140]) by mx.google.com with ESMTPSA id z19sm9163467obp.17.2015.05.26.08.23.55 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 26 May 2015 08:24:03 -0700 (PDT) From: John Fastabend X-Google-Original-From: John Fastabend To: alexander.h.duyck@redhat.com Date: Tue, 26 May 2015 08:23:33 -0700 Message-ID: <20150526152321.29428.23903.stgit@nitbit.x32> In-Reply-To: <20150526152231.29428.81833.stgit@nitbit.x32> References: <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 2/2] ixgbe: Allow flow director to use entire queue space 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" Flow director is exported to user space using the ethtool ntuple support. However, currently it only supports steering traffic to a subset of the queues in use by the hardware. This change allows flow director to specify queues that have been assigned to virtual functions by partitioning the ring_cookie into a 8bit vf specifier followed by 32bit queue index. At the moment we don't have any ethernet drivers with more than 2^32 queues on a single function as best I can tell and nor do I expect this to happen anytime soon. This way the ring_cookie's normal use for specifying a queue on a specific PCI function continues to work as expected. Signed-off-by: John Fastabend --- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 34 ++++++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index eafa9ec..057a7c5 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c @@ -2594,18 +2594,35 @@ static int ixgbe_add_ethtool_fdir_entry(struct ixgbe_adapter *adapter, struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_fdir_filter *input; union ixgbe_atr_input mask; + u8 queue; int err; if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) return -EOPNOTSUPP; - /* - * Don't allow programming if the action is a queue greater than - * the number of online Rx queues. + /* ring_cookie is a masked into a set of queues and ixgbe pools or + * we use the drop index. */ - if ((fsp->ring_cookie != RX_CLS_FLOW_DISC) && - (fsp->ring_cookie >= adapter->num_rx_queues)) - return -EINVAL; + if (fsp->ring_cookie == RX_CLS_FLOW_DISC) { + queue = IXGBE_FDIR_DROP_QUEUE; + } else { + u32 ring = ethtool_get_flow_spec_ring(fsp->ring_cookie); + u8 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie); + + if (!vf && (ring >= adapter->num_rx_queues)) + return -EINVAL; + else if (vf && + ((vf > adapter->num_vfs) || + ring >= adapter->num_rx_queues_per_pool)) + return -EINVAL; + + /* Map the ring onto the absolute queue index */ + if (!vf) + queue = adapter->rx_ring[ring]->reg_idx; + else + queue = ((vf - 1) * + adapter->num_rx_queues_per_pool) + ring; + } /* Don't allow indexes to exist outside of available space */ if (fsp->location >= ((1024 << adapter->fdir_pballoc) - 2)) { @@ -2683,10 +2700,7 @@ static int ixgbe_add_ethtool_fdir_entry(struct ixgbe_adapter *adapter, /* program filters to filter memory */ err = ixgbe_fdir_write_perfect_filter_82599(hw, - &input->filter, input->sw_idx, - (input->action == IXGBE_FDIR_DROP_QUEUE) ? - IXGBE_FDIR_DROP_QUEUE : - adapter->rx_ring[input->action]->reg_idx); + &input->filter, input->sw_idx, queue); if (err) goto err_out_w_lock;