From patchwork Mon May 20 13:53:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10951231 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE45176 for ; Mon, 20 May 2019 13:54:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB97028446 for ; Mon, 20 May 2019 13:54:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F7B62887B; Mon, 20 May 2019 13:54:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4C19628446 for ; Mon, 20 May 2019 13:54:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TS5PJMgpHq9PCUcDbLc4DMtYSyTsisiWZLT1UdhoraY=; b=o5bTUh92xR2KZt vMWjdRdokh25fnR3MQSPD00cH2Lwb9J8VqN9VYy3xPTi5TpEK3afC62rNMJvivzUCuuvwTJ5F0/yN eBpHRTz/XXiUInUN4xqYdsqgO8fASjHc/WnmVcmb0EcJNoj1aX+bXVmF9iRxPA5kWDdnfF89EIS6o jy64DupzI9moYfeyNybYICufb12uViImGAnhRFXN8RL6XP1PFMuACPqnUyi7PjUvzfB2ucHORInjh r0Un0AievwdBZpuKFZiXFRDjSLQPG1cWj1Gsn4n04w9CboACngHHqisN+4dlZGa2XfuRfcWvbjVUy UyN3U6RbRZdZoUtxjHGA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSijv-0003tm-Ey; Mon, 20 May 2019 13:54:07 +0000 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSijr-0003sS-DQ for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 13:54:04 +0000 Received: by mail-io1-xd41.google.com with SMTP id b3so11031561iob.12 for ; Mon, 20 May 2019 06:54:02 -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 :mime-version:content-transfer-encoding; bh=qLnbwDX9nYp0llQixdztrdIhtIxceeBj4sRkANMpAsM=; b=GjImSPDJy8ShaSr+Kmu8fSik802cD/opDqpkNym+Rodro2w5D8/smsz5ZmejQAI+3y rsMqynEsw+xD73XJE5d+sP0np/oEVRcnrXkMM30Bicl9+VFtXV9SuzefGaTp0w4dWx2d gi5l9+EIC4mBj33w5DZLCU64lejWFarf0dO7qDS6jpd6go9WsencnubQbU03VtsuVQGB Wi/mc7Rfz9MNa5VQGnlpXL+mSKXz08kZGb2y304tqMZ88wLNA/kRxIWRufMs4aVFw1eg THnozwMZuhU1xKj5vFnIDhkCPEcKJuuwv5I1KzcdIDa2FRbX69m2+OO9aXrAu/pemwyP obCA== 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:mime-version:content-transfer-encoding; bh=qLnbwDX9nYp0llQixdztrdIhtIxceeBj4sRkANMpAsM=; b=N5+9FDXv1tXAz1vdtgYXCtURzxbtxwaHhuBBSqdXTYAXA5GpbDkT731WTkZmFxOo1o n5yizX9OqsnVIZCc6+36VnnCmmBEoozCJF7ElTvVqtXKdSaYsvCvmBsfIdlLve6hR6gy Gxel9s6h52CTu43qgJEZu+Usi1da6HG5YF/fYycfVIdYbdfbxKev0qs9iX3H38Yx1TQ+ nZqWUubcKCjpua/DZN8LtQDItSEHwL8NRpGVvGkianzNXfJpjB5oxzxfSN5XLFwu0Ljg hcw4I3QhElcw5EvgBrR6IopCjlI/Locy3onUGLGParUqJSi1Aleg1b1dSJSyDL6QtZXI kiTw== X-Gm-Message-State: APjAAAUDM+de9rgxeAie/yh6/eb6B0IFumNCxWSgRC6Khbj6LM3owivH ZyR7+zxIwoeZ5/q3NWfiyfdlGw== X-Google-Smtp-Source: APXvYqzqoaiVRHeh1u5raWwifMwfTaaj0AJU7hX2u6GIaGAJpAwDTwJ/wtrswXd4pH9nAZw7EOEz5A== X-Received: by 2002:a6b:f305:: with SMTP id m5mr40986039ioh.271.1558360441814; Mon, 20 May 2019 06:54:01 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id n17sm6581185ioa.0.2019.05.20.06.54.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 06:54:01 -0700 (PDT) From: Alex Elder To: arnd@arndb.de, subashab@codeaurora.org, david.brown@linaro.org, agross@kernel.org, davem@davemloft.net Subject: [PATCH 1/8] net: qualcomm: rmnet: fix struct rmnet_map_header Date: Mon, 20 May 2019 08:53:47 -0500 Message-Id: <20190520135354.18628-2-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520135354.18628-1-elder@linaro.org> References: <20190520135354.18628-1-elder@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_065403_520342_3CF1C1DF X-CRM114-Status: GOOD ( 12.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: syadagir@codeaurora.org, ejcaruso@google.com, netdev@vger.kernel.org, ilias.apalodimas@linaro.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, cpratapa@codeaurora.org, benchan@google.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The C bit-fields in the first byte of the rmnet_map_header structure are defined in the wrong order. The first byte should be formatted this way: +------- reserved_bit | +----- cd_bit | | v v +-----------+-+-+ | pad_len |R|C| +-----------+-+-+ 7 6 5 4 3 2 1 0 <-- bit position But the C bit-fields that define the first byte are defined this way: u8 pad_len:6; u8 reserved_bit:1; u8 cd_bit:1; And although this isn't portable, I can state that when I build it the result puts the bit-fields in the wrong location (e.g., the cd_bit is in bit position 7, when it should be position 0). Fix this by reordering the definitions of these struct members. Upcoming patches will reimplement these definitions portably. Signed-off-by: Alex Elder Reviewed-by: Bjorn Andersson --- drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h index 884f1f52dcc2..b1ae9499c0b2 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h @@ -40,9 +40,9 @@ enum rmnet_map_commands { }; struct rmnet_map_header { - u8 pad_len:6; - u8 reserved_bit:1; u8 cd_bit:1; + u8 reserved_bit:1; + u8 pad_len:6; u8 mux_id; __be16 pkt_len; } __aligned(1); From patchwork Mon May 20 13:53:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10951259 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97C1176 for ; Mon, 20 May 2019 13:55:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84D6B28769 for ; Mon, 20 May 2019 13:55:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78F0D28785; Mon, 20 May 2019 13:55:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0286E28769 for ; Mon, 20 May 2019 13:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Lo8tNB76eIjIsdw8kcaU827zc58EpbrUgAwlMpK8ndY=; b=PPiYfBm77RqEVH jLv7K/zVjFJnjzAMloayx/KF6Tteav/0DYW76N6tAOk4j2vN1hoUzUJZz0oEG28jzmEFW0S6oOi1v q8G8zrT+bQz9JKemr1iPKOscgd/JXMFK2OFjiCOwXiJpv1Y43IJKYgkJdodo1qK3Q8emTvwJj0XRm KypQD2dl75fGbNJXKrwuhqCiAG828yyI+tZW5oopg10MVYP+AuqBaNC03oABUBD+YmETDoAyDslsx xzNET1M2qO0Sseap7Ek47MM3I7+/MfQzZSpfeFUjs2SXq7GEM+0v9g3g9yjZDUJUlzYgYyLlmQKOQ chZDWf7F+Z8ugkLBQW1Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSikk-0004zp-4Z; Mon, 20 May 2019 13:54:58 +0000 Received: from mail-it1-x142.google.com ([2607:f8b0:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSijx-0003td-Qf for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 13:54:15 +0000 Received: by mail-it1-x142.google.com with SMTP id i63so23219227ita.3 for ; Mon, 20 May 2019 06:54:05 -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 :mime-version:content-transfer-encoding; bh=4j5LbYhgEMKnY68snBvOCpO79qdUQ+grRP4+9IrOwhs=; b=p86wF9vsShGKGUgixYkUTORMJxa4rHW8U2B8qe/L6lGwMHVSshSA9L2RRaEQBaHvZi ejV3/fM3HNBKSSWv+Ki6tTqzJrnhofs6FhgExBGRcZo3BD+SXMcVI+WgNHqS/ARLUPpY hnO5czpCXSRF+n0UhF3HpujxNSyWSsBh7GMgty+rt/DhYaKhr1+7BdvQpvxt4aq+Ugzz qmlxC+BZx7MF38y12539vx3VgvKw4akmUQbOuLNVJdFoCQZqZSL07hCyqGaqiNtJugED ChsacW8CFWky8cw8nlUE6wTa83sINciLuwhiHQdc9+eqwQ486sljn2APog+b4xx8DmID Dkfg== 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:mime-version:content-transfer-encoding; bh=4j5LbYhgEMKnY68snBvOCpO79qdUQ+grRP4+9IrOwhs=; b=CfegE+kR9fXDlGR54WHjP7hRVMpp6GPX4JDgeJi/e6eH7ar5nDzfQoh2/1Rqw+vZD6 XAQL/LodunZxNqLzTukG2ZWhHP43EKhzA2qHX3b3ojDBIy288Nyk4lQ3Wp/0BgqSVY3S /Y/U9xYBqHSEom7baxbOb57pvjDikYRnr9JVXFGbhQeEIPfiBPpdOc3ZpZuMxH/ogGta EqQAiTNkWkjh/UzzxJO3xdOwwWZFenW1pOZbRO/jogTN0ynLaTA1I6L63YxtSPRc9pJv CvPG0ABxLF3a+z8ZuPzRwM7RLfYHaBnVtdrfvDHRAWn/XH/eyQkngSJmxvCixfwrP6Ot V6qQ== X-Gm-Message-State: APjAAAUoivflH8kQKRu3l9F5IB9iKu/BM2Vl01RGUGUkO+EmgbFTzYh6 7kLyt/RixQFg+KMQxvU/lzdsHA== X-Google-Smtp-Source: APXvYqynDGYge32TFVxFhq9PSur4Re+5KQgS6ckqDWoN8hjhEqYYc4VSh706navhQ++/e9WzC9K/jw== X-Received: by 2002:a24:218a:: with SMTP id e132mr1015517ita.77.1558360443143; Mon, 20 May 2019 06:54:03 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id n17sm6581185ioa.0.2019.05.20.06.54.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 06:54:02 -0700 (PDT) From: Alex Elder To: arnd@arndb.de, subashab@codeaurora.org, david.brown@linaro.org, agross@kernel.org, davem@davemloft.net Subject: [PATCH 2/8] net: qualcomm: rmnet: kill RMNET_MAP_GET_*() accessor macros Date: Mon, 20 May 2019 08:53:48 -0500 Message-Id: <20190520135354.18628-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520135354.18628-1-elder@linaro.org> References: <20190520135354.18628-1-elder@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_065410_273888_7CB81FDD X-CRM114-Status: GOOD ( 17.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: syadagir@codeaurora.org, ejcaruso@google.com, netdev@vger.kernel.org, ilias.apalodimas@linaro.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, cpratapa@codeaurora.org, benchan@google.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The following macros, defined in "rmnet_map.h", assume a socket buffer is provided as an argument without any real indication this is the case. RMNET_MAP_GET_MUX_ID() RMNET_MAP_GET_CD_BIT() RMNET_MAP_GET_PAD() RMNET_MAP_GET_CMD_START() RMNET_MAP_GET_LENGTH() What they hide is pretty trivial accessing of fields in a structure, and it's much clearer to see this if we do these accesses directly. So rather than using these accessor macros, assign a local variable of the map header pointer type to the socket buffer data pointer, and derereference that pointer variable. Use the network byte order macros (e.g., ntohs()), not the Linux byte order functions (e.g. be_to_cpu16()) to convert the big-endian packet length field, to match the convention used elswhere in the driver. There's no need to byte swap 0; it's all zeros irrespective of endianness. Signed-off-by: Alex Elder Reviewed-by: Bjorn Andersson --- drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c | 9 +++++---- drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h | 12 ------------ .../net/ethernet/qualcomm/rmnet/rmnet_map_command.c | 11 ++++++++--- drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 4 ++-- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c index 11167abe5934..4c1b62b72504 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c @@ -65,20 +65,21 @@ static void __rmnet_map_ingress_handler(struct sk_buff *skb, struct rmnet_port *port) { + struct rmnet_map_header *map_header = (void *)skb->data; struct rmnet_endpoint *ep; u16 len, pad; u8 mux_id; - if (RMNET_MAP_GET_CD_BIT(skb)) { + if (map_header->cd_bit) { if (port->data_format & RMNET_FLAGS_INGRESS_MAP_COMMANDS) return rmnet_map_command(skb, port); goto free_skb; } - mux_id = RMNET_MAP_GET_MUX_ID(skb); - pad = RMNET_MAP_GET_PAD(skb); - len = RMNET_MAP_GET_LENGTH(skb) - pad; + mux_id = map_header->mux_id; + pad = map_header->pad_len; + len = ntohs(map_header->pkt_len) - pad; if (mux_id >= RMNET_MAX_LOGICAL_EP) goto free_skb; diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h index b1ae9499c0b2..a30a7b405a11 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h @@ -63,18 +63,6 @@ struct rmnet_map_ul_csum_header { u16 csum_enabled:1; } __aligned(1); -#define RMNET_MAP_GET_MUX_ID(Y) (((struct rmnet_map_header *) \ - (Y)->data)->mux_id) -#define RMNET_MAP_GET_CD_BIT(Y) (((struct rmnet_map_header *) \ - (Y)->data)->cd_bit) -#define RMNET_MAP_GET_PAD(Y) (((struct rmnet_map_header *) \ - (Y)->data)->pad_len) -#define RMNET_MAP_GET_CMD_START(Y) ((struct rmnet_map_control_command *) \ - ((Y)->data + \ - sizeof(struct rmnet_map_header))) -#define RMNET_MAP_GET_LENGTH(Y) (ntohs(((struct rmnet_map_header *) \ - (Y)->data)->pkt_len)) - #define RMNET_MAP_COMMAND_REQUEST 0 #define RMNET_MAP_COMMAND_ACK 1 #define RMNET_MAP_COMMAND_UNSUPPORTED 2 diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c index f6cf59aee212..f675f47c3495 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c @@ -20,12 +20,13 @@ static u8 rmnet_map_do_flow_control(struct sk_buff *skb, struct rmnet_port *port, int enable) { + struct rmnet_map_header *map_header = (void *)skb->data; struct rmnet_endpoint *ep; struct net_device *vnd; u8 mux_id; int r; - mux_id = RMNET_MAP_GET_MUX_ID(skb); + mux_id = map_header->mux_id; if (mux_id >= RMNET_MAX_LOGICAL_EP) { kfree_skb(skb); @@ -57,6 +58,7 @@ static void rmnet_map_send_ack(struct sk_buff *skb, unsigned char type, struct rmnet_port *port) { + struct rmnet_map_header *map_header = (void *)skb->data; struct rmnet_map_control_command *cmd; struct net_device *dev = skb->dev; @@ -66,7 +68,8 @@ static void rmnet_map_send_ack(struct sk_buff *skb, skb->protocol = htons(ETH_P_MAP); - cmd = RMNET_MAP_GET_CMD_START(skb); + /* Command data immediately follows the header */ + cmd = (struct rmnet_map_control_command *)(map_header + 1); cmd->cmd_type = type & 0x03; netif_tx_lock(dev); @@ -79,11 +82,13 @@ static void rmnet_map_send_ack(struct sk_buff *skb, */ void rmnet_map_command(struct sk_buff *skb, struct rmnet_port *port) { + struct rmnet_map_header *map_header = (void *)skb->data; struct rmnet_map_control_command *cmd; unsigned char command_name; unsigned char rc = 0; - cmd = RMNET_MAP_GET_CMD_START(skb); + /* Command data immediately follows the header */ + cmd = (struct rmnet_map_control_command *)(map_header + 1); command_name = cmd->command_name; switch (command_name) { diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c index 57a9c314a665..498f20ba1826 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c @@ -323,7 +323,7 @@ struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb, return NULL; maph = (struct rmnet_map_header *)skb->data; - packet_len = ntohs(maph->pkt_len) + sizeof(struct rmnet_map_header); + packet_len = ntohs(maph->pkt_len) + sizeof(*maph); if (port->data_format & RMNET_FLAGS_INGRESS_MAP_CKSUMV4) packet_len += sizeof(struct rmnet_map_dl_csum_trailer); @@ -332,7 +332,7 @@ struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb, return NULL; /* Some hardware can send us empty frames. Catch them */ - if (ntohs(maph->pkt_len) == 0) + if (!maph->pkt_len) return NULL; skbn = alloc_skb(packet_len + RMNET_MAP_DEAGGR_SPACING, GFP_ATOMIC); From patchwork Mon May 20 13:53:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10951243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C25D6C5 for ; Mon, 20 May 2019 13:54:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A7B428762 for ; Mon, 20 May 2019 13:54:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EAB92886B; Mon, 20 May 2019 13:54:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CEE9F28879 for ; Mon, 20 May 2019 13:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5Aznn9gmVzMhDkqImmb9dNvJZsftbnDJBNiPBfnzojo=; b=bvxNJcAyPP02zG 5pTWtyUdvdvL3MnLlzAHV/HNCD1+uRpUONYP1fd1GLhnuAEBvt4f18exPH1P9iKIgKJ8a4Yo2OIF0 PTSlGTieDb+IEy5Nme+RypJ7GqhPfhzY2RNX1EhFrjf0pPJ5iev9rgAfx4/UYwyeSOueNvPlU93jg bF7pezWm7NETy9k6GD2V9WWXCRplP4TmBGqafRcAQzBZn/8F+fHb92WVrgQukwL8iD9J6c/NghtgT XtWOQCyKIiY+EyvjzCCJrGfnneq86O+tBQvy1VGaXTuCrRaLZBDRa/C+vRsQzUrjyWrrahxA4KsUf LEXMx0MN9CdkrC4y75gA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSikK-0004OS-Kb; Mon, 20 May 2019 13:54:32 +0000 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSijs-0003su-TT for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 13:54:06 +0000 Received: by mail-io1-xd41.google.com with SMTP id g16so11071324iom.9 for ; Mon, 20 May 2019 06:54:04 -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 :mime-version:content-transfer-encoding; bh=njKYp+14ITtVWnHaTIS/znCm9EIrcpgkV5g8TLL3fv0=; b=P0r2Nz9M5k5sdUMKG8tZN6/xXI3z2RMasXRwJ6C6IeCz245s8PRpWOVSujb7b9MgyZ J9/23EYY+ddUAUrMZfay1vIRvXEYHtG0hgkeSCVzvMevIlhSks1nyvB39qMm5SDJ1eGA BNG5V3yHIpt/nBHeGeT2bHxz/w8RAvaWxH4Tocn/u83KGX2u/CAyCKsAlG4UfjmeL0UE ebkV8fpgkCucrce5oUMX+XrHRZHReuOACoOcTTPouoyUp0MvZHd70Sxxhy9Hrocqf59x mYBWhTiIugfAAZMLNxxUDAJxJh3D0s0zOqlJNAX883i+rNwOr+FuGKKyonpz2Hu5Al+6 uJ8g== 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:mime-version:content-transfer-encoding; bh=njKYp+14ITtVWnHaTIS/znCm9EIrcpgkV5g8TLL3fv0=; b=AZvtBC7m85Xq+QwkxH1k7+o3ZSyCpdmqD/71s63zrwydRkuHDICc/ZtWqrF+MLCBYo t63P+kz+xguLJz70rx+Xz0JLcxJwKNx3MFFgHHTOkPbaYTAtFO15oJ5Dlx16N6RmNOWv /MnNq67nTnWqd+XZvDBjhQwnR3mBE5f/J9nfW/bXpVfVE0EJcx8dDK3Dx10nqpzQiDRq vq1od3VmWit9ZR/yLyBdIrgT7PWtBOCLZMVIgjhzAiPRRCtwx7lt6mSHcMMhy7EZYnAH 2Xl/f0cmt2oke2ROOgqcdhZzcFkYXN+BH+XZgnzY2CUquZ3+AWU5suCJv83A/4V+VXO3 CMLg== X-Gm-Message-State: APjAAAXUlpEO9vPdr6Jz1n6UjUEjVeus3VyVlsTN3lGNCIPUIQE7vc1M t/3h9g8KnwOK2KVEDlMoxof8GQ== X-Google-Smtp-Source: APXvYqzj/S+XU04Ps+YBm6sesJFVcrQUv1xkS+ABddiyL4gw5WNdxLtQz26sYD5Yo18XZ6vi6RzsIw== X-Received: by 2002:a5d:9687:: with SMTP id m7mr6337627ion.229.1558360444278; Mon, 20 May 2019 06:54:04 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id n17sm6581185ioa.0.2019.05.20.06.54.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 06:54:03 -0700 (PDT) From: Alex Elder To: arnd@arndb.de, subashab@codeaurora.org, david.brown@linaro.org, agross@kernel.org, davem@davemloft.net Subject: [PATCH 3/8] net: qualcomm: rmnet: use field masks instead of C bit-fields Date: Mon, 20 May 2019 08:53:49 -0500 Message-Id: <20190520135354.18628-4-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520135354.18628-1-elder@linaro.org> References: <20190520135354.18628-1-elder@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_065404_951138_CC16BC0D X-CRM114-Status: GOOD ( 13.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: syadagir@codeaurora.org, ejcaruso@google.com, netdev@vger.kernel.org, ilias.apalodimas@linaro.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, cpratapa@codeaurora.org, benchan@google.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Using C bitfields (e.g. int foo : 3) is not portable. So stop using them for the command/data flag and the pad length fields in the rmnet_map structure. Instead, use the functions defined in along with field mask constants to extract or assign values within an integral structure member of a known size. Signed-off-by: Alex Elder Reviewed-by: Bjorn Andersson --- drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c | 5 +++-- drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h | 8 +++++--- drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 5 ++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c index 4c1b62b72504..5fff6c78ecd5 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c @@ -13,6 +13,7 @@ * */ +#include #include #include #include @@ -70,7 +71,7 @@ __rmnet_map_ingress_handler(struct sk_buff *skb, u16 len, pad; u8 mux_id; - if (map_header->cd_bit) { + if (u8_get_bits(map_header->cmd_pad_len, RMNET_MAP_CMD_FMASK)) { if (port->data_format & RMNET_FLAGS_INGRESS_MAP_COMMANDS) return rmnet_map_command(skb, port); @@ -78,7 +79,7 @@ __rmnet_map_ingress_handler(struct sk_buff *skb, } mux_id = map_header->mux_id; - pad = map_header->pad_len; + pad = u8_get_bits(map_header->cmd_pad_len, RMNET_MAP_PAD_LEN_FMASK); len = ntohs(map_header->pkt_len) - pad; if (mux_id >= RMNET_MAX_LOGICAL_EP) diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h index a30a7b405a11..a56209645c81 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h @@ -40,13 +40,15 @@ enum rmnet_map_commands { }; struct rmnet_map_header { - u8 cd_bit:1; - u8 reserved_bit:1; - u8 pad_len:6; + u8 cmd_pad_len; /* RMNET_MAP_* */ u8 mux_id; __be16 pkt_len; } __aligned(1); +#define RMNET_MAP_CMD_FMASK GENMASK(0, 0) /* 0: data; 1: cmd */ +#define RMNET_MAP_RESERVED_FMASK GENMASK(1, 1) +#define RMNET_MAP_PAD_LEN_FMASK GENMASK(7, 2) + struct rmnet_map_dl_csum_trailer { u8 reserved1; u8 valid:1; diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c index 498f20ba1826..10d2d582a9ce 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c @@ -13,6 +13,7 @@ * */ +#include #include #include #include @@ -301,7 +302,9 @@ struct rmnet_map_header *rmnet_map_add_map_header(struct sk_buff *skb, done: map_header->pkt_len = htons(map_datalen + padding); - map_header->pad_len = padding & 0x3F; + /* This is a data packet, so cmd field is 0 */ + map_header->cmd_pad_len = + u8_encode_bits(padding, RMNET_MAP_PAD_LEN_FMASK); return map_header; } From patchwork Mon May 20 13:53:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10951263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B2AE6C5 for ; Mon, 20 May 2019 13:55:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07E5528821 for ; Mon, 20 May 2019 13:55:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFFF22887D; Mon, 20 May 2019 13:55:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8ABF32886F for ; Mon, 20 May 2019 13:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xqcus8F85FtgcVBy+wHBeQNf6vIRD9fdRxiDdKKYuCk=; b=qYSonSKdrLKnIa n1EymmSiyohV0X+eRyvADHACYENYoeqLRZrO/MdlbHNq5CU4z22hqhh8xMiSl93r9bfGfb2Px/QDZ o21hcSIUHRKex9sjP1yGhIGPsLnEigZRj1aK9vx8jZC1WSDCMphWtn8mvwZfiEEroy5JE3mRMcEQb rlWusQV9ySXvTcuql7+CQQvmbx131P1uwGAzH5u9cPjnt3CLzf9/0YjyyqiogjMbFlp05ecTWPX42 elC2UvwPykjjeBS/kUU67dB5L2Apof1eI5uLTqEzi/9l18eXhvUAb0bvM8cNYibm7E2i0Ka+relCX OxB7IHrDVDCJI/kCuxDw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSil9-0006d7-Ua; Mon, 20 May 2019 13:55:23 +0000 Received: from mail-io1-xd43.google.com ([2607:f8b0:4864:20::d43]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSijx-0003tf-Vl for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 13:54:18 +0000 Received: by mail-io1-xd43.google.com with SMTP id a17so11064285iot.8 for ; Mon, 20 May 2019 06:54:06 -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 :mime-version:content-transfer-encoding; bh=XZw+WK9Ep7KnMxZda1w63yeDixvAfUhz3fm/WPmj3DA=; b=S4enJUEKqFT864sg1x+pjeXgA0rFex1SjESZsKd844hf6PlYJ/lInrfNmqEOqguWGV v/sA7bU/54p49Ul0mvtJoPCOE4RERlcCeEBgAqc6ixOlHzs9JxA3+4UmpSrMF15qrVL5 6XXbFTmgqIj+AIG2gMq/b85nHyGwQmD7fjftL9zhgNLDHE2/2RNMbuNJF7lg+nfa+HBP 10QEAwZN8k1AujAVFImb8YygjOKw2R+LlOE/RaKW8s5jIF9udsX2bzYc/O82HtUZr9ru NeLcGUtoPpNTkEHUelSE+L8Cms+GBrnjrD0zj6HCa/uvbBIzG64241jGNG22J3CqfMc9 U4KA== 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:mime-version:content-transfer-encoding; bh=XZw+WK9Ep7KnMxZda1w63yeDixvAfUhz3fm/WPmj3DA=; b=qv6CVKzQbLj7UxxFJXzTm2TFZ8S5U4VTdbYZPHqgdIuzNH8a0RlsTRYdG/eGJtGb1q Xydlrp5jzxibtpiTahVY5ayrmqDDWT6v7D6TmVujLoKdk7TimxljyeWN/uYwjYb1nLXW mLvislw8FNkYCHpVNyy/7D19ajDOzOrf41nundjUCOiZ1mML3C0pZ5gszWAdHIYg9gRv Qz4JkGJ+HyIypUwpYErQTKRcpd3ZFHzIGgN3F3tcVQPlF9skUkXHZRb1tBk6bEVBc9os pm3RWW0wrxyMosGtagPoWRj8hXx8AmNESPLBam8vDHrUGeFzDeEWOJ77ZEheoCMugZjM /REA== X-Gm-Message-State: APjAAAURZFNlaFSr27Ybdi2bUUkN1tx77FZie4OV5P/BHDgelGHlIh35 SBD3mMnsqUs5vOUP3gWVzUDOiQ== X-Google-Smtp-Source: APXvYqxCHlSs84ZzkHPl2hQvL7JJVuT2q6BWjhQZwpjY6kjaOTDJrZOENVfuvB4EKMKbt3+cK9F+QQ== X-Received: by 2002:a05:6602:4e:: with SMTP id z14mr14015532ioz.93.1558360445436; Mon, 20 May 2019 06:54:05 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id n17sm6581185ioa.0.2019.05.20.06.54.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 06:54:04 -0700 (PDT) From: Alex Elder To: arnd@arndb.de, subashab@codeaurora.org, david.brown@linaro.org, agross@kernel.org, davem@davemloft.net Subject: [PATCH 4/8] net: qualcomm: rmnet: don't use C bit-fields in rmnet checksum header Date: Mon, 20 May 2019 08:53:50 -0500 Message-Id: <20190520135354.18628-5-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520135354.18628-1-elder@linaro.org> References: <20190520135354.18628-1-elder@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_065410_401803_3847CBF2 X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: syadagir@codeaurora.org, ejcaruso@google.com, netdev@vger.kernel.org, ilias.apalodimas@linaro.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, cpratapa@codeaurora.org, benchan@google.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Replace the use of C bit-fields in the rmnet_map_ul_csum_header structure with a single integral structure member, and use field masks to encode or get values within that member. Note that the previous C bit-fields were defined with CPU local endianness. Their values were computed and then forecfully converted to network byte order in rmnet_map_ipv4_ul_csum_header(). Simplify that function, and properly define the new csum_info member as a big endian value. Make similar simplifications in rmnet_map_ipv6_ul_csum_header(). Signed-off-by: Alex Elder Reviewed-by: Bjorn Andersson --- .../net/ethernet/qualcomm/rmnet/rmnet_map.h | 9 ++-- .../ethernet/qualcomm/rmnet/rmnet_map_data.c | 50 ++++++++----------- 2 files changed, 26 insertions(+), 33 deletions(-) diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h index a56209645c81..f3231c26badd 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h @@ -60,11 +60,14 @@ struct rmnet_map_dl_csum_trailer { struct rmnet_map_ul_csum_header { __be16 csum_start_offset; - u16 csum_insert_offset:14; - u16 udp_ip4_ind:1; - u16 csum_enabled:1; + __be16 csum_info; /* RMNET_MAP_UL_* */ } __aligned(1); +/* NOTE: These field masks are defined in CPU byte order */ +#define RMNET_MAP_UL_CSUM_INSERT_FMASK GENMASK(13, 0) +#define RMNET_MAP_UL_CSUM_UDP_FMASK GENMASK(14, 14) /* 0: IP; 1: UDP */ +#define RMNET_MAP_UL_CSUM_ENABLED_FMASK GENMASK(15, 15) + #define RMNET_MAP_COMMAND_REQUEST 0 #define RMNET_MAP_COMMAND_ACK 1 #define RMNET_MAP_COMMAND_UNSUPPORTED 2 diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c index 10d2d582a9ce..72b64114505a 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c @@ -207,22 +207,18 @@ rmnet_map_ipv4_ul_csum_header(void *iphdr, struct rmnet_map_ul_csum_header *ul_header, struct sk_buff *skb) { - struct iphdr *ip4h = (struct iphdr *)iphdr; - __be16 *hdr = (__be16 *)ul_header, offset; + struct iphdr *ip4h = iphdr; + u16 offset; + u16 val; - offset = htons((__force u16)(skb_transport_header(skb) - - (unsigned char *)iphdr)); - ul_header->csum_start_offset = offset; - ul_header->csum_insert_offset = skb->csum_offset; - ul_header->csum_enabled = 1; + offset = skb_transport_header(skb) - (unsigned char *)iphdr; + ul_header->csum_start_offset = htons(offset); + + val = u16_encode_bits(skb->csum_offset, RMNET_MAP_UL_CSUM_INSERT_FMASK); + val |= RMNET_MAP_UL_CSUM_ENABLED_FMASK; if (ip4h->protocol == IPPROTO_UDP) - ul_header->udp_ip4_ind = 1; - else - ul_header->udp_ip4_ind = 0; - - /* Changing remaining fields to network order */ - hdr++; - *hdr = htons((__force u16)*hdr); + val |= RMNET_MAP_UL_CSUM_UDP_FMASK; + ul_header->csum_info = htons(val); skb->ip_summed = CHECKSUM_NONE; @@ -249,18 +245,16 @@ rmnet_map_ipv6_ul_csum_header(void *ip6hdr, struct rmnet_map_ul_csum_header *ul_header, struct sk_buff *skb) { - __be16 *hdr = (__be16 *)ul_header, offset; + u16 offset; + u16 val; - offset = htons((__force u16)(skb_transport_header(skb) - - (unsigned char *)ip6hdr)); - ul_header->csum_start_offset = offset; - ul_header->csum_insert_offset = skb->csum_offset; - ul_header->csum_enabled = 1; - ul_header->udp_ip4_ind = 0; + offset = skb_transport_header(skb) - (unsigned char *)ip6hdr; + ul_header->csum_start_offset = htons(offset); - /* Changing remaining fields to network order */ - hdr++; - *hdr = htons((__force u16)*hdr); + val = u16_encode_bits(skb->csum_offset, RMNET_MAP_UL_CSUM_INSERT_FMASK); + val |= RMNET_MAP_UL_CSUM_ENABLED_FMASK; + /* Not UDP, so that field is 0 */ + ul_header->csum_info = htons(val); skb->ip_summed = CHECKSUM_NONE; @@ -400,8 +394,7 @@ void rmnet_map_checksum_uplink_packet(struct sk_buff *skb, struct rmnet_map_ul_csum_header *ul_header; void *iphdr; - ul_header = (struct rmnet_map_ul_csum_header *) - skb_push(skb, sizeof(struct rmnet_map_ul_csum_header)); + ul_header = skb_push(skb, sizeof(*ul_header)); if (unlikely(!(orig_dev->features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)))) @@ -428,10 +421,7 @@ void rmnet_map_checksum_uplink_packet(struct sk_buff *skb, } sw_csum: - ul_header->csum_start_offset = 0; - ul_header->csum_insert_offset = 0; - ul_header->csum_enabled = 0; - ul_header->udp_ip4_ind = 0; + memset(ul_header, 0, sizeof(*ul_header)); priv->stats.csum_sw++; } From patchwork Mon May 20 13:53:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10951249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 16C75933 for ; Mon, 20 May 2019 13:54:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05A092887D for ; Mon, 20 May 2019 13:54:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDEBB28882; Mon, 20 May 2019 13:54:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7CDA12887D for ; Mon, 20 May 2019 13:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZqB/gJesjxIob9zDhnjnnAA/RgcUo9tshITGldkWdMM=; b=T/zt8y9haqeG7Z gdupq1SZ7H07f6KA0VuHxO6JvUdhqJbCrVsINYSctrBPWc26MyleEjpxOT3LcRpT8DYh2P6cdy3D/ t5vtiP1Z5Qzlb9NfFutnZSFN74ZUeMwueQ1V0jyy8ZOR/UNYV/2nYvkF0hGhGaXUblJ32ox3TxGvC wYXKrtvDpP0MljCeLFkf5qrdkzHldjNiZZfLptsvgUZthmOhvNf/pEKdwaizISSlHYA4vofU18+Gb 6llPAqKzsnQlbt3R1dZH2TNL2oIch0ZfWLu0IigakhEL+t7IDlFX6DZZ2t3Mn/y1jR1Wam+ZKKjY4 HBvD96o2MtCpn4RwgOPg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSikR-0004W9-38; Mon, 20 May 2019 13:54:39 +0000 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSijv-0003tz-7G for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 13:54:09 +0000 Received: by mail-io1-xd41.google.com with SMTP id m7so11072411ioa.6 for ; Mon, 20 May 2019 06:54:07 -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 :mime-version:content-transfer-encoding; bh=R+Jpk+XthHVG0qFI+gAyJW+786CYrgpLqGw1dG639sc=; b=kUlwrKA6Jg9T6clWLPJgeGUuaE9PZk89mqOd9MnvQdrLTvEBvGPK+iniaIoOUfuyIn QXoEpsQP3UrMYBN3jNm4JMiGQwiLHjLiNqoSubqfzcWS9J3nMo+Hq8ev5PXyG69DjXHV fcIxJ3nHRXB+WfFuhNsCaJL9aSPf0Y5+wQgDHH6x1REzX40cC8jtntFcuHXQBst6HXIF VDgfxkjCCr4/AKfVplJelzBYtiIe0RoYpR9mfu99YYKNYe5yJMuUIkEaZC6dft8Z3as9 urvLde/3DeJRDV2EZz67QkJ6chBk0YkJGVMrr0UIEB3gNKwPmIuzAloPUTyWXsOgD/2k U3qg== 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:mime-version:content-transfer-encoding; bh=R+Jpk+XthHVG0qFI+gAyJW+786CYrgpLqGw1dG639sc=; b=mGs3X0ey4WjLQ7RezBoR1pkWHVRF2UjEIcQedcJJqccFWmKvU2rLCD/BEz79AwTI62 v3hr8HChjtY2EqTEseiCfsZ/ZTVTUNmqzGhpcFN6smLCaHxLP/zk9Txmi2t9mF2Rl3Q5 6WmXbMA56Ldxe882A0K8WFJILIpJgWlMN2KhtPfOGdvqXm/kzfrXQ9Ikwv2emI5A1Dxt hniw/nbe1sweu/WctFPlJ0JJ8cgjbk2CnFASvKawf2vk4nSuOh8RQppIjEgOcTCultG1 WoaUgJjLGme13s8+7m3Hw8NsgePv82VZE5i96YEBViIBp5ndLRD4uA3uyVeqzCKusfsd bqAg== X-Gm-Message-State: APjAAAU2p1jyWaCu7S0hPAUFhjqurAE/66iUp2EZNVlg/EmD3NAgGbu2 QAQbaIqzMbOsD+sgclFmuUu/Xw== X-Google-Smtp-Source: APXvYqwdkj2XNTZy7A/BcMrnQZOHJaq1jEZ10NGzfy1RdztnJ5TzENVJ8ePAl4JCjYVq+ttbEYBKKA== X-Received: by 2002:a5e:a71a:: with SMTP id b26mr12962200iod.95.1558360446575; Mon, 20 May 2019 06:54:06 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id n17sm6581185ioa.0.2019.05.20.06.54.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 06:54:06 -0700 (PDT) From: Alex Elder To: arnd@arndb.de, subashab@codeaurora.org, david.brown@linaro.org, agross@kernel.org, davem@davemloft.net Subject: [PATCH 5/8] net: qualcomm: rmnet: don't use C bit-fields in rmnet checksum trailer Date: Mon, 20 May 2019 08:53:51 -0500 Message-Id: <20190520135354.18628-6-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520135354.18628-1-elder@linaro.org> References: <20190520135354.18628-1-elder@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_065407_410636_68CA0A1B X-CRM114-Status: GOOD ( 12.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: syadagir@codeaurora.org, ejcaruso@google.com, netdev@vger.kernel.org, ilias.apalodimas@linaro.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, cpratapa@codeaurora.org, benchan@google.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Replace the use of C bit-fields in the rmnet_map_dl_csum_trailer structure with a single integral field, using field masks to encode or get at sub-field values. Signed-off-by: Alex Elder Reviewed-by: Bjorn Andersson --- drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h | 6 ++++-- drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h index f3231c26badd..fb1cdb4ec41f 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h @@ -51,13 +51,15 @@ struct rmnet_map_header { struct rmnet_map_dl_csum_trailer { u8 reserved1; - u8 valid:1; - u8 reserved2:7; + u8 flags; /* RMNET_MAP_DL_* */ u16 csum_start_offset; u16 csum_length; __be16 csum_value; } __aligned(1); +#define RMNET_MAP_DL_CSUM_VALID_FMASK GENMASK(0, 0) +#define RMNET_MAP_DL_RESERVED_FMASK GENMASK(7, 1) + struct rmnet_map_ul_csum_header { __be16 csum_start_offset; __be16 csum_info; /* RMNET_MAP_UL_* */ diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c index 72b64114505a..a95111cdcd29 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c @@ -362,7 +362,7 @@ int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len) csum_trailer = (struct rmnet_map_dl_csum_trailer *)(skb->data + len); - if (!csum_trailer->valid) { + if (!u8_get_bits(csum_trailer->flags, RMNET_MAP_DL_CSUM_VALID_FMASK)) { priv->stats.csum_valid_unset++; return -EINVAL; } From patchwork Mon May 20 13:53:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10951255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 79D9A6C5 for ; Mon, 20 May 2019 13:54:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68FA82886B for ; Mon, 20 May 2019 13:54:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D07E28880; Mon, 20 May 2019 13:54:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 084F22886B for ; Mon, 20 May 2019 13:54:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ik9pS3n1gdCY9SpQ//Wui5W8PaVZxG4xfgN3ov5pRCM=; b=MV+NxuN7tnNTj+ oRpKax645Mhu8U1DMO8w+3GYkcB57z/93R0CKMnehvYXqUZy0+DDkhl4ty7/GLVbC03asNuhLv/ir BQsg9Wt99md+pgv0nf6lDpmjW2mJgcCDMiesSqkvLemxpotujlRBGTA8lcJS44jcQOOGJEWmu2Oy4 LoBuYHlUvEkPcz3oNhta0pTaMaVryV0/ZxVQGwmRJfM1jk+z9dEhHXBJZqWIDcG9ibAIwN538TSzw i31LBNBOq1ls6WRecNVpBy1HvZo+daLfTELX9VjZIyEzrw5jFbLExFqnVV2AX/Dt69vaEN3iyi85I XX0BOan83+51cEQfdoaw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSikZ-0004ki-Ui; Mon, 20 May 2019 13:54:48 +0000 Received: from mail-io1-xd44.google.com ([2607:f8b0:4864:20::d44]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSijw-0003vc-D4 for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 13:54:12 +0000 Received: by mail-io1-xd44.google.com with SMTP id m7so11072451ioa.6 for ; Mon, 20 May 2019 06:54:08 -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 :mime-version:content-transfer-encoding; bh=8sgAB/AGyzpe5i8kq4OdwdrKx4EqLUnBgzPsX6Zqbyw=; b=rDEMXB3Un6MgiWh4ksumjEEVa9RIeGcQ/D2s4tFLbqN9nlrSYnXOr0yEDoAaR6V1vM ATjGLvuaFBu76A2xSWr5+ppw+kVHhrHlJzKuxeKCLTWMT34QA972duz6cj+vLBUWrMmJ 2LeR+I+G4795y9S5c68S3ARzybp2HwFrCYHI+HOBjCoUiL4JBuYU55F45fA684s4D5HO /H0qJ9zEqZzr4I1ekSrP/P0cnZ9y6L/stZ7RJ5F5KDqlEeK+TIQYwl8dTfHFAD3WBp3V 219aMx8wPPLNjFsSMEM8sP2adx7BDPZu9YQYcAs0qgJU3ZB8Al+zCS0GB2VHxf6hiSLX 3dfw== 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:mime-version:content-transfer-encoding; bh=8sgAB/AGyzpe5i8kq4OdwdrKx4EqLUnBgzPsX6Zqbyw=; b=UdvTcgO5v0V0Mdsx/s0DczbGGCDeZD4Nzxm9rkRAo9t3Rjn6OovqaZY3iaBSvoPv9r rak7l7Ru9vTmpt+VJLRHs6F0NAtVZVRxqVPsA63vghaOLNE8Cok2FyWwbKlgOihuDLfO pdSgfxoeE9AI/WuCO+PIPoe7adjhK4xU5aWNIUdYnCoPfn3PS1pW3Sg+18LcORMJ10DS 3PV4Wrl4R8g6A5ZeDU5EGT9Vh18XihIcGd71AbHQRo4wm/1t4DNBi4IZPdfhWhRWA+ZW rOAmhEdkLqzE6hRuoKoyKUvVV5tSVG/YYHrpHpMoKEbQGUT8zlpF/NY4k8zyEWC53ugz 9DXA== X-Gm-Message-State: APjAAAVjgVGJ7XwR38vDzjrSJvLTqdFRhQJTsptRQFRIiCv8CrJlDN1n 80VlxfvC0oH+AJCAoPn6kd/BzCgRJHw= X-Google-Smtp-Source: APXvYqzKN0iv4h6jWKvTTCl0uadYJCIgkU2OoTryl4K5KV0aAamgJ1/b6G2rx2mupUMzWjojbh7wxA== X-Received: by 2002:a6b:c411:: with SMTP id y17mr8433515ioa.265.1558360447762; Mon, 20 May 2019 06:54:07 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id n17sm6581185ioa.0.2019.05.20.06.54.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 06:54:07 -0700 (PDT) From: Alex Elder To: arnd@arndb.de, subashab@codeaurora.org, david.brown@linaro.org, agross@kernel.org, davem@davemloft.net Subject: [PATCH 6/8] net: qualcomm: rmnet: get rid of a variable in rmnet_map_ipv4_ul_csum_header() Date: Mon, 20 May 2019 08:53:52 -0500 Message-Id: <20190520135354.18628-7-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520135354.18628-1-elder@linaro.org> References: <20190520135354.18628-1-elder@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_065408_646512_ABB39EFB X-CRM114-Status: GOOD ( 12.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: syadagir@codeaurora.org, ejcaruso@google.com, netdev@vger.kernel.org, ilias.apalodimas@linaro.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, cpratapa@codeaurora.org, benchan@google.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The value passed as an argument to rmnet_map_ipv4_ul_csum_header() is always an IPv4 header. Just have the type of the argument reflect that rather than obscuring that with a void pointer. Rename it to be consistent with rmnet_map_ipv6_ul_csum_header(). Signed-off-by: Alex Elder Reviewed-by: Bjorn Andersson --- drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c index a95111cdcd29..61b7dbab2056 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c @@ -203,26 +203,25 @@ static void rmnet_map_complement_ipv4_txporthdr_csum_field(void *iphdr) } static void -rmnet_map_ipv4_ul_csum_header(void *iphdr, +rmnet_map_ipv4_ul_csum_header(struct iphdr *ip4hdr, struct rmnet_map_ul_csum_header *ul_header, struct sk_buff *skb) { - struct iphdr *ip4h = iphdr; u16 offset; u16 val; - offset = skb_transport_header(skb) - (unsigned char *)iphdr; + offset = skb_transport_header(skb) - (unsigned char *)ip4hdr; ul_header->csum_start_offset = htons(offset); val = u16_encode_bits(skb->csum_offset, RMNET_MAP_UL_CSUM_INSERT_FMASK); val |= RMNET_MAP_UL_CSUM_ENABLED_FMASK; - if (ip4h->protocol == IPPROTO_UDP) + if (ip4hdr->protocol == IPPROTO_UDP) val |= RMNET_MAP_UL_CSUM_UDP_FMASK; ul_header->csum_info = htons(val); skb->ip_summed = CHECKSUM_NONE; - rmnet_map_complement_ipv4_txporthdr_csum_field(iphdr); + rmnet_map_complement_ipv4_txporthdr_csum_field(ip4hdr); } #if IS_ENABLED(CONFIG_IPV6) From patchwork Mon May 20 13:53:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10951261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 834206C5 for ; Mon, 20 May 2019 13:55:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7372E28821 for ; Mon, 20 May 2019 13:55:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67D3128879; Mon, 20 May 2019 13:55:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 07D5D28821 for ; Mon, 20 May 2019 13:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=p5tqBYU4MG5aIPYF+fkrFeUrBz+fB1WoYqW8ivNqdQY=; b=fAn0FZiKnky1RJ 5TfSz6jrvOLmSnYR2DoR2NfSyertf/L4pRxiFxGKSOmHFW9F5WoB6L5I2vaiQnrUJnl+Ju8N+2dOj GU+ec4U8P2sOBajqBL7UxjrDzEcumbkVpB1ZjWyBl0BNhQtm7Hd6HKwp/7f5JjQ27DqwAGGAbjYUb SjE4WAQOPgLLBE4EqnXbP+f4d+NY8MAhPZgaOcTCjA797u2TZ0xPJ32n19VjdMzBal1FJE/3wjdcP 1QX821cIjkR468sW/ji9l2y7cRuIznrxRrPcbtLjk0dIvp44hcr6YNpTDpsCsONLl+mPhq5QAlQyo kw3nlxsFDi1J6a2LLeYw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSil1-00067Z-AN; Mon, 20 May 2019 13:55:15 +0000 Received: from mail-io1-xd42.google.com ([2607:f8b0:4864:20::d42]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSijy-0003xL-5F for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 13:54:17 +0000 Received: by mail-io1-xd42.google.com with SMTP id m7so11072503ioa.6 for ; Mon, 20 May 2019 06:54:09 -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 :mime-version:content-transfer-encoding; bh=KapGiunwwx5p5z/8cIELmJy7chJVMEDGUUi3pAZirR8=; b=yzkpmxk6Ixt7Vl80qvoHTPb21ID7tx7gUl5mLADJHRIA+mwJh+3RgoLGGk3FLTk54T YiScf7OxLAxGZZO9LC3+c8gtM0a7Ny2oW1diBfNo/KFgJgeeoC6QMtMvwqVezCPM64Mp Vqa2IRutPqE8aDKy5pSCg0SoCU7x3XEmR9EhpHbWBcQfO0t7f0HIZTkPOFFny9fs2ft/ SubZ6bAz3fd+WTZssKs0U/8XN4Bvy28hyjoIYHIsrx1TFdoJk2enr7kbvfSS3KDsuUkm SnglFiYSqw9p+9YZ7rokP3YXlNVR+BjVzrA4BlMeUzKXro+jzAtArTeK6j2I5+Cf7jRR miAg== 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:mime-version:content-transfer-encoding; bh=KapGiunwwx5p5z/8cIELmJy7chJVMEDGUUi3pAZirR8=; b=lhvaU0LyRS/zZgZUIesPlqZ9rIWpG6nV1Z1YmgqgPa1Tc4c/rlD3reNJ9Xxg0lvwJh v4aT6t9tIh7LL3+UDrIwpEWJB8Nqf9Tt14+OgNZ7IEZGNf/f+p6LUgLkVr89oJN+0uNq /d9g1GkU2axdsSfPU1dkO8cbNFmdBlOHj5vIRmr3pxxz8GXjRnINdzZNoQQOc5euemuV aIAgTaOcTDDK99NjSoCUEsgWC2kwSQk/LL8EiUfk2h7kJS7d2HDm8dMPEQ0OMaVY0U0d iScgx8qMNTtnSlpvzQJ11VnNsFVSTlAfBUSyVbZTkI3w1CRYO/OKknSfDsc8CSkST8pj 5PIw== X-Gm-Message-State: APjAAAXai9xUaBkgb/EMF7mQSAX0pZ9uQ4bYesyPrc7G/QLaZ5JiH5vB 3a7EeKtzaLk9hgV4uxp4+l7+HA== X-Google-Smtp-Source: APXvYqwP2yeMVfgpj5IAJSVo21lcBFOvcGIwfuZQCYo5tTMis4c0FbPs3j4lcwnYFd0aeSJGTibCsQ== X-Received: by 2002:a6b:f404:: with SMTP id i4mr7597663iog.251.1558360449000; Mon, 20 May 2019 06:54:09 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id n17sm6581185ioa.0.2019.05.20.06.54.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 06:54:08 -0700 (PDT) From: Alex Elder To: arnd@arndb.de, subashab@codeaurora.org, david.brown@linaro.org, agross@kernel.org, davem@davemloft.net Subject: [PATCH 7/8] net: qualcomm: rmnet: mark endianness of struct rmnet_map_dl_csum_trailer fields Date: Mon, 20 May 2019 08:53:53 -0500 Message-Id: <20190520135354.18628-8-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520135354.18628-1-elder@linaro.org> References: <20190520135354.18628-1-elder@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_065410_678219_16DBF3EB X-CRM114-Status: GOOD ( 11.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: syadagir@codeaurora.org, ejcaruso@google.com, netdev@vger.kernel.org, ilias.apalodimas@linaro.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, cpratapa@codeaurora.org, benchan@google.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Two 16-bit fields (csum_start_offset and csum_length) in the rmnet_map_dl_csum_trailer structure are currently defined to have type u16. But they are in fact big endian values, so should be properly represented as __be16 values. No existing code actually references these fields (they're ignored by rmnet_map_ipv4_dl_csum_trailer() and rmnet_map_ipv6_dl_csum_trailer()). Changing their type therefore causes no harm, so just fix them. Signed-off-by: Alex Elder Reviewed-by: Bjorn Andersson --- drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h index fb1cdb4ec41f..775b98d34e94 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h @@ -52,8 +52,8 @@ struct rmnet_map_header { struct rmnet_map_dl_csum_trailer { u8 reserved1; u8 flags; /* RMNET_MAP_DL_* */ - u16 csum_start_offset; - u16 csum_length; + __be16 csum_start_offset; + __be16 csum_length; __be16 csum_value; } __aligned(1); From patchwork Mon May 20 13:53:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10951265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6068076 for ; Mon, 20 May 2019 13:55:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 501682886F for ; Mon, 20 May 2019 13:55:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 444B228880; Mon, 20 May 2019 13:55:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AF8BB2886F for ; Mon, 20 May 2019 13:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HPuZ5JW7tJGHjjwlQJ32iNR/F65epZUGtaTGvuQM5As=; b=gVDksUzwECYSGs RfgOnh0EQxfuasj+N53vVdjXwoLWvDSuh7vgOicqrqq02rR2qGV+JksCo8orsr7rCEAEPFjhJwIMu 7XIpp7Icatoocnht8zgA68I9ck3BOo93im49oPEWI8s5g3ygK+83QhkJswFInbafkLZJDUBXySnGt Uru9L6LWjx2XzHLqtC5deammyXR6jIUopjCoBpdlDXtdhIa7ohZdz7nnJQ1CUxj4RXRlNv3QieCnu h8ovI4vlV7pkLO92yBCUkY1KGjgh1Ao0xm2QGLb5RYhdGWGXNA2riFDkZQMxjHV75gPpuipjiW25s fX3/05mU0yN2djuBaD9A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSilL-0006ru-JH; Mon, 20 May 2019 13:55:35 +0000 Received: from mail-io1-xd43.google.com ([2607:f8b0:4864:20::d43]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSijy-0003zH-SQ for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 13:54:19 +0000 Received: by mail-io1-xd43.google.com with SMTP id e19so11098267iob.3 for ; Mon, 20 May 2019 06:54:10 -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 :mime-version:content-transfer-encoding; bh=qTfgXH2ZXOT0rZW+kdJ3acNhah3zg+9vblvPOMdBQ14=; b=v3cHBs+JVLGbaW7f+X68Q7SNESSu2ea1qt0XE5rwqRRjB1H+pvrtWDxfUH0AEFsQJq +l0yHFwkErTYtnhtH/d87kocoecxvwNEuzEn3ZgwG54OEKQbv0vupQIsVRPhY7yvwsrg Wepwos5OEehfTrvI6BJ3/HL98x9ItLBsiW4ABMW4s6cvh29x/nQal4rB5atykq3D+fXq o2pcQA2VJz1bqrOD16+M33W2hVMyjFGHKcFIAqkJWBAVwu8iMyTEbfFoqlPUfckbLVWB VNrr2RSoVbQp421gKP4231PwDa78wGcYfQJlvT3qi89msxZU19CRvpv0TxKB6B20v7/K HE1A== 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:mime-version:content-transfer-encoding; bh=qTfgXH2ZXOT0rZW+kdJ3acNhah3zg+9vblvPOMdBQ14=; b=PsQgltwEMlVX89W0KT3lksj0zeGtv6EE3BVrNDPHb3pue4Ktyx/eJEqh/1Lvv7YwbA M+egT8vyvvcy6NiWigIajYzslwIVh24mPcASgV2/ytQqn/bp6UF6hrHwa8nHXks/cwFq gIUgUsOoUclBCz9xlS75eJTvwuT1IZiy+by7iuDgdQXcBKjwLv+z9UaV/c3YwHI7wULT bTn7hryhDddaYPorn6zr+mPqIXrsdmd5T8CFdCabscGIEREkVUikHoVFmU2Wr265NP2h Atrghc5eY6LksAVyF6umd03yaUsMi+nIh2g0/hI+Yae9K+AnN/7Bj+pxnjkoM4ynOAmY sRJg== X-Gm-Message-State: APjAAAUpItqUS7nQ/zdqrMgWgOybEHJeHg3VeXRFOOZZaT46zMFY8aB6 cR726D69b30y1BorEDmQZzSG+g== X-Google-Smtp-Source: APXvYqw+Dh6IdcQx6woJU//JReMZ8LVIygVjAfQCtJfQq3P/b8mcrruZxt3mXsn8gRe41T3YpWrDpA== X-Received: by 2002:a05:6602:2049:: with SMTP id z9mr14847619iod.46.1558360450147; Mon, 20 May 2019 06:54:10 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id n17sm6581185ioa.0.2019.05.20.06.54.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 06:54:09 -0700 (PDT) From: Alex Elder To: arnd@arndb.de, subashab@codeaurora.org, david.brown@linaro.org, agross@kernel.org, davem@davemloft.net Subject: [PATCH 8/8] net: introduce "include/linux/if_rmnet.h" Date: Mon, 20 May 2019 08:53:54 -0500 Message-Id: <20190520135354.18628-9-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520135354.18628-1-elder@linaro.org> References: <20190520135354.18628-1-elder@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_065411_489906_892A2988 X-CRM114-Status: GOOD ( 15.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: syadagir@codeaurora.org, ejcaruso@google.com, netdev@vger.kernel.org, ilias.apalodimas@linaro.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, cpratapa@codeaurora.org, benchan@google.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The IPA driver requires some (but not all) symbols defined in "drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h". Create a new public header file "include/linux/if_rmnet.h" and move the needed definitions there. Signed-off-by: Alex Elder Reviewed-by: Bjorn Andersson --- .../ethernet/qualcomm/rmnet/rmnet_handlers.c | 1 + .../net/ethernet/qualcomm/rmnet/rmnet_map.h | 31 ------------- .../qualcomm/rmnet/rmnet_map_command.c | 1 + .../ethernet/qualcomm/rmnet/rmnet_map_data.c | 1 + .../net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 1 + include/linux/if_rmnet.h | 45 +++++++++++++++++++ 6 files changed, 49 insertions(+), 31 deletions(-) create mode 100644 include/linux/if_rmnet.h diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c index 5fff6c78ecd5..8e00e14f4ac9 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "rmnet_private.h" #include "rmnet_config.h" #include "rmnet_vnd.h" diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h index 775b98d34e94..d101cabb04c3 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h @@ -39,37 +39,6 @@ enum rmnet_map_commands { RMNET_MAP_COMMAND_ENUM_LENGTH }; -struct rmnet_map_header { - u8 cmd_pad_len; /* RMNET_MAP_* */ - u8 mux_id; - __be16 pkt_len; -} __aligned(1); - -#define RMNET_MAP_CMD_FMASK GENMASK(0, 0) /* 0: data; 1: cmd */ -#define RMNET_MAP_RESERVED_FMASK GENMASK(1, 1) -#define RMNET_MAP_PAD_LEN_FMASK GENMASK(7, 2) - -struct rmnet_map_dl_csum_trailer { - u8 reserved1; - u8 flags; /* RMNET_MAP_DL_* */ - __be16 csum_start_offset; - __be16 csum_length; - __be16 csum_value; -} __aligned(1); - -#define RMNET_MAP_DL_CSUM_VALID_FMASK GENMASK(0, 0) -#define RMNET_MAP_DL_RESERVED_FMASK GENMASK(7, 1) - -struct rmnet_map_ul_csum_header { - __be16 csum_start_offset; - __be16 csum_info; /* RMNET_MAP_UL_* */ -} __aligned(1); - -/* NOTE: These field masks are defined in CPU byte order */ -#define RMNET_MAP_UL_CSUM_INSERT_FMASK GENMASK(13, 0) -#define RMNET_MAP_UL_CSUM_UDP_FMASK GENMASK(14, 14) /* 0: IP; 1: UDP */ -#define RMNET_MAP_UL_CSUM_ENABLED_FMASK GENMASK(15, 15) - #define RMNET_MAP_COMMAND_REQUEST 0 #define RMNET_MAP_COMMAND_ACK 1 #define RMNET_MAP_COMMAND_UNSUPPORTED 2 diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c index f675f47c3495..6832c5939cae 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c @@ -11,6 +11,7 @@ */ #include +#include #include "rmnet_config.h" #include "rmnet_map.h" #include "rmnet_private.h" diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c index 61b7dbab2056..370aee7402e0 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "rmnet_config.h" #include "rmnet_map.h" #include "rmnet_private.h" diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c index d11c16aeb19a..6b39d4d8e523 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "rmnet_config.h" #include "rmnet_handlers.h" #include "rmnet_private.h" diff --git a/include/linux/if_rmnet.h b/include/linux/if_rmnet.h new file mode 100644 index 000000000000..ae60472ecc79 --- /dev/null +++ b/include/linux/if_rmnet.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. + * Copyright (C) 2019 Linaro Ltd. + */ +#ifndef _LINUX_IF_RMNET_H_ +#define _LINUX_IF_RMNET_H_ + +#include + +/* Header structure that precedes packets in ETH_P_MAP protocol */ +struct rmnet_map_header { + u8 cmd_pad_len; /* RMNET_MAP_* */ + u8 mux_id; + __be16 pkt_len; +} __aligned(1); + +#define RMNET_MAP_CMD_FMASK GENMASK(0, 0) /* 0: data; 1: cmd */ +#define RMNET_MAP_RESERVED_FMASK GENMASK(1, 1) +#define RMNET_MAP_PAD_LEN_FMASK GENMASK(7, 2) + +/* Checksum offload metadata header for outbound packets*/ +struct rmnet_map_ul_csum_header { + __be16 csum_start_offset; + __be16 csum_info; /* RMNET_MAP_UL_* */ +} __aligned(1); + +/* NOTE: These field masks are defined in CPU byte order */ +#define RMNET_MAP_UL_CSUM_INSERT_FMASK GENMASK(13, 0) +#define RMNET_MAP_UL_CSUM_UDP_FMASK GENMASK(14, 14) /* 0: IP; 1: UDP */ +#define RMNET_MAP_UL_CSUM_ENABLED_FMASK GENMASK(15, 15) + +/* Checksum offload metadata trailer for inbound packets */ +struct rmnet_map_dl_csum_trailer { + u8 reserved1; + u8 flags; /* RMNET_MAP_DL_* */ + __be16 csum_start_offset; + __be16 csum_length; + __be16 csum_value; +} __aligned(1); + +#define RMNET_MAP_DL_CSUM_VALID_FMASK GENMASK(0, 0) +#define RMNET_MAP_DL_RESERVED_FMASK GENMASK(7, 1) + +#endif /* _LINUX_IF_RMNET_H_ */