From patchwork Wed Apr 13 10:08:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harshitha Ramamurthy X-Patchwork-Id: 610119 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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 3qlX4s5t4vz9sD5 for ; Thu, 14 Apr 2016 04:14:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id BB58D33A05; Wed, 13 Apr 2016 18:14:20 +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 iwb-rsr5kxaK; Wed, 13 Apr 2016 18:14:18 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 761D533A28; Wed, 13 Apr 2016 18:14:17 +0000 (UTC) X-Original-To: intel-wired-lan@osuosl.org Delivered-To: intel-wired-lan@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 9BB6E1C10B8 for ; Wed, 13 Apr 2016 18:14:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8F9A533A05 for ; Wed, 13 Apr 2016 18:14:14 +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 ppQBKnRi6Wpd for ; Wed, 13 Apr 2016 18:14:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by silver.osuosl.org (Postfix) with ESMTP id 7BE3D33A15 for ; Wed, 13 Apr 2016 18:14:11 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 13 Apr 2016 11:14:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,480,1455004800"; d="scan'208";a="957967587" Received: from harshitha-linux1.jf.intel.com ([10.166.45.81]) by fmsmga002.fm.intel.com with ESMTP; 13 Apr 2016 11:14:12 -0700 From: Harshitha Ramamurthy To: intel-wired-lan@osuosl.org Date: Wed, 13 Apr 2016 03:08:25 -0700 Message-Id: <1460542112-20166-6-git-send-email-harshitha.ramamurthy@intel.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1460542112-20166-1-git-send-email-harshitha.ramamurthy@intel.com> References: <1460542112-20166-1-git-send-email-harshitha.ramamurthy@intel.com> Subject: [Intel-wired-lan] [next PATCH S34 05/12] i40e: Flow-based side-band filter count and its use for input set change 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: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" From: Kiran Patil This patch keeps track of side-band filters based on flow-type. It is used to handle detection of input set mask changes per flow-type. Signed-off-by: Kiran Patil Change-Id: I5f308dbd33d3c6ae9f5db301b5989b6089f61dce Tested-by: Andrew Bowers --- Testing Hints : ethtool -N p5p2 flow-type tcp4 src-ip 192.168.0.2 \ dst-ip 192.168.0.1 action 40 ethtool -N p5p2 flow-type udp4 src-ip 192.168.0.2 \ dst-ip 192.168.0.1 src-port 1000 action 41 Made sure that, able to change input set mask independently based on flow-type. drivers/net/ethernet/intel/i40e/i40e.h | 9 +++++++++ drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 9 +++++++-- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 24 +++++++++++++++++++++--- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 1f48e10..ceb848a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -308,6 +308,15 @@ struct i40e_pf { u32 fd_atr_cnt; u32 fd_tcp_rule; + /* Book-keeping of side-band filter count per flow-type. + * This is used to detect and handle input set changes for + * respective flow-type. + */ + u16 fd_tcp4_filter_cnt; + u16 fd_udp4_filter_cnt; + u16 fd_sctp4_filter_cnt; + u16 fd_ip4_filter_cnt; + struct i40e_udp_port_config udp_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS]; u16 pending_udp_bitmap; diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index ada448b..865c8db 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -2500,6 +2500,7 @@ static int i40e_handle_input_set(struct i40e_vsi *vsi, { bool inset_mask_change = false; struct i40e_pf *pf; + u16 filter_cnt; u64 val; u8 idx; @@ -2510,9 +2511,11 @@ static int i40e_handle_input_set(struct i40e_vsi *vsi, switch (fsp->flow_type & FLOW_TYPE_MASK) { case TCP_V4_FLOW: idx = I40E_FILTER_PCTYPE_NONF_IPV4_TCP; + filter_cnt = pf->fd_tcp4_filter_cnt; break; case UDP_V4_FLOW: idx = I40E_FILTER_PCTYPE_NONF_IPV4_UDP; + filter_cnt = pf->fd_udp4_filter_cnt; break; default: /* for all other flow types */ @@ -2578,8 +2581,10 @@ static int i40e_handle_input_set(struct i40e_vsi *vsi, netif_err(pf, drv, vsi->netdev, "Change of input set is not supported when MFP mode is enabled\n"); return -EOPNOTSUPP; } - if (pf->fdir_pf_active_filters) { - netif_err(pf, drv, vsi->netdev, "Change of input set is not supported when there are existing filters. Please delete them and re-try\n"); + + if (filter_cnt) { + netif_err(pf, drv, vsi->netdev, "Change of input set is not supported when there are existing filter(%u) for specified flow-type: %u. Please delete them and re-try\n", + filter_cnt, fsp->flow_type & FLOW_TYPE_MASK); return -EOPNOTSUPP; } diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 05293f6..808922b 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -235,8 +235,14 @@ static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi, "Filter deleted for PCTYPE %d loc = %d\n", fd_data->pctype, fd_data->fd_id); } - if (err) + if (err) { kfree(raw_packet); + } else { + if (add) + pf->fd_udp4_filter_cnt++; + else + pf->fd_udp4_filter_cnt--; + } return err ? -EOPNOTSUPP : 0; } @@ -315,8 +321,14 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi, fd_data->pctype, fd_data->fd_id); } - if (err) + if (err) { kfree(raw_packet); + } else { + if (add) + pf->fd_tcp4_filter_cnt++; + else + pf->fd_tcp4_filter_cnt--; + } return err ? -EOPNOTSUPP : 0; } @@ -393,8 +405,14 @@ static int i40e_add_del_fdir_ipv4(struct i40e_vsi *vsi, } } - if (err) + if (err) { kfree(raw_packet); + } else { + if (add) + pf->fd_ip4_filter_cnt++; + else + pf->fd_ip4_filter_cnt--; + } return err ? -EOPNOTSUPP : 0; }