From patchwork Mon Mar 15 13:34:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 400434 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3424778jai; Mon, 15 Mar 2021 06:35:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0dKFZcxnW7BOV5hLeCPQ71uGIiKv4qOtNiu7LQWjmXKKKguLByIulBdZ87CQuo1G3cSyt X-Received: by 2002:a17:907:7699:: with SMTP id jv25mr22241111ejc.363.1615815350632; Mon, 15 Mar 2021 06:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615815350; cv=none; d=google.com; s=arc-20160816; b=DkqXDbQnNIAnV3lZjcHSz9VfgHMS32nVlQ82sFUdtea86hl4Udu/2UXFcWT0LtzRXK 4p/G18xHnoycJhOBi56I/N6xya0oHLO4gvY+m9YGFVsysZ7aSNKCpGax4X49EgzF5gWJ QOkyQ3zXolZ577prrSDLp56iIKUexj28Lz9pBMg44LPl/uhDWKn6P/ox71JfN2J7BK9j 4jD+VeTyG6k9PerGWebBVL9m3pkS2kYnMI3yL+Bpt2a89VFzVhBhWF/7WYCI2phGvQw6 aItJLB7wEF4UvICy3C2UHnuN6z+fLJ2eBJjYYKmVNd2XYYF5VQhSmb5cvQRM+YatQ2rY 88VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e5ukPamWfSMWajj2pGN9CHr8brD2zi1Azop7dU5O7zI=; b=b1NirWl7eYanoaEmxHfYbRX4O77VZ5NlSXmExMzUWUtbsPe533re0ifZ8NhMLBRi+P VwUFEbNP6TZz7OMkkdIoKV/vqBrKvnN7f2wJ+NqBC28xYpsxdYJ4x3ITfZaYC7Fodf9H 8O225EW89h4xlqNvVuGrMs5aatgfLT00mZMAEhzMBokWYXtN7PL9tnvInQ5nacKH4MGG XcQrGNRMGhJBdZXQ9Esb7s1/ycaQ93mRMJsv/TSyqC4PmuDG+eHFOBZdVVnH5QSYu/fx P3qNd7X12EmAara3/xhIU7QPb9j9CN+moS1hCe14eXS60+dZK/uu/NxCEOer/RWQ/zIg m6MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cTyJVvPK; 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 s18si11097004edr.249.2021.03.15.06.35.50; Mon, 15 Mar 2021 06:35:50 -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=cTyJVvPK; 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 S229754AbhCONfR (ORCPT + 8 others); Mon, 15 Mar 2021 09:35:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbhCONfE (ORCPT ); Mon, 15 Mar 2021 09:35:04 -0400 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD673C06174A for ; Mon, 15 Mar 2021 06:35:04 -0700 (PDT) Received: by mail-io1-xd2b.google.com with SMTP id y20so15012917iot.4 for ; Mon, 15 Mar 2021 06:35: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=e5ukPamWfSMWajj2pGN9CHr8brD2zi1Azop7dU5O7zI=; b=cTyJVvPKlSorpCZKc4vJ0k+XaRwOm0r5EzNKlRugLWtCGEDT8UFduPyDw2SyfKWji+ rxJctXOfR3KNPC09pdvyBSkQZciR1Y3xUjEO1tSaqoeT1tR5Wl7MXU5pycpNbLDmkKpZ JHooao4mD3pO69VOzVJ8Pvxe4cvBTYgOc1WNVs2PGCWSqyb/PoJwb0H6pBv1NYEb3I4I goLGJbBToaChIIWNNJScEjBMC8/ymJS4WyOVDVv1dGMwx95mo/LLDYa+Ndw0mhkgwhyy agkYCxHAfOt1+fzep4rtj7YqB9tHSet6EgRaeWiB+N5uSPukS5RQTDYKrrPM4yV2Bj5d q5zw== 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=e5ukPamWfSMWajj2pGN9CHr8brD2zi1Azop7dU5O7zI=; b=K1bSxTf9F91ugOiR1VrwETOHZwBfaTxKn3fgxFrCzsIDTotz3JpzZYEanvTvJejpcN 1d8urlNCyzx7ozqZZASTd+J9zrf8/sJ7oUY918ya9QolFDsdOcw6E3ErHsZ/GnE16o23 9Ay9Qenmnw+I15G0yj6KnOJ9W9nDfLT/c7QNcw70caA7NasjystBBBAgMKOuitQjBy7M Fo6AreFsPY2IekuuIjO4EZZw308/2sA62b6zaHWE8KbsYFAxiOLstV1HskileF0GyXNp sgM4wtIZGmnZupMzdKnRu9ij9WbQ9wXQxrnvabAB5tyc0DtlDJEAFm2Ddg22IKexuRYc 97rw== X-Gm-Message-State: AOAM533HH2he8BlimcDRuGuQkdJeeH/RVYHrWs6yeENMGkbkpAd6SsUv WT0B7k2wJuFSGWnICwUrlRSbuw== X-Received: by 2002:a02:3c01:: with SMTP id m1mr9259223jaa.87.1615815304301; Mon, 15 Mar 2021 06:35:04 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id o23sm7127672ioo.24.2021.03.15.06.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 06:35:04 -0700 (PDT) From: Alex Elder To: subashab@codeaurora.org, stranche@codeaurora.org, davem@davemloft.net, kuba@kernel.org Cc: sharathv@codeaurora.org, bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, David.Laight@ACULAB.COM, olteanv@gmail.com, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v4 5/6] net: qualcomm: rmnet: don't use C bit-fields in rmnet checksum trailer Date: Mon, 15 Mar 2021 08:34:54 -0500 Message-Id: <20210315133455.1576188-6-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210315133455.1576188-1-elder@linaro.org> References: <20210315133455.1576188-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Replace the use of C bit-fields in the rmnet_map_dl_csum_trailer structure with a single one-byte field, using constant field masks to encode or get at embedded values. Signed-off-by: Alex Elder Reviewed-by: Bjorn Andersson --- v3: - Use BIT(x) and don't use u8_get_bits() for the checksum valid flag .../ethernet/qualcomm/rmnet/rmnet_map_data.c | 2 +- include/linux/if_rmnet.h | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) -- 2.27.0 diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c index 3c3307949db00..3df23365497c4 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c @@ -365,7 +365,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 (!(csum_trailer->flags & MAP_CSUM_DL_VALID_FLAG)) { priv->stats.csum_valid_unset++; return -EINVAL; } diff --git a/include/linux/if_rmnet.h b/include/linux/if_rmnet.h index a02f0a3df1d9a..941997df9e088 100644 --- a/include/linux/if_rmnet.h +++ b/include/linux/if_rmnet.h @@ -19,21 +19,18 @@ struct rmnet_map_header { #define MAP_CMD_FLAG BIT(7) struct rmnet_map_dl_csum_trailer { - u8 reserved1; -#if defined(__LITTLE_ENDIAN_BITFIELD) - u8 valid:1; - u8 reserved2:7; -#elif defined (__BIG_ENDIAN_BITFIELD) - u8 reserved2:7; - u8 valid:1; -#else -#error "Please fix " -#endif + u8 reserved1; + u8 flags; /* MAP_CSUM_DL_VALID_FLAG */ __be16 csum_start_offset; __be16 csum_length; __be16 csum_value; } __aligned(1); +/* rmnet_map_dl_csum_trailer flags field: + * VALID: 1 = checksum and length valid; 0 = ignore them + */ +#define MAP_CSUM_DL_VALID_FLAG BIT(0) + struct rmnet_map_ul_csum_header { __be16 csum_start_offset; #if defined(__LITTLE_ENDIAN_BITFIELD)