From patchwork Fri May 8 18:47:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Fastabend X-Patchwork-Id: 470164 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 76970140345 for ; Sat, 9 May 2015 04:47:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2D0AE95696; Fri, 8 May 2015 18:47: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 FL1vdrTOiOQ0; Fri, 8 May 2015 18:47:26 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 9877F9568F; Fri, 8 May 2015 18:47:26 +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 1E79B1C0FDB for ; Fri, 8 May 2015 18:47:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 18E4995691 for ; Fri, 8 May 2015 18:47:25 +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 8Bfq0TtpkZwP for ; Fri, 8 May 2015 18:47:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by hemlock.osuosl.org (Postfix) with ESMTP id 0C83A9568F for ; Fri, 8 May 2015 18:47:24 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 08 May 2015 11:47:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,391,1427785200"; d="scan'208";a="692089085" Received: from unknown (HELO jrfastab-mobl.amr.corp.intel.com) ([134.134.176.153]) by orsmga001.jf.intel.com with ESMTP; 08 May 2015 11:47:17 -0700 From: John Fastabend To: intel-wired-lan@lists.osuosl.org Date: Fri, 08 May 2015 11:47:20 -0700 Message-ID: <20150508184720.22470.35134.stgit@jrfastab-mobl.amr.corp.intel.com> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [net-next PATCH] 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 or VMDQ pools. Signed-off-by: John Fastabend --- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 22 ++++++++----- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 37 +++++++++++++++++++++- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 0f1bff3..ccd661f 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c @@ -2595,16 +2595,18 @@ static int ixgbe_add_ethtool_fdir_entry(struct ixgbe_adapter *adapter, struct ixgbe_fdir_filter *input; union ixgbe_atr_input mask; int err; + u8 queue; 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 can not be larger than the total number of queues in use + * by the device including the queues aassigned to virtual functions and + * VMDQ pools. */ if ((fsp->ring_cookie != RX_CLS_FLOW_DISC) && - (fsp->ring_cookie >= adapter->num_rx_queues)) + (fsp->ring_cookie >= + (adapter->num_rx_queues * (adapter->num_vfs + 1)))) return -EINVAL; /* Don't allow indexes to exist outside of available space */ @@ -2681,12 +2683,16 @@ static int ixgbe_add_ethtool_fdir_entry(struct ixgbe_adapter *adapter, /* apply mask and compute/store hash */ ixgbe_atr_compute_perfect_hash_82599(&input->filter, &mask); + if (input->action < adapter->num_rx_queues) + queue = adapter->rx_ring[input->action]->reg_idx; + else if (input->action == IXGBE_FDIR_DROP_QUEUE) + queue = IXGBE_FDIR_DROP_QUEUE; + else + queue = input->action - adapter->num_rx_queues; + /* 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; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index ee600b2..23540dd 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -3166,8 +3166,20 @@ static void ixgbe_enable_rx_drop(struct ixgbe_adapter *adapter, u8 reg_idx = ring->reg_idx; u32 srrctl = IXGBE_READ_REG(hw, IXGBE_SRRCTL(reg_idx)); + pr_info("%s: enable_rx_drop on queue %d\n", + ixgbe_driver_string, reg_idx); srrctl |= IXGBE_SRRCTL_DROP_EN; + IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(reg_idx), srrctl); +} + +static void ixgbe_enable_vf_rx_drop(struct ixgbe_adapter *adapter, u8 reg_idx) +{ + struct ixgbe_hw *hw = &adapter->hw; + u32 srrctl = IXGBE_READ_REG(hw, IXGBE_SRRCTL(reg_idx)); + pr_info("%s: enable_vf_rx_drop on queue %d\n", + ixgbe_driver_string, reg_idx); + srrctl |= IXGBE_SRRCTL_DROP_EN; IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(reg_idx), srrctl); } @@ -3183,13 +3195,22 @@ static void ixgbe_disable_rx_drop(struct ixgbe_adapter *adapter, IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(reg_idx), srrctl); } +static void ixgbe_disable_vf_rx_drop(struct ixgbe_adapter *adapter, u8 reg_idx) +{ + struct ixgbe_hw *hw = &adapter->hw; + u32 srrctl = IXGBE_READ_REG(hw, IXGBE_SRRCTL(reg_idx)); + + srrctl &= ~IXGBE_SRRCTL_DROP_EN; + IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(reg_idx), srrctl); +} + #ifdef CONFIG_IXGBE_DCB void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter) #else static void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter) #endif { - int i; + int i, j; bool pfc_en = adapter->dcb_cfg.pfc_mode_enable; if (adapter->ixgbe_ieee_pfc) @@ -3208,9 +3229,23 @@ static void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter) !(adapter->hw.fc.current_mode & ixgbe_fc_tx_pause) && !pfc_en)) { for (i = 0; i < adapter->num_rx_queues; i++) ixgbe_enable_rx_drop(adapter, adapter->rx_ring[i]); + for (i = 0; i < adapter->num_vfs; i++) { + for (j = 0; j < adapter->num_rx_queues; j++) { + u8 q = i * adapter->num_rx_queues + j; + + ixgbe_enable_vf_rx_drop(adapter, q); + } + } } else { for (i = 0; i < adapter->num_rx_queues; i++) ixgbe_disable_rx_drop(adapter, adapter->rx_ring[i]); + for (i = 0; i < adapter->num_vfs; i++) { + for (j = 0; j < adapter->num_rx_queues; j++) { + u8 q = i * adapter->num_rx_queues + j; + + ixgbe_disable_vf_rx_drop(adapter, q); + } + } } }