Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3038359ybe; Sun, 8 Sep 2019 05:58:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTsyiaUZl20mADuKKgQwocOw0wjBDmtimO+8k+dKbBXlqK2EJTn4ooBhMhwldxSMc6ZWMY X-Received: by 2002:a05:6402:a48:: with SMTP id bt8mr19115390edb.86.1567947495760; Sun, 08 Sep 2019 05:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567947495; cv=none; d=google.com; s=arc-20160816; b=GbBXQxSJojoIkAKjSdhcWeYiz3Y+oA7SpUq8FUTGn48Ux5B1N2RzoRtTczqpkkEL9i EV30w662sYg2QTwdsH35GkU8TxDNybxVo477nPb4wk6YANnw5VDhu0zaxnguFRyJ0PxS Dpc4Hq/gXjIb5OnRom6zaWCmRqV3DUZtM/Ygh7jG/vbDYuG2KA3HKLE0LBgXSJezCIK4 ffuLb3YN9qGfiER7m/F32tP/OJy05NNr4RCYplBNayyNQiJK9RZqzBH5V/MdpjLCC5Dc QUnAhuQOUBp0TZJjf1VuEG4lAqnE1kYUgB/luy8sZ9feCcDm/778BL42q++g5X3neaWN XUyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=68w2D8KXoK0aUtQH7tzIR4a0OcRnBP7OqwhFEIsGeLA=; b=pXhTSosW7RaEDNlHFgWpYBRLTW5xyj8hCON/JhZSUIGZ4MEfkcdQmU2ycb2Wm1yZvK rngmWC34tR6XUFMt0zG5j349o8dSevYc/AU74wwYshdxP7jdUze/Fcgc4g2mimB3CSe1 cmkiJBhtczo42LbII5YdOslFywkTicRln0t/nm4r5INiGgRj6R4HU5/rLXJiE9hwJmjH bbwxl3oq97XXjjnLqbTeUg1l7JhraSruVQ0fOw8jN3dXYyT6Q196fcbQZXj8FbZs/Jyq xAIQu6sXhLuD9Xr3DMZwwkePjPtcHo987GnGzuqrNgzDGRCw25C5WMBYk/QLil4MSsz6 izBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z13si5885335eju.97.2019.09.08.05.57.51; Sun, 08 Sep 2019 05:58:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727410AbfIHIjQ (ORCPT + 99 others); Sun, 8 Sep 2019 04:39:16 -0400 Received: from alexa-out-ams-02.qualcomm.com ([185.23.61.163]:7970 "EHLO alexa-out-ams-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727362AbfIHIjP (ORCPT ); Sun, 8 Sep 2019 04:39:15 -0400 Received: from ironmsg03-ams.qualcomm.com ([10.251.56.4]) by alexa-out-ams-02.qualcomm.com with ESMTP; 08 Sep 2019 10:33:04 +0200 Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by ironmsg03-ams.qualcomm.com with ESMTP; 08 Sep 2019 10:32:59 +0200 From: Maya Erez To: Kalle Valo Cc: Dedy Lansky , linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com, Maya Erez Subject: [PATCH 01/11] wil6210: add wil_netif_rx() helper function Date: Sun, 8 Sep 2019 11:32:45 +0300 Message-Id: <1567931575-27984-2-git-send-email-merez@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1567931575-27984-1-git-send-email-merez@codeaurora.org> References: <1567931575-27984-1-git-send-email-merez@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Dedy Lansky Move common part of wil_netif_rx_any into new helper function and add support for non-gro receive using netif_rx_ni. Signed-off-by: Dedy Lansky Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/txrx.c | 60 ++++++++++++++++++++------------- drivers/net/wireless/ath/wil6210/txrx.h | 2 ++ 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index 8b01ef8..b6253fc 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c @@ -728,21 +728,19 @@ static void wil_get_netif_rx_params(struct sk_buff *skb, int *cid, * Pass Rx packet to the netif. Update statistics. * Called in softirq context (NAPI poll). */ -void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev) +void wil_netif_rx(struct sk_buff *skb, struct net_device *ndev, int cid, + struct wil_net_stats *stats, bool gro) { gro_result_t rc = GRO_NORMAL; struct wil6210_vif *vif = ndev_to_vif(ndev); struct wil6210_priv *wil = ndev_to_wil(ndev); struct wireless_dev *wdev = vif_to_wdev(vif); unsigned int len = skb->len; - int cid; - int security; u8 *sa, *da = wil_skb_get_da(skb); /* here looking for DA, not A1, thus Rxdesc's 'mcast' indication * is not suitable, need to look at data */ int mcast = is_multicast_ether_addr(da); - struct wil_net_stats *stats; struct sk_buff *xmit_skb = NULL; static const char * const gro_res_str[] = { [GRO_MERGED] = "GRO_MERGED", @@ -753,25 +751,6 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev) [GRO_CONSUMED] = "GRO_CONSUMED", }; - wil->txrx_ops.get_netif_rx_params(skb, &cid, &security); - - stats = &wil->sta[cid].stats; - - skb_orphan(skb); - - if (security && (wil->txrx_ops.rx_crypto_check(wil, skb) != 0)) { - rc = GRO_DROP; - dev_kfree_skb(skb); - stats->rx_replay++; - goto stats; - } - - /* check errors reported by HW and update statistics */ - if (unlikely(wil->txrx_ops.rx_error_check(wil, skb, stats))) { - dev_kfree_skb(skb); - return; - } - if (wdev->iftype == NL80211_IFTYPE_STATION) { sa = wil_skb_get_sa(skb); if (mcast && ether_addr_equal(sa, ndev->dev_addr)) { @@ -817,7 +796,10 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev) if (skb) { /* deliver to local stack */ skb->protocol = eth_type_trans(skb, ndev); skb->dev = ndev; - rc = napi_gro_receive(&wil->napi_rx, skb); + if (gro) + rc = napi_gro_receive(&wil->napi_rx, skb); + else + netif_rx_ni(skb); wil_dbg_txrx(wil, "Rx complete %d bytes => %s\n", len, gro_res_str[rc]); } @@ -837,6 +819,36 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev) } } +void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev) +{ + int cid, security; + struct wil6210_priv *wil = ndev_to_wil(ndev); + struct wil_net_stats *stats; + + wil->txrx_ops.get_netif_rx_params(skb, &cid, &security); + + stats = &wil->sta[cid].stats; + + skb_orphan(skb); + + if (security && (wil->txrx_ops.rx_crypto_check(wil, skb) != 0)) { + dev_kfree_skb(skb); + ndev->stats.rx_dropped++; + stats->rx_replay++; + stats->rx_dropped++; + wil_dbg_txrx(wil, "Rx drop %d bytes\n", skb->len); + return; + } + + /* check errors reported by HW and update statistics */ + if (unlikely(wil->txrx_ops.rx_error_check(wil, skb, stats))) { + dev_kfree_skb(skb); + return; + } + + wil_netif_rx(skb, ndev, cid, stats, true); +} + /** * Proceed all completed skb's from Rx VRING * diff --git a/drivers/net/wireless/ath/wil6210/txrx.h b/drivers/net/wireless/ath/wil6210/txrx.h index c0da134..fceb251 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.h +++ b/drivers/net/wireless/ath/wil6210/txrx.h @@ -646,6 +646,8 @@ static inline void wil_skb_set_cid(struct sk_buff *skb, u8 cid) } void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev); +void wil_netif_rx(struct sk_buff *skb, struct net_device *ndev, int cid, + struct wil_net_stats *stats, bool gro); void wil_rx_reorder(struct wil6210_priv *wil, struct sk_buff *skb); void wil_rx_bar(struct wil6210_priv *wil, struct wil6210_vif *vif, u8 cid, u8 tid, u16 seq); -- 1.9.1