From patchwork Mon Dec 14 16:12:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 343562 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3124253jai; Mon, 14 Dec 2020 08:07:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJywKbTVHotODxqerJjQQMJ9CFi1BM+bSh9uh6iwR9U+vjRCjaIG7hGUpfMvVMynbjpDOSjI X-Received: by 2002:a17:906:af75:: with SMTP id os21mr6304820ejb.330.1607962021780; Mon, 14 Dec 2020 08:07:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607962021; cv=none; d=google.com; s=arc-20160816; b=lq+yJ1646sMcTXEE0asVmvpdoSMbkeRp4HtyMDhwsnnGdmoBRsvVatUtiFFxnzXzCw 59ip7wGsPm28OnW/phhnyNCW2sHhGqbogTZBOidjm/xR6LCTyNXAUXuXHqs7fn/h/nGy U8Qyrx/sR0Vj6Uc6zeVRNdhAWu8JKbvtY0Rtyc8dhCQfnSVLITeDFc80Fq6BjUCP6nmP K6iHNqrb5KXF274Rvz7WiCcYgLGconBfek5ND2YYQUWixQCbF9rZe/BNx6mzg8bE4aAR g4kjoLZtQDFkN1SM45sJi2PITNFYWzO4O4QX52cdZPtU6HNpkHBSIQ0TRrXUFBoR5Gtz oHWg== 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=B1qgvoqyjJnaz03RGohqC8FsinqgcUNvzLxQt8gagPc=; b=Gg+Bwae2aiiYKNbvhR2Ai65bzi7Z/HOc7LWAf8DnqUL+ZDRdN0dLHaGnd5yB0qg9nZ xJVg6rLBBEw93COLn8O0cLD7JjW08K7Z2R2rFWjtqUFrB0m9sYsE1ePzQMQYQ7OlF+VS aSwV/jKo1QxNKe5to3Ubs03JSl8mYiggUfj7OP0IbV2BN8TBu0xb1sR5OMGsP9ZP7iqt kULhJ8623+JL10Cv3vfgHF2UK4qcFh/zfb+Vx3meKahT4xSD+pYHJ8cp3v2H0houTBsz 9f6frsPUtlh9xxSQfYTQPgHJ9gyQXl0EKwCS/U67wND/P99pLnL7CHwtEUOirzRS7+np rOfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qe9JnFma; 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 t20si10898056edw.31.2020.12.14.08.07.01; Mon, 14 Dec 2020 08:07:01 -0800 (PST) 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=qe9JnFma; 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 S2440096AbgLNQGM (ORCPT + 8 others); Mon, 14 Dec 2020 11:06:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439087AbgLNQFz (ORCPT ); Mon, 14 Dec 2020 11:05:55 -0500 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75857C0613D3 for ; Mon, 14 Dec 2020 08:05:15 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id a12so16947267wrv.8 for ; Mon, 14 Dec 2020 08:05:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=B1qgvoqyjJnaz03RGohqC8FsinqgcUNvzLxQt8gagPc=; b=qe9JnFmaPnkbj/V1y4Mi1SXYc5X/oCu1sXDXb/q2erUt6rhlHqQWdsMwwvQvZpdZLs dVB648QxGNAGEcfJLMwe/eT9IRRp7XMLYM4nFBZNbIx+h0ZKF5boUhnFDkqsOgrW4wNu +p4vBgyFJr+JTj2/PIxT+/JSAFkFtizbAHwtSXJol3N3+42eqvb2MYOAljM5qNc8GiES UVV+MXLrlI0xeqDZK+VvrxB2feNayUQuwK8jqEQCLu1E5B0V2JIEWZBPXNeEHhPk+Peb 2pQu3hQ6QVQjtO90GnW6myQZs1ZnMosazeI1dAQYUApk3Tb6+6RNpOX8wJZBr0MtSgnt qjpA== 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=B1qgvoqyjJnaz03RGohqC8FsinqgcUNvzLxQt8gagPc=; b=dnZbWk2nIqRE5PtcAcoHKL2eDNZvgjv3hLbwX+ELL5ZIZIBn5pa6K9ErvpIrpINtSf cli+3hTqPUaWEspyRiOvA2KRjCrODryLBDkXRXVkjZXZyo7Wc55+naoOQrpoF0EFtfYD yENXBpXuvF9nCueXdfvCOix5pBBgElcaO924mEXt15KJuCoLnkKPmPntnIugwKFgz7C+ vqV6l75eOT3bRmYbu3q6t+Ecu+3JSB0V3yt3RyEM+/CSUoYaYlLocnqW8H3Ug/8dUJ0A PEYelxZw2VygYoqz1jyiiYqwFS7ECdZ8xtFaMc2Qc6Z6ntWP9+vN1mQVP+LGwH28uY8y BCVg== X-Gm-Message-State: AOAM531sML/GFwOyvf/g/TY54/im5C7CxaJJJQxtWikTNJwewQY3izO+ ZQn4wATTSFPR2qwD1oAboDDu6dOAw1oksA== X-Received: by 2002:adf:f5c5:: with SMTP id k5mr30647696wrp.286.1607961914180; Mon, 14 Dec 2020 08:05:14 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:490:8730:f2e4:25b3:2b53:52cd]) by smtp.gmail.com with ESMTPSA id x18sm28587026wrg.55.2020.12.14.08.05.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Dec 2020 08:05:13 -0800 (PST) From: Loic Poulain To: kuba@kernel.org, davem@davemloft.net Cc: netdev@vger.kernel.org, Loic Poulain Subject: [PATCH] net: mhi: Add raw IP mode support Date: Mon, 14 Dec 2020 17:12:24 +0100 Message-Id: <1607962344-26325-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 MHI net is protocol agnostic, the payload protocol depends on the modem configuration, which can be either RMNET (IP muxing and aggregation) or raw IP. This patch adds support for incomming IPv4/IPv6 packets, that was previously unconditionnaly reported as RMNET packets. Signed-off-by: Loic Poulain --- drivers/net/mhi_net.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c index 5af6247..a1fb2b8 100644 --- a/drivers/net/mhi_net.c +++ b/drivers/net/mhi_net.c @@ -260,7 +260,18 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev, u64_stats_add(&mhi_netdev->stats.rx_bytes, skb->len); u64_stats_update_end(&mhi_netdev->stats.rx_syncp); - skb->protocol = htons(ETH_P_MAP); + switch (skb->data[0] & 0xf0) { + case 0x40: + skb->protocol = htons(ETH_P_IP); + break; + case 0x60: + skb->protocol = htons(ETH_P_IPV6); + break; + default: + skb->protocol = htons(ETH_P_MAP); + break; + } + netif_rx(skb); }