From patchwork Thu Oct 27 12:26:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp200366wru; Thu, 27 Oct 2022 05:28:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7c1SzIyAdyVDjMNVboFF98K77fZ0Mw11QAtusqraKgg/GHDc8WwR0YXNLwP6MZVZzoH6mG X-Received: by 2002:a17:906:8a48:b0:7a5:a8f5:b870 with SMTP id gx8-20020a1709068a4800b007a5a8f5b870mr20265050ejc.458.1666873723607; Thu, 27 Oct 2022 05:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666873723; cv=none; d=google.com; s=arc-20160816; b=kyN15IcEiKPFBYjITFESw8Zf7rxcjxH7Cas3A1fo1FEk8LeVtFNv3OvERvWhAwWmkq jNFigIrIgNw0bH53FFEHaxUPG3j8EtwdcPYDHTLUXvKbJIP8/P1ZcdwauoAb/r72IoiA VGLB+PWd80NA3xSRvMGK425PHjp1AdScrNaP6+B/WDEFI+Pt9lWNJLU1QV6oZdwrG5OV DU39wMocgtngNqEOOCeeklWluG0mrKuBGyhoscAhCyNJ5oD/GXWodR5T7W8cP82QzDtS mEd5ugQeDOuBIzLNdOUUr2eGXnaIvoKqzX4Avf5SKbVlFLd6tADPFdWuJnJXYAsTmMhN Qrmg== 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=lniLLq0wWXt/bwGWmVmVl0IrNVPhksr2CD/LLDMRS+A=; b=h3fioN0GKC9hZ606tr3ItmIQQiwfbz8DX35/g11/ftbGzJ2vWzlEUUy6FDrZ+yuyvV Ss/Fcyp25WWjcCMGT2PQ9nmIvQ7jQ3/dwIEDUQvVRbCnb4d3+ad2TvsUYPT24ABibRRJ W7Lam5U+nO48JoCmENZmTo8YE54gQkZtQR+SrKLwCz+QNI3XFfk3XwEaIgmI7FRtaMmR 7EICFb5I6YabfB7B/ze17CNz4uP2j2fwg74gBvDW+iyhgAZHm4EoLVWHK3uGcaXGdlm0 SfgAA+xaeZiQrCCJKhKJ/akePCuAm7mcC3kt+0JcxMT7uf6ZG9/w8IZ81l02W4fqcrlf byVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iT1BRxpi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020a170906975500b007707b853e46si1325496ejy.882.2022.10.27.05.28.19; Thu, 27 Oct 2022 05:28:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iT1BRxpi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S235620AbiJ0M0z (ORCPT + 99 others); Thu, 27 Oct 2022 08:26:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235587AbiJ0M0m (ORCPT ); Thu, 27 Oct 2022 08:26:42 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C11BC13C1CA for ; Thu, 27 Oct 2022 05:26:41 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id q18so836677ils.12 for ; Thu, 27 Oct 2022 05:26:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lniLLq0wWXt/bwGWmVmVl0IrNVPhksr2CD/LLDMRS+A=; b=iT1BRxpiJ1FEPFYwmqxHLZwKGyvfuqDSSjPdNyeSC8hI3C5hVMsF6/UOjXFUyYS9nq XVwlez9HeD1TD792m2ZwoXP22fBXJbo7scUTO+g5diRZNPog3/CpkeLQBkKYxBpndyW/ DL/zpb9ZpRHOgKgspyfFhQzeyrudcvHvLY0hArRYzIvsiMOb7xTdDzzBce4TsvknUHTo a6cT7gI+rsDazezSiL/tRGHZCyN1OCR11LCZnk81tUWhTl0gJRdAkdsW2z7QrNhgOFck /90Im8QD7CwhSDeNlYksE88k+wsCyXbka0PMvRJ+ciSeRWDnfuCQWZj/smEjLoVvjGRr LRNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lniLLq0wWXt/bwGWmVmVl0IrNVPhksr2CD/LLDMRS+A=; b=snZgjCU9lhYMfU3TqB+sJetjF3Gc/GWSbwHGNjKEBt74cWRTGiFymZpsbfw73/PMMA ikKgmnOW69CEZ9HVvVv+nkcD3cDdBJWwvxWZvsr4I4dM30oNRlqUV8j4dp3mTFFOe3M5 je7Ochljolyknl/ehjV+Q60Wg5vord0lx+2Qx5GtXFWTETcqPe70nRCBbmqrJTNtHiH9 UkdOn7/wpMXaaQHVgeYv8nie8VtgehBEEjRp9tBO5gDtTxKp2+MKl+TxLaQF6N69xZt2 UEq/HsYQEShYJrRZgfasD5zdGaVhnvao3K9iHcRhKaaWRY3rIwkiENNpwc5inbplEKW/ vX8w== X-Gm-Message-State: ACrzQf1KtHeKvot5r8nwMthBsrY4FAN339HOrVpw81Z26zfmmyFCMdRw t8E5lAKDb8YYxbLrttWFK6Jbmg== X-Received: by 2002:a92:d0a:0:b0:300:3d26:b1fa with SMTP id 10-20020a920d0a000000b003003d26b1famr9158422iln.272.1666873601045; Thu, 27 Oct 2022 05:26:41 -0700 (PDT) Received: from localhost.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id w24-20020a05663800d800b003566ff0eb13sm526528jao.34.2022.10.27.05.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 05:26:40 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/7] net: ipa: no more global filtering starting with IPA v5.0 Date: Thu, 27 Oct 2022 07:26:28 -0500 Message-Id: <20221027122632.488694-4-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027122632.488694-1-elder@linaro.org> References: <20221027122632.488694-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747843781454929524?= X-GMAIL-MSGID: =?utf-8?q?1747843781454929524?= IPA v5.0 eliminates the global filter table entry. As a result, there is no need to shift the filtered endpoint bitmap when it is written to IPA local memory. Update comments to explain this. Also delete a redundant block of comments above the function. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_table.c | 59 ++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c index db1992eaafaa9..cf3a3de239dc3 100644 --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -32,8 +32,8 @@ * endian 64-bit "slot" that holds the address of a rule definition. (The * size of these slots is 64 bits regardless of the host DMA address size.) * - * Separate tables (both filter and route) used for IPv4 and IPv6. There - * are normally another set of "hashed" filter and route tables, which are + * Separate tables (both filter and route) are used for IPv4 and IPv6. There + * is normally another set of "hashed" filter and route tables, which are * used with a hash of message metadata. Hashed operation is not supported * by all IPA hardware (IPA v4.2 doesn't support hashed tables). * @@ -51,19 +51,32 @@ * Each filter rule is associated with an AP or modem TX endpoint, though * not all TX endpoints support filtering. The first 64-bit slot in a * filter table is a bitmap indicating which endpoints have entries in - * the table. The low-order bit (bit 0) in this bitmap represents a - * special global filter, which applies to all traffic. This is not - * used in the current code. Bit 1, if set, indicates that there is an - * entry (i.e. slot containing a system address referring to a rule) for - * endpoint 0 in the table. Bit 3, if set, indicates there is an entry - * for endpoint 2, and so on. Space is set aside in IPA local memory to - * hold as many filter table entries as might be required, but typically - * they are not all used. + * the table. Each set bit in this bitmap indicates the presence of the + * address of a filter rule in the memory following the bitmap. Until IPA + * v5.0, the low-order bit (bit 0) in this bitmap represents a special + * global filter, which applies to all traffic. Otherwise the position of + * each set bit represents an endpoint for which a filter rule is defined. + * + * The global rule is not used in current code, and support for it is + * removed starting at IPA v5.0. For IPA v5.0+, the endpoint bitmap + * position defines the endpoint ID--i.e. if bit 1 is set in the endpoint + * bitmap, endpoint 1 has a filter rule. Older versions of IPA represent + * the presence of a filter rule for endpoint X by bit (X + 1) being set. + * I.e., bit 1 set indicates the presence of a filter rule for endpoint 0, + * and bit 3 set means there is a filter rule present for endpoint 2. + * + * Each filter table entry has the address of a set of equations that + * implement a filter rule. So following the endpoint bitmap there + * will be such an address/entry for each endpoint with a set bit in + * the bitmap. * * The AP initializes all entries in a filter table to refer to a "zero" - * entry. Once initialized the modem and AP update the entries for - * endpoints they "own" directly. Currently the AP does not use the - * IPA filtering functionality. + * rule. Once initialized, the modem and AP update the entries for + * endpoints they "own" directly. Currently the AP does not use the IPA + * filtering functionality. + * + * This diagram shows an example of a filter table with an endpoint + * bitmap as defined prior to IPA v5.0. * * IPA Filter Table * ---------------------- @@ -658,12 +671,6 @@ bool ipa_table_mem_valid(struct ipa *ipa, bool filter) * when a route table is initialized or reset, its entries are made to refer * to the zero rule. The zero rule is shared for route and filter tables. * - * Note that the IPA hardware requires a filter or route rule address to be - * aligned on a 128 byte boundary. The coherent DMA buffer we allocate here - * has a minimum alignment, and we place the zero rule at the base of that - * allocated space. In ipa_table_init() we verify the minimum DMA allocation - * meets our requirement. - * * +-------------------+ * --> | zero rule | * / |-------------------| @@ -708,12 +715,16 @@ int ipa_table_init(struct ipa *ipa) /* First slot is the zero rule */ *virt++ = 0; - /* Next is the filter table bitmap. The "soft" bitmap value - * must be converted to the hardware representation by shifting - * it left one position. (Bit 0 repesents global filtering, - * which is possible but not used.) + /* Next is the filter table bitmap. The "soft" bitmap value might + * need to be converted to the hardware representation by shifting + * it left one position. Prior to IPA v5.0, bit 0 repesents global + * filtering, which is possible but not used. IPA v5.0+ eliminated + * that option, so there's no shifting required. */ - *virt++ = cpu_to_le64((u64)ipa->filter_map << 1); + if (ipa->version < IPA_VERSION_5_0) + *virt++ = cpu_to_le64((u64)ipa->filter_map << 1); + else + *virt++ = cpu_to_le64((u64)ipa->filter_map); /* All the rest contain the DMA address of the zero rule */ le_addr = cpu_to_le64(addr);