]> git.itanic.dy.fi Git - linux-stable/commitdiff
net: ipa: update table cache flushing
authorAlex Elder <elder@linaro.org>
Mon, 30 Jan 2023 21:01:54 +0000 (15:01 -0600)
committerJakub Kicinski <kuba@kernel.org>
Wed, 1 Feb 2023 05:45:51 +0000 (21:45 -0800)
Update the code that causes filter and router table caches to be
flushed so that it supports IPA versions 5.0+.  It adds a comment in
ipa_hardware_config_hashing() that explains that cacheing does not
need to be enabled, just as before, because it's enabled by default.
(For the record, the FILT_ROUT_CACHE_CFG register would have been
used if we wanted to explicitly enable these.)

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ipa/ipa_cmd.c
drivers/net/ipa/ipa_main.c
drivers/net/ipa/ipa_table.c

index 5d3a875e50feea9bd77854d7f2d75d0929eb57a5..16169641ddebe918c66971af9763b64a3f3e453c 100644 (file)
@@ -295,7 +295,11 @@ static bool ipa_cmd_register_write_valid(struct ipa *ipa)
         * offset will fit in a register write IPA immediate command.
         */
        if (ipa_table_hash_support(ipa)) {
-               reg = ipa_reg(ipa, FILT_ROUT_HASH_FLUSH);
+               if (ipa->version < IPA_VERSION_5_0)
+                       reg = ipa_reg(ipa, FILT_ROUT_HASH_FLUSH);
+               else
+                       reg = ipa_reg(ipa, FILT_ROUT_CACHE_FLUSH);
+
                offset = ipa_reg_offset(reg);
                name = "filter/route hash flush";
                if (!ipa_cmd_register_write_offset_valid(ipa, name, offset))
index 4fb92f7719741762dc4c090c33515ab7788f1aec..f3466b913394c6a130c29bb9976604e1d33a87b8 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 
 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- * Copyright (C) 2018-2022 Linaro Ltd.
+ * Copyright (C) 2018-2023 Linaro Ltd.
  */
 
 #include <linux/types.h>
@@ -432,6 +432,11 @@ static void ipa_hardware_config_hashing(struct ipa *ipa)
 {
        const struct ipa_reg *reg;
 
+       /* Other than IPA v4.2, all versions enable "hashing".  Starting
+        * with IPA v5.0, the filter and router tables are implemented
+        * differently, but the default configuration enables this feature
+        * (now referred to as "cacheing"), so there's nothing to do here.
+        */
        if (ipa->version != IPA_VERSION_4_2)
                return;
 
index b81e27b613549cdff1d5ac316c9544e3707ac855..32ed9fec2ca74ddb421e65b06b53d3cab501ff88 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 
 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- * Copyright (C) 2018-2022 Linaro Ltd.
+ * Copyright (C) 2018-2023 Linaro Ltd.
  */
 
 #include <linux/types.h>
@@ -359,13 +359,22 @@ int ipa_table_hash_flush(struct ipa *ipa)
                return -EBUSY;
        }
 
-       reg = ipa_reg(ipa, FILT_ROUT_HASH_FLUSH);
-       offset = ipa_reg_offset(reg);
+       if (ipa->version < IPA_VERSION_5_0) {
+               reg = ipa_reg(ipa, FILT_ROUT_HASH_FLUSH);
+               offset = ipa_reg_offset(reg);
 
-       val = ipa_reg_bit(reg, IPV6_ROUTER_HASH);
-       val |= ipa_reg_bit(reg, IPV6_FILTER_HASH);
-       val |= ipa_reg_bit(reg, IPV4_ROUTER_HASH);
-       val |= ipa_reg_bit(reg, IPV4_FILTER_HASH);
+               val = ipa_reg_bit(reg, IPV6_ROUTER_HASH);
+               val |= ipa_reg_bit(reg, IPV6_FILTER_HASH);
+               val |= ipa_reg_bit(reg, IPV4_ROUTER_HASH);
+               val |= ipa_reg_bit(reg, IPV4_FILTER_HASH);
+       } else {
+               reg = ipa_reg(ipa, FILT_ROUT_CACHE_FLUSH);
+               offset = ipa_reg_offset(reg);
+
+               /* IPA v5.0+ uses a unified cache (both IPv4 and IPv6) */
+               val = ipa_reg_bit(reg, ROUTER_CACHE);
+               val |= ipa_reg_bit(reg, FILTER_CACHE);
+       }
 
        ipa_cmd_register_write_add(trans, offset, val, val, false);