From patchwork Tue Mar 23 14:45:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 406899 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp4511936jai; Tue, 23 Mar 2021 07:37:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNAKVC08zslGH3N67ktr7gUwOcuEfPVvXBgU9RwjDzm7MHmnikBI349FSeHvDwJ+onfWTm X-Received: by 2002:a17:906:abcd:: with SMTP id kq13mr5348041ejb.477.1616510261841; Tue, 23 Mar 2021 07:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616510261; cv=none; d=google.com; s=arc-20160816; b=tj2bY8gEvjYHOpDCPRE/Mvpb59had4qA21wl5UTxtaeIOu1umakbz0fHFRjPPXR+6z RnmT1NULBynsL0yD1/JV4C1LEBCJqlBi6qhojsBDMuMvJzdeSuns1pRGmaCm4c7JdXC+ GVShKIL+l5Un2VB+KgQY/cqct8qX2OTAsJam4IhC5Dbbm0tUXd3VoLFZDw0uNetBrc9v xKgznoP9CVphN2ElrffWDiV6auXj5NbbBnoB119Ga3M0UK3gkMpLaYo08bqVKHbur8ue L8V07XI44HsT3TFymaQFJoVuJl4PvRT2pSiM7IEu9plkSbm1kMAXe1PpYbYScjW4ztjf 0xKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=6eJZQTDI0Y84I/lOWy3mMS42uiB5oEH6WMZ3z5nS0d0=; b=RDIpplhMrgw/y8z8tpOzjIM/4ZEPcBOmwWIpThirHYctjb/wuCtx58IJDzEmQSfNQd RfZV++t5sY0H6lEcRexMmsYZFgpG13qWj6CSc+8ZJkbVruRpF1MEShgLH1fvNX7CrKQ+ rn1Gc5JiGIVzebP5OSxWl5I8iaBsLIiU5co2nqvTDqD8AYR9c3AhDtQPHp5RRoIAHVUf DlGgj5MccZHktPnww4wzePCpUXhS0ZShZvzqmb1enWAcRZzQJ7em/E61ms3PTDGFmUWD dC53Yq8ix9egf0pf1qegJBegZWthTEnqLGiMK8LkKpZkMP/SajLT8Whi/g4VaaAmBfn0 FNRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pHzR/7Z6"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si14022310edr.248.2021.03.23.07.37.41; Tue, 23 Mar 2021 07:37:41 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pHzR/7Z6"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232336AbhCWOhK (ORCPT + 8 others); Tue, 23 Mar 2021 10:37:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232209AbhCWOgg (ORCPT ); Tue, 23 Mar 2021 10:36:36 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C918C061574 for ; Tue, 23 Mar 2021 07:36:34 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id d191so11175686wmd.2 for ; Tue, 23 Mar 2021 07:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=6eJZQTDI0Y84I/lOWy3mMS42uiB5oEH6WMZ3z5nS0d0=; b=pHzR/7Z6eHA78L1BvgGTQiQAhJnvTDdjMWpPrwY555vA3/mWm4yfaRMlr8bNgsGM7m ak0EF5URxm+I/b+6ygzCzo72Zm1yKUO2JaXtLrAFS8ulshGks79KiUseLyorblp9TMUe v/ZJN/MHhgqx5Tz2Z2T94XkebPXOA81X338zhTplN2YidosZ2CUBJWw+UYiER84C7r5I cOIUQjhTgj77kWaqc4F6eS/A+I5kHNmQsKQV9og5lvWZpIlDvl4AQlOB3/jS0c4egayd 4hORD7/JEj0GVRjYORTpN5fLWB5qYvRA1Q7Xsyyp53ramYBJkp4UifpEOB+uvCkahO5p P6Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6eJZQTDI0Y84I/lOWy3mMS42uiB5oEH6WMZ3z5nS0d0=; b=MkLWXIAi7Qu2J9r4cB0nz12KmOGnuTv+/w4lUy9fBv5IUsg4blwXSsSJGYwrccFkNw U7SI7uJ7W3zrxe/XPmKZrUvfgruIwr8X6NFUAp+e+8xKmj+p1C7SD0cjJFFYS8JFuyGw VKadJTRQBUWg6g5K2Whq/LPFo/hi1vFnkErRK4UHeiHLFPLJL4tcmejG+YKnQBxzxTfy +ixV+1f3J0nCHJHiCN5W2JOGgsQ2bX6/Um4tUuFLYnCWIS3yIEooXm2G4NHHEZImk0AY vkVSkKE/q87kLuh4whpYsLmzPGiARQ2ZcVtO2epUNtlXm5MhZwijLHLPGUnplG5QK8s1 PSNw== X-Gm-Message-State: AOAM5311nQQ0OTHlZFBgKIuCAmHsH8xtxvWpnHlZnBOk16I0qJ9DZZnZ DgcjSK4eRkZf+NBZLelC03j8TeoICagEhh5c X-Received: by 2002:a05:600c:4f8e:: with SMTP id n14mr3761882wmq.34.1616510192858; Tue, 23 Mar 2021 07:36:32 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:82c:5f0:f09e:975c:f695:2be8]) by smtp.gmail.com with ESMTPSA id f2sm23995886wrq.34.2021.03.23.07.36.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Mar 2021 07:36:32 -0700 (PDT) From: Loic Poulain To: kuba@kernel.org, davem@davemloft.net Cc: netdev@vger.kernel.org, Loic Poulain Subject: [RESEND PATCH net-next 1/2] net: mhi: Allow decoupled MTU/MRU Date: Tue, 23 Mar 2021 15:45:06 +0100 Message-Id: <1616510707-27210-1-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If a maximum receive unit (MRU) size is specified, use it for RX buffers allocation instead of the MTU. Signed-off-by: Loic Poulain --- drivers/net/mhi/mhi.h | 1 + drivers/net/mhi/net.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/mhi/mhi.h b/drivers/net/mhi/mhi.h index 12e7407..1d0c499 100644 --- a/drivers/net/mhi/mhi.h +++ b/drivers/net/mhi/mhi.h @@ -29,6 +29,7 @@ struct mhi_net_dev { struct mhi_net_stats stats; u32 rx_queue_sz; int msg_enable; + unsigned int mru; }; struct mhi_net_proto { diff --git a/drivers/net/mhi/net.c b/drivers/net/mhi/net.c index f599608..5ec7a29 100644 --- a/drivers/net/mhi/net.c +++ b/drivers/net/mhi/net.c @@ -265,10 +265,12 @@ static void mhi_net_rx_refill_work(struct work_struct *work) rx_refill.work); struct net_device *ndev = mhi_netdev->ndev; struct mhi_device *mdev = mhi_netdev->mdev; - int size = READ_ONCE(ndev->mtu); struct sk_buff *skb; + unsigned int size; int err; + size = mhi_netdev->mru ? mhi_netdev->mru : READ_ONCE(ndev->mtu); + while (!mhi_queue_is_full(mdev, DMA_FROM_DEVICE)) { skb = netdev_alloc_skb(ndev, size); if (unlikely(!skb)) From patchwork Tue Mar 23 14:45:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 406898 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp4511930jai; Tue, 23 Mar 2021 07:37:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx16/EO970uKi4jb5dQ2kAs6msSYhUz54rgqd0OHDzrEgG4vWfweRdVbE1jCzJuiY4KhKZe X-Received: by 2002:aa7:c94b:: with SMTP id h11mr4890708edt.160.1616510260982; Tue, 23 Mar 2021 07:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616510260; cv=none; d=google.com; s=arc-20160816; b=l0cSka0r6D5M37irMmnYzQb7WSkyACZ8idHI6d89DybKA6dBWPz4fZ+1f8oLTeFDmr JIa5eU4VhgdfXKQhCQvrwPeqCJTwsNXvw22VQ7toSwa2RdhQYKHBjdoroPnd95MAnj7A W/uuUtTbUU4XMw5MThku6O7IHahzNCqOeGuobZ1J5bkHp3r4BX9ZT/CUXqGyKPDIlkum ejynoEOfrcHDzI96AhOK9og1vlAordyStTmJlSJT2u5U7KGWCnKaxzNQdc8ZEviy4uni LHdizdBt7fa1UEVtpQhx48HBbAyAgML0Wgk6IlS4GyaK9DR14zWrGvCRV+NvBZCxP1GT EuPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=Na2VZYrK81PcvSfN9T4jEkBcLTcy9RcjMORhpmSECxo=; b=Oj9zrj9cTFucjBPRJrBPPu4tPastqLggLsUfPB5qy5mErZEi7DRHgvYdeFfKO03dUk uYPJrgXJ8bzwlIoAB69ELVwV9hv7bbxYPQm+ticQaFscGPfN5LN9GgRhD1LLtcz3TTvO 5/uMMmVy2sukrqThzCMD8NEkfbSUgwEIhBVmf4SiDauznQchUwnc5X417o2two0ZbCiA T3j/Ug80LZVFaaVKTaGwcxhgGdANwLS7DlntjX5DNTR5kz1Z0srxXn/k2GmOxu+xFE0v TrvX0OUSTbXAa/3qq2e/IGSk4PzhbMcyvzg1dOmWjz96bm8Gu68TWFDEwDFA4veJdzX+ GbGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eVfN89Tn; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si14022310edr.248.2021.03.23.07.37.40; Tue, 23 Mar 2021 07:37:40 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eVfN89Tn; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232331AbhCWOhJ (ORCPT + 8 others); Tue, 23 Mar 2021 10:37:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232217AbhCWOgg (ORCPT ); Tue, 23 Mar 2021 10:36:36 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44451C061763 for ; Tue, 23 Mar 2021 07:36:35 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id r10-20020a05600c35cab029010c946c95easo10967162wmq.4 for ; Tue, 23 Mar 2021 07:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Na2VZYrK81PcvSfN9T4jEkBcLTcy9RcjMORhpmSECxo=; b=eVfN89Tnee9VIHCl6M3XQiNffocMqRmf3o1UzoKNYPIqw8pSPwuM9xFFKGHyhepItY IOuljWWlf8F+F4DLoOQS5hre4Vu+XUlIpiOKezSmE5t7gmsRDMXsM+uR3SzJA+uuvhF7 lhKJeV3Z4pSFR3tOKlwL6KliYsYZAY1VUuIJJnxPEXCSGXaJm/SnkCa+GG4nH5goy/ko UVak2zq8J4ScuuFsA6zacg/tDXqZuJPy2iPvfB7MOmCV+b/WDFlcp1MocCizyhR6zvaf HVYxtWOC+rbsa3UnjSrXPIsMGrny4YjCa8QT5nCVe6UpoWjTA3QsBXKt/BxDqXunUc9Q cx3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Na2VZYrK81PcvSfN9T4jEkBcLTcy9RcjMORhpmSECxo=; b=HMl/BDPhGo9QSuz59k4gjv9k0iMnnnXalSOIman9docpwKa7DncfWed5iMe1jn/qsd WFfKROTklYmghOgVBxfXsow/ZpGSDORfNVE5VIZrzVugD47f5m2EOY+5+bUHALI2qk69 MUNjHhYLhqHyeVFrIQiWztEF276mNJFa9MdiMjMOJcpU6fIJrCObfk6qBjUPwpedmlNT phnbp8w9sgII8xy3VGSfmhQ8xyXrNJXpVre1gj5SnygVnwBcq8MnBi65SqSsNGaxJR3Q al99Hn1e3elohkzUUG1o/TjqohAw7R7ddogRrC6edScAC3e5rXtAfY1pnoLRkC+8/wi1 LvfA== X-Gm-Message-State: AOAM531C8gOYcf8oHaX6c17P2QwDVAh8Pi2NbVrHpsu3FnoGOhwBsiBG A9uO/RVq/hZLCAXSXqbsfzp+AQ== X-Received: by 2002:a05:600c:214d:: with SMTP id v13mr3713899wml.162.1616510193880; Tue, 23 Mar 2021 07:36:33 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:82c:5f0:f09e:975c:f695:2be8]) by smtp.gmail.com with ESMTPSA id f2sm23995886wrq.34.2021.03.23.07.36.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Mar 2021 07:36:33 -0700 (PDT) From: Loic Poulain To: kuba@kernel.org, davem@davemloft.net Cc: netdev@vger.kernel.org, Loic Poulain Subject: [RESEND PATCH net-next 2/2] net: mhi: proto_mbim: Adjust MTU and MRU Date: Tue, 23 Mar 2021 15:45:07 +0100 Message-Id: <1616510707-27210-2-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1616510707-27210-1-git-send-email-loic.poulain@linaro.org> References: <1616510707-27210-1-git-send-email-loic.poulain@linaro.org> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org MBIM protocol makes the interface asymmetric, ingress data received from MHI is MBIM protocol, that can contain multiple aggregated IP packets, while egress data received from network stack is IP protocol. Set a default MTU to 1500 (usual network MTU for WWAN), and MRU to 32K which is the default size of MBIM-over-MHI packets. Signed-off-by: Loic Poulain --- drivers/net/mhi/proto_mbim.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.4 diff --git a/drivers/net/mhi/proto_mbim.c b/drivers/net/mhi/proto_mbim.c index 75b5484..29d8577 100644 --- a/drivers/net/mhi/proto_mbim.c +++ b/drivers/net/mhi/proto_mbim.c @@ -26,6 +26,9 @@ #define MBIM_NDP16_SIGN_MASK 0x00ffffff +#define MHI_MBIM_DEFAULT_MRU 32768 +#define MHI_MBIM_DEFAULT_MTU 1500 + struct mbim_context { u16 rx_seq; u16 tx_seq; @@ -282,6 +285,8 @@ static int mbim_init(struct mhi_net_dev *mhi_netdev) return -ENOMEM; ndev->needed_headroom = sizeof(struct mbim_tx_hdr); + ndev->mtu = MHI_MBIM_DEFAULT_MTU; + mhi_netdev->mru = MHI_MBIM_DEFAULT_MRU; return 0; }