* [PATCH net-next v2 1/8] net: ipa: maintain bitmap of suspend-enabled endpoints
2024-04-19 15:17 [PATCH net-next v2 0/8] net: ipa: eight simple cleanups Alex Elder
@ 2024-04-19 15:17 ` Alex Elder
2024-04-19 15:17 ` [PATCH net-next v2 2/8] net: ipa: only enable the SUSPEND IPA interrupt when needed Alex Elder
` (7 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Alex Elder @ 2024-04-19 15:17 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: mka, andersson, quic_cpratapa, quic_avuyyuru, quic_jponduru,
quic_subashab, elder, netdev, linux-arm-msm, linux-kernel
Keep track of which endpoints have the SUSPEND IPA interrupt enabled
in a variable-length bitmap. This will be used in the next patch to
allow the SUSPEND interrupt type to be disabled except when needed.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa_interrupt.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c
index 4d472f4b0002e..18036e9cd161f 100644
--- a/drivers/net/ipa/ipa_interrupt.c
+++ b/drivers/net/ipa/ipa_interrupt.c
@@ -37,11 +37,13 @@
* @ipa: IPA pointer
* @irq: Linux IRQ number used for IPA interrupts
* @enabled: Mask indicating which interrupts are enabled
+ * @suspend_enabled: Bitmap of endpoints with the SUSPEND interrupt enabled
*/
struct ipa_interrupt {
struct ipa *ipa;
u32 irq;
u32 enabled;
+ unsigned long *suspend_enabled;
};
/* Clear the suspend interrupt for all endpoints that signaled it */
@@ -211,6 +213,7 @@ static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt,
val |= mask;
else
val &= ~mask;
+ __change_bit(endpoint_id, interrupt->suspend_enabled);
iowrite32(val, ipa->reg_virt + offset);
}
@@ -246,7 +249,16 @@ int ipa_interrupt_config(struct ipa *ipa)
interrupt->ipa = ipa;
- /* Disable all IPA interrupt types */
+ /* Initially all IPA interrupt types are disabled */
+ interrupt->enabled = 0;
+ interrupt->suspend_enabled = bitmap_zalloc(ipa->endpoint_count,
+ GFP_KERNEL);
+ if (!interrupt->suspend_enabled) {
+ ret = -ENOMEM;
+ goto err_kfree;
+ }
+
+ /* Disable IPA interrupt types */
reg = ipa_reg(ipa, IPA_IRQ_EN);
iowrite32(0, ipa->reg_virt + reg_offset(reg));
@@ -254,7 +266,7 @@ int ipa_interrupt_config(struct ipa *ipa)
"ipa", interrupt);
if (ret) {
dev_err(dev, "error %d requesting \"ipa\" IRQ\n", ret);
- goto err_kfree;
+ goto err_free_bitmap;
}
ret = dev_pm_set_wake_irq(dev, irq);
@@ -270,6 +282,8 @@ int ipa_interrupt_config(struct ipa *ipa)
err_free_irq:
free_irq(interrupt->irq, interrupt);
+err_free_bitmap:
+ bitmap_free(interrupt->suspend_enabled);
err_kfree:
kfree(interrupt);
@@ -286,6 +300,7 @@ void ipa_interrupt_deconfig(struct ipa *ipa)
dev_pm_clear_wake_irq(dev);
free_irq(interrupt->irq, interrupt);
+ bitmap_free(interrupt->suspend_enabled);
}
/* Initialize the IPA interrupt structure */
--
2.40.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH net-next v2 2/8] net: ipa: only enable the SUSPEND IPA interrupt when needed
2024-04-19 15:17 [PATCH net-next v2 0/8] net: ipa: eight simple cleanups Alex Elder
2024-04-19 15:17 ` [PATCH net-next v2 1/8] net: ipa: maintain bitmap of suspend-enabled endpoints Alex Elder
@ 2024-04-19 15:17 ` Alex Elder
2024-04-19 15:17 ` [PATCH net-next v2 3/8] net: ipa: call device_init_wakeup() earlier Alex Elder
` (6 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Alex Elder @ 2024-04-19 15:17 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: mka, andersson, quic_cpratapa, quic_avuyyuru, quic_jponduru,
quic_subashab, elder, netdev, linux-arm-msm, linux-kernel
Only enable the SUSPEND IPA interrupt type when at least one
endpoint has that interrupt enabled.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa_interrupt.c | 8 ++++++++
drivers/net/ipa/ipa_power.c | 11 +----------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c
index 18036e9cd161f..2ef640f9197c7 100644
--- a/drivers/net/ipa/ipa_interrupt.c
+++ b/drivers/net/ipa/ipa_interrupt.c
@@ -196,6 +196,7 @@ static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt,
u32 mask = BIT(endpoint_id % 32);
u32 unit = endpoint_id / 32;
const struct reg *reg;
+ unsigned long weight;
u32 offset;
u32 val;
@@ -205,6 +206,10 @@ static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt,
if (ipa->version == IPA_VERSION_3_0)
return;
+ weight = bitmap_weight(interrupt->suspend_enabled, ipa->endpoint_count);
+ if (weight == 1 && !enable)
+ ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND);
+
reg = ipa_reg(ipa, IRQ_SUSPEND_EN);
offset = reg_n_offset(reg, unit);
val = ioread32(ipa->reg_virt + offset);
@@ -216,6 +221,9 @@ static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt,
__change_bit(endpoint_id, interrupt->suspend_enabled);
iowrite32(val, ipa->reg_virt + offset);
+
+ if (!weight && enable)
+ ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND);
}
/* Enable TX_SUSPEND for an endpoint */
diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c
index 3a7049923c381..1a413061472d8 100644
--- a/drivers/net/ipa/ipa_power.c
+++ b/drivers/net/ipa/ipa_power.c
@@ -234,21 +234,12 @@ void ipa_power_retention(struct ipa *ipa, bool enable)
int ipa_power_setup(struct ipa *ipa)
{
- int ret;
-
- ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND);
-
- ret = device_init_wakeup(ipa->dev, true);
- if (ret)
- ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND);
-
- return ret;
+ return device_init_wakeup(ipa->dev, true);
}
void ipa_power_teardown(struct ipa *ipa)
{
(void)device_init_wakeup(ipa->dev, false);
- ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND);
}
/* Initialize IPA power management */
--
2.40.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH net-next v2 3/8] net: ipa: call device_init_wakeup() earlier
2024-04-19 15:17 [PATCH net-next v2 0/8] net: ipa: eight simple cleanups Alex Elder
2024-04-19 15:17 ` [PATCH net-next v2 1/8] net: ipa: maintain bitmap of suspend-enabled endpoints Alex Elder
2024-04-19 15:17 ` [PATCH net-next v2 2/8] net: ipa: only enable the SUSPEND IPA interrupt when needed Alex Elder
@ 2024-04-19 15:17 ` Alex Elder
2024-04-19 15:17 ` [PATCH net-next v2 4/8] net: ipa: remove unneeded FILT_ROUT_HASH_EN definitions Alex Elder
` (5 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Alex Elder @ 2024-04-19 15:17 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: mka, andersson, quic_cpratapa, quic_avuyyuru, quic_jponduru,
quic_subashab, elder, netdev, linux-arm-msm, linux-kernel
Currently, enabling wakeup for the IPA device doesn't occur until
the setup phase of initialization (in ipa_power_setup()).
There is no need to delay doing that, however. We can conveniently
do it during the config phase, in ipa_interrupt_config(), where we
enable power management wakeup mode for the IPA interrupt.
Moving the device_init_wakeup() out of ipa_power_setup() leaves that
function empty, so it can just be eliminated.
Similarly, rearrange all of the matching inverse calls, disabling
device wakeup in ipa_interrupt_deconfig() and removing that function
as well.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa_interrupt.c | 11 ++++++++++-
drivers/net/ipa/ipa_main.c | 7 -------
drivers/net/ipa/ipa_power.c | 10 ----------
drivers/net/ipa/ipa_power.h | 14 --------------
4 files changed, 10 insertions(+), 32 deletions(-)
diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c
index 2ef640f9197c7..245a069970556 100644
--- a/drivers/net/ipa/ipa_interrupt.c
+++ b/drivers/net/ipa/ipa_interrupt.c
@@ -277,17 +277,25 @@ int ipa_interrupt_config(struct ipa *ipa)
goto err_free_bitmap;
}
+ ret = device_init_wakeup(dev, true);
+ if (ret) {
+ dev_err(dev, "error %d enabling wakeup\n", ret);
+ goto err_free_irq;
+ }
+
ret = dev_pm_set_wake_irq(dev, irq);
if (ret) {
dev_err(dev, "error %d registering \"ipa\" IRQ as wakeirq\n",
ret);
- goto err_free_irq;
+ goto err_disable_wakeup;
}
ipa->interrupt = interrupt;
return 0;
+err_disable_wakeup:
+ (void)device_init_wakeup(dev, false);
err_free_irq:
free_irq(interrupt->irq, interrupt);
err_free_bitmap:
@@ -307,6 +315,7 @@ void ipa_interrupt_deconfig(struct ipa *ipa)
ipa->interrupt = NULL;
dev_pm_clear_wake_irq(dev);
+ (void)device_init_wakeup(dev, false);
free_irq(interrupt->irq, interrupt);
bitmap_free(interrupt->suspend_enabled);
}
diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c
index 6523878c0d7f6..b13a59f27106d 100644
--- a/drivers/net/ipa/ipa_main.c
+++ b/drivers/net/ipa/ipa_main.c
@@ -119,10 +119,6 @@ int ipa_setup(struct ipa *ipa)
if (ret)
return ret;
- ret = ipa_power_setup(ipa);
- if (ret)
- goto err_gsi_teardown;
-
ipa_endpoint_setup(ipa);
/* We need to use the AP command TX endpoint to perform other
@@ -169,8 +165,6 @@ int ipa_setup(struct ipa *ipa)
ipa_endpoint_disable_one(command_endpoint);
err_endpoint_teardown:
ipa_endpoint_teardown(ipa);
- ipa_power_teardown(ipa);
-err_gsi_teardown:
gsi_teardown(&ipa->gsi);
return ret;
@@ -195,7 +189,6 @@ static void ipa_teardown(struct ipa *ipa)
command_endpoint = ipa->name_map[IPA_ENDPOINT_AP_COMMAND_TX];
ipa_endpoint_disable_one(command_endpoint);
ipa_endpoint_teardown(ipa);
- ipa_power_teardown(ipa);
gsi_teardown(&ipa->gsi);
}
diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c
index 1a413061472d8..65fd14da0f86f 100644
--- a/drivers/net/ipa/ipa_power.c
+++ b/drivers/net/ipa/ipa_power.c
@@ -232,16 +232,6 @@ void ipa_power_retention(struct ipa *ipa, bool enable)
ret, enable ? "en" : "dis");
}
-int ipa_power_setup(struct ipa *ipa)
-{
- return device_init_wakeup(ipa->dev, true);
-}
-
-void ipa_power_teardown(struct ipa *ipa)
-{
- (void)device_init_wakeup(ipa->dev, false);
-}
-
/* Initialize IPA power management */
struct ipa_power *
ipa_power_init(struct device *dev, const struct ipa_power_data *data)
diff --git a/drivers/net/ipa/ipa_power.h b/drivers/net/ipa/ipa_power.h
index 3ffaa0687caa8..a83524a61c28b 100644
--- a/drivers/net/ipa/ipa_power.h
+++ b/drivers/net/ipa/ipa_power.h
@@ -31,20 +31,6 @@ u32 ipa_core_clock_rate(struct ipa *ipa);
*/
void ipa_power_retention(struct ipa *ipa, bool enable);
-/**
- * ipa_power_setup() - Set up IPA power management
- * @ipa: IPA pointer
- *
- * Return: 0 if successful, or a negative error code
- */
-int ipa_power_setup(struct ipa *ipa);
-
-/**
- * ipa_power_teardown() - Inverse of ipa_power_setup()
- * @ipa: IPA pointer
- */
-void ipa_power_teardown(struct ipa *ipa);
-
/**
* ipa_power_init() - Initialize IPA power management
* @dev: IPA device
--
2.40.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH net-next v2 4/8] net: ipa: remove unneeded FILT_ROUT_HASH_EN definitions
2024-04-19 15:17 [PATCH net-next v2 0/8] net: ipa: eight simple cleanups Alex Elder
` (2 preceding siblings ...)
2024-04-19 15:17 ` [PATCH net-next v2 3/8] net: ipa: call device_init_wakeup() earlier Alex Elder
@ 2024-04-19 15:17 ` Alex Elder
2024-04-19 15:17 ` [PATCH net-next v2 5/8] net: ipa: make ipa_table_hash_support() a real function Alex Elder
` (4 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Alex Elder @ 2024-04-19 15:17 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: mka, andersson, quic_cpratapa, quic_avuyyuru, quic_jponduru,
quic_subashab, elder, netdev, linux-arm-msm, linux-kernel
The FILT_ROUT_HASH_EN register is only used for IPA v4.2. There,
routing and filter table hashing are not supported, and so the
register must be written to disable the feature. No other version
uses this register, so its definition can be removed. If we need to
use these some day (for example, explicitly enable the feature) this
commit can be reverted.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/reg/ipa_reg-v3.1.c | 14 --------------
drivers/net/ipa/reg/ipa_reg-v3.5.1.c | 14 --------------
drivers/net/ipa/reg/ipa_reg-v4.11.c | 14 --------------
drivers/net/ipa/reg/ipa_reg-v4.5.c | 14 --------------
drivers/net/ipa/reg/ipa_reg-v4.7.c | 14 --------------
drivers/net/ipa/reg/ipa_reg-v4.9.c | 14 --------------
6 files changed, 84 deletions(-)
diff --git a/drivers/net/ipa/reg/ipa_reg-v3.1.c b/drivers/net/ipa/reg/ipa_reg-v3.1.c
index 63a44dce88353..a891037015836 100644
--- a/drivers/net/ipa/reg/ipa_reg-v3.1.c
+++ b/drivers/net/ipa/reg/ipa_reg-v3.1.c
@@ -78,19 +78,6 @@ static const u32 reg_qsb_max_reads_fmask[] = {
REG_FIELDS(QSB_MAX_READS, qsb_max_reads, 0x00000078);
-static const u32 reg_filt_rout_hash_en_fmask[] = {
- [IPV6_ROUTER_HASH] = BIT(0),
- /* Bits 1-3 reserved */
- [IPV6_FILTER_HASH] = BIT(4),
- /* Bits 5-7 reserved */
- [IPV4_ROUTER_HASH] = BIT(8),
- /* Bits 9-11 reserved */
- [IPV4_FILTER_HASH] = BIT(12),
- /* Bits 13-31 reserved */
-};
-
-REG_FIELDS(FILT_ROUT_HASH_EN, filt_rout_hash_en, 0x000008c);
-
static const u32 reg_filt_rout_hash_flush_fmask[] = {
[IPV6_ROUTER_HASH] = BIT(0),
/* Bits 1-3 reserved */
@@ -405,7 +392,6 @@ static const struct reg *reg_array[] = {
[SHARED_MEM_SIZE] = ®_shared_mem_size,
[QSB_MAX_WRITES] = ®_qsb_max_writes,
[QSB_MAX_READS] = ®_qsb_max_reads,
- [FILT_ROUT_HASH_EN] = ®_filt_rout_hash_en,
[FILT_ROUT_HASH_FLUSH] = ®_filt_rout_hash_flush,
[STATE_AGGR_ACTIVE] = ®_state_aggr_active,
[IPA_BCR] = ®_ipa_bcr,
diff --git a/drivers/net/ipa/reg/ipa_reg-v3.5.1.c b/drivers/net/ipa/reg/ipa_reg-v3.5.1.c
index 4a7b6d92207de..c81c48ec51f90 100644
--- a/drivers/net/ipa/reg/ipa_reg-v3.5.1.c
+++ b/drivers/net/ipa/reg/ipa_reg-v3.5.1.c
@@ -83,19 +83,6 @@ static const u32 reg_qsb_max_reads_fmask[] = {
REG_FIELDS(QSB_MAX_READS, qsb_max_reads, 0x00000078);
-static const u32 reg_filt_rout_hash_en_fmask[] = {
- [IPV6_ROUTER_HASH] = BIT(0),
- /* Bits 1-3 reserved */
- [IPV6_FILTER_HASH] = BIT(4),
- /* Bits 5-7 reserved */
- [IPV4_ROUTER_HASH] = BIT(8),
- /* Bits 9-11 reserved */
- [IPV4_FILTER_HASH] = BIT(12),
- /* Bits 13-31 reserved */
-};
-
-REG_FIELDS(FILT_ROUT_HASH_EN, filt_rout_hash_en, 0x000008c);
-
static const u32 reg_filt_rout_hash_flush_fmask[] = {
[IPV6_ROUTER_HASH] = BIT(0),
/* Bits 1-3 reserved */
@@ -416,7 +403,6 @@ static const struct reg *reg_array[] = {
[SHARED_MEM_SIZE] = ®_shared_mem_size,
[QSB_MAX_WRITES] = ®_qsb_max_writes,
[QSB_MAX_READS] = ®_qsb_max_reads,
- [FILT_ROUT_HASH_EN] = ®_filt_rout_hash_en,
[FILT_ROUT_HASH_FLUSH] = ®_filt_rout_hash_flush,
[STATE_AGGR_ACTIVE] = ®_state_aggr_active,
[IPA_BCR] = ®_ipa_bcr,
diff --git a/drivers/net/ipa/reg/ipa_reg-v4.11.c b/drivers/net/ipa/reg/ipa_reg-v4.11.c
index 257eaff9436e5..18bddc32c9318 100644
--- a/drivers/net/ipa/reg/ipa_reg-v4.11.c
+++ b/drivers/net/ipa/reg/ipa_reg-v4.11.c
@@ -115,19 +115,6 @@ static const u32 reg_qsb_max_reads_fmask[] = {
REG_FIELDS(QSB_MAX_READS, qsb_max_reads, 0x00000078);
-static const u32 reg_filt_rout_hash_en_fmask[] = {
- [IPV6_ROUTER_HASH] = BIT(0),
- /* Bits 1-3 reserved */
- [IPV6_FILTER_HASH] = BIT(4),
- /* Bits 5-7 reserved */
- [IPV4_ROUTER_HASH] = BIT(8),
- /* Bits 9-11 reserved */
- [IPV4_FILTER_HASH] = BIT(12),
- /* Bits 13-31 reserved */
-};
-
-REG_FIELDS(FILT_ROUT_HASH_EN, filt_rout_hash_en, 0x0000148);
-
static const u32 reg_filt_rout_hash_flush_fmask[] = {
[IPV6_ROUTER_HASH] = BIT(0),
/* Bits 1-3 reserved */
@@ -472,7 +459,6 @@ static const struct reg *reg_array[] = {
[SHARED_MEM_SIZE] = ®_shared_mem_size,
[QSB_MAX_WRITES] = ®_qsb_max_writes,
[QSB_MAX_READS] = ®_qsb_max_reads,
- [FILT_ROUT_HASH_EN] = ®_filt_rout_hash_en,
[FILT_ROUT_HASH_FLUSH] = ®_filt_rout_hash_flush,
[STATE_AGGR_ACTIVE] = ®_state_aggr_active,
[LOCAL_PKT_PROC_CNTXT] = ®_local_pkt_proc_cntxt,
diff --git a/drivers/net/ipa/reg/ipa_reg-v4.5.c b/drivers/net/ipa/reg/ipa_reg-v4.5.c
index dc396344d868a..8494731efdd3b 100644
--- a/drivers/net/ipa/reg/ipa_reg-v4.5.c
+++ b/drivers/net/ipa/reg/ipa_reg-v4.5.c
@@ -109,19 +109,6 @@ static const u32 reg_qsb_max_reads_fmask[] = {
REG_FIELDS(QSB_MAX_READS, qsb_max_reads, 0x00000078);
-static const u32 reg_filt_rout_hash_en_fmask[] = {
- [IPV6_ROUTER_HASH] = BIT(0),
- /* Bits 1-3 reserved */
- [IPV6_FILTER_HASH] = BIT(4),
- /* Bits 5-7 reserved */
- [IPV4_ROUTER_HASH] = BIT(8),
- /* Bits 9-11 reserved */
- [IPV4_FILTER_HASH] = BIT(12),
- /* Bits 13-31 reserved */
-};
-
-REG_FIELDS(FILT_ROUT_HASH_EN, filt_rout_hash_en, 0x0000148);
-
static const u32 reg_filt_rout_hash_flush_fmask[] = {
[IPV6_ROUTER_HASH] = BIT(0),
/* Bits 1-3 reserved */
@@ -491,7 +478,6 @@ static const struct reg *reg_array[] = {
[SHARED_MEM_SIZE] = ®_shared_mem_size,
[QSB_MAX_WRITES] = ®_qsb_max_writes,
[QSB_MAX_READS] = ®_qsb_max_reads,
- [FILT_ROUT_HASH_EN] = ®_filt_rout_hash_en,
[FILT_ROUT_HASH_FLUSH] = ®_filt_rout_hash_flush,
[STATE_AGGR_ACTIVE] = ®_state_aggr_active,
[LOCAL_PKT_PROC_CNTXT] = ®_local_pkt_proc_cntxt,
diff --git a/drivers/net/ipa/reg/ipa_reg-v4.7.c b/drivers/net/ipa/reg/ipa_reg-v4.7.c
index 37a2e466e4755..2c161cf691935 100644
--- a/drivers/net/ipa/reg/ipa_reg-v4.7.c
+++ b/drivers/net/ipa/reg/ipa_reg-v4.7.c
@@ -109,19 +109,6 @@ static const u32 reg_qsb_max_reads_fmask[] = {
REG_FIELDS(QSB_MAX_READS, qsb_max_reads, 0x00000078);
-static const u32 reg_filt_rout_hash_en_fmask[] = {
- [IPV6_ROUTER_HASH] = BIT(0),
- /* Bits 1-3 reserved */
- [IPV6_FILTER_HASH] = BIT(4),
- /* Bits 5-7 reserved */
- [IPV4_ROUTER_HASH] = BIT(8),
- /* Bits 9-11 reserved */
- [IPV4_FILTER_HASH] = BIT(12),
- /* Bits 13-31 reserved */
-};
-
-REG_FIELDS(FILT_ROUT_HASH_EN, filt_rout_hash_en, 0x0000148);
-
static const u32 reg_filt_rout_hash_flush_fmask[] = {
[IPV6_ROUTER_HASH] = BIT(0),
/* Bits 1-3 reserved */
@@ -464,7 +451,6 @@ static const struct reg *reg_array[] = {
[SHARED_MEM_SIZE] = ®_shared_mem_size,
[QSB_MAX_WRITES] = ®_qsb_max_writes,
[QSB_MAX_READS] = ®_qsb_max_reads,
- [FILT_ROUT_HASH_EN] = ®_filt_rout_hash_en,
[FILT_ROUT_HASH_FLUSH] = ®_filt_rout_hash_flush,
[STATE_AGGR_ACTIVE] = ®_state_aggr_active,
[LOCAL_PKT_PROC_CNTXT] = ®_local_pkt_proc_cntxt,
diff --git a/drivers/net/ipa/reg/ipa_reg-v4.9.c b/drivers/net/ipa/reg/ipa_reg-v4.9.c
index 09755d700784e..fa6fd312e4867 100644
--- a/drivers/net/ipa/reg/ipa_reg-v4.9.c
+++ b/drivers/net/ipa/reg/ipa_reg-v4.9.c
@@ -114,19 +114,6 @@ static const u32 reg_qsb_max_reads_fmask[] = {
REG_FIELDS(QSB_MAX_READS, qsb_max_reads, 0x00000078);
-static const u32 reg_filt_rout_hash_en_fmask[] = {
- [IPV6_ROUTER_HASH] = BIT(0),
- /* Bits 1-3 reserved */
- [IPV6_FILTER_HASH] = BIT(4),
- /* Bits 5-7 reserved */
- [IPV4_ROUTER_HASH] = BIT(8),
- /* Bits 9-11 reserved */
- [IPV4_FILTER_HASH] = BIT(12),
- /* Bits 13-31 reserved */
-};
-
-REG_FIELDS(FILT_ROUT_HASH_EN, filt_rout_hash_en, 0x0000148);
-
static const u32 reg_filt_rout_hash_flush_fmask[] = {
[IPV6_ROUTER_HASH] = BIT(0),
/* Bits 1-3 reserved */
@@ -469,7 +456,6 @@ static const struct reg *reg_array[] = {
[SHARED_MEM_SIZE] = ®_shared_mem_size,
[QSB_MAX_WRITES] = ®_qsb_max_writes,
[QSB_MAX_READS] = ®_qsb_max_reads,
- [FILT_ROUT_HASH_EN] = ®_filt_rout_hash_en,
[FILT_ROUT_HASH_FLUSH] = ®_filt_rout_hash_flush,
[STATE_AGGR_ACTIVE] = ®_state_aggr_active,
[LOCAL_PKT_PROC_CNTXT] = ®_local_pkt_proc_cntxt,
--
2.40.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH net-next v2 5/8] net: ipa: make ipa_table_hash_support() a real function
2024-04-19 15:17 [PATCH net-next v2 0/8] net: ipa: eight simple cleanups Alex Elder
` (3 preceding siblings ...)
2024-04-19 15:17 ` [PATCH net-next v2 4/8] net: ipa: remove unneeded FILT_ROUT_HASH_EN definitions Alex Elder
@ 2024-04-19 15:17 ` Alex Elder
2024-04-19 15:17 ` [PATCH net-next v2 6/8] net: ipa: fix two bogus argument names Alex Elder
` (3 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Alex Elder @ 2024-04-19 15:17 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: mka, andersson, quic_cpratapa, quic_avuyyuru, quic_jponduru,
quic_subashab, elder, netdev, linux-arm-msm, linux-kernel
With the exception of ipa_table_hash_support(), nothing defined in
"ipa_table.h" requires the full definition of the IPA structure.
Change that function to be a "real" function rather than an inline,
to avoid requring the IPA structure to be defined.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa_table.c | 8 +++++++-
drivers/net/ipa/ipa_table.h | 7 ++-----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c
index 45eb24be78a2e..4e4a3f8aa8e84 100644
--- a/drivers/net/ipa/ipa_table.c
+++ b/drivers/net/ipa/ipa_table.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- * Copyright (C) 2018-2023 Linaro Ltd.
+ * Copyright (C) 2018-2024 Linaro Ltd.
*/
#include <linux/bitops.h>
@@ -158,6 +158,12 @@ ipa_table_mem(struct ipa *ipa, bool filter, bool hashed, bool ipv6)
return ipa_mem_find(ipa, mem_id);
}
+/* Return true if hashed tables are supported */
+bool ipa_table_hash_support(struct ipa *ipa)
+{
+ return ipa->version != IPA_VERSION_4_2;
+}
+
bool ipa_filtered_valid(struct ipa *ipa, u64 filtered)
{
struct device *dev = ipa->dev;
diff --git a/drivers/net/ipa/ipa_table.h b/drivers/net/ipa/ipa_table.h
index 7cc951904bb48..16d4d15df9e9c 100644
--- a/drivers/net/ipa/ipa_table.h
+++ b/drivers/net/ipa/ipa_table.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- * Copyright (C) 2019-2022 Linaro Ltd.
+ * Copyright (C) 2019-2024 Linaro Ltd.
*/
#ifndef _IPA_TABLE_H_
#define _IPA_TABLE_H_
@@ -23,10 +23,7 @@ bool ipa_filtered_valid(struct ipa *ipa, u64 filtered);
* ipa_table_hash_support() - Return true if hashed tables are supported
* @ipa: IPA pointer
*/
-static inline bool ipa_table_hash_support(struct ipa *ipa)
-{
- return ipa->version != IPA_VERSION_4_2;
-}
+bool ipa_table_hash_support(struct ipa *ipa);
/**
* ipa_table_reset() - Reset filter and route tables entries to "none"
--
2.40.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH net-next v2 6/8] net: ipa: fix two bogus argument names
2024-04-19 15:17 [PATCH net-next v2 0/8] net: ipa: eight simple cleanups Alex Elder
` (4 preceding siblings ...)
2024-04-19 15:17 ` [PATCH net-next v2 5/8] net: ipa: make ipa_table_hash_support() a real function Alex Elder
@ 2024-04-19 15:17 ` Alex Elder
2024-04-19 15:17 ` [PATCH net-next v2 7/8] net: ipa: fix two minor ipa_cmd problems Alex Elder
` (2 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Alex Elder @ 2024-04-19 15:17 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: mka, andersson, quic_cpratapa, quic_avuyyuru, quic_jponduru,
quic_subashab, elder, netdev, linux-arm-msm, linux-kernel
In "ipa_endpoint.h", two function declarations have bogus argument
names. Fix these.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa_endpoint.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ipa/ipa_endpoint.h b/drivers/net/ipa/ipa_endpoint.h
index 328b90dfd1695..e7d8ae6c6f6a6 100644
--- a/drivers/net/ipa/ipa_endpoint.h
+++ b/drivers/net/ipa/ipa_endpoint.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
- * Copyright (C) 2019-2023 Linaro Ltd.
+ * Copyright (C) 2019-2024 Linaro Ltd.
*/
#ifndef _IPA_ENDPOINT_H_
#define _IPA_ENDPOINT_H_
@@ -199,9 +199,9 @@ int ipa_endpoint_init(struct ipa *ipa, u32 count,
const struct ipa_gsi_endpoint_data *data);
void ipa_endpoint_exit(struct ipa *ipa);
-void ipa_endpoint_trans_complete(struct ipa_endpoint *ipa,
+void ipa_endpoint_trans_complete(struct ipa_endpoint *endpoint,
struct gsi_trans *trans);
-void ipa_endpoint_trans_release(struct ipa_endpoint *ipa,
+void ipa_endpoint_trans_release(struct ipa_endpoint *endpoint,
struct gsi_trans *trans);
#endif /* _IPA_ENDPOINT_H_ */
--
2.40.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH net-next v2 7/8] net: ipa: fix two minor ipa_cmd problems
2024-04-19 15:17 [PATCH net-next v2 0/8] net: ipa: eight simple cleanups Alex Elder
` (5 preceding siblings ...)
2024-04-19 15:17 ` [PATCH net-next v2 6/8] net: ipa: fix two bogus argument names Alex Elder
@ 2024-04-19 15:17 ` Alex Elder
2024-04-23 11:21 ` Paolo Abeni
2024-04-19 15:18 ` [PATCH net-next v2 8/8] net: ipa: kill ipa_version_supported() Alex Elder
2024-04-23 11:30 ` [PATCH net-next v2 0/8] net: ipa: eight simple cleanups patchwork-bot+netdevbpf
8 siblings, 1 reply; 12+ messages in thread
From: Alex Elder @ 2024-04-19 15:17 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: mka, andersson, quic_cpratapa, quic_avuyyuru, quic_jponduru,
quic_subashab, elder, netdev, linux-arm-msm, linux-kernel
In "ipa_cmd.h", ipa_cmd_data_valid() is declared, but that function
does not exist. So delete that declaration.
Also, for some reason ipa_cmd_init() never gets called. It isn't
really critical--it just validates that some memory offsets and a
size can be represented in some register fields, and they won't fail
with current data. Regardless, call the function in ipa_probe().
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa_cmd.h | 8 --------
drivers/net/ipa/ipa_main.c | 4 ++++
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ipa/ipa_cmd.h b/drivers/net/ipa/ipa_cmd.h
index 5824bb131ebab..2077fdbade99c 100644
--- a/drivers/net/ipa/ipa_cmd.h
+++ b/drivers/net/ipa/ipa_cmd.h
@@ -53,14 +53,6 @@ enum ipa_cmd_opcode {
bool ipa_cmd_table_init_valid(struct ipa *ipa, const struct ipa_mem *mem,
bool route);
-/**
- * ipa_cmd_data_valid() - Validate command-realted configuration is valid
- * @ipa: - IPA pointer
- *
- * Return: true if assumptions required for command are valid
- */
-bool ipa_cmd_data_valid(struct ipa *ipa);
-
/**
* ipa_cmd_pool_init() - initialize command channel pools
* @channel: AP->IPA command TX GSI channel pointer
diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c
index b13a59f27106d..6a0fec873cddf 100644
--- a/drivers/net/ipa/ipa_main.c
+++ b/drivers/net/ipa/ipa_main.c
@@ -865,6 +865,10 @@ static int ipa_probe(struct platform_device *pdev)
if (ret)
goto err_reg_exit;
+ ret = ipa_cmd_init(ipa);
+ if (ret)
+ goto err_mem_exit;
+
ret = gsi_init(&ipa->gsi, pdev, ipa->version, data->endpoint_count,
data->endpoint_data);
if (ret)
--
2.40.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH net-next v2 7/8] net: ipa: fix two minor ipa_cmd problems
2024-04-19 15:17 ` [PATCH net-next v2 7/8] net: ipa: fix two minor ipa_cmd problems Alex Elder
@ 2024-04-23 11:21 ` Paolo Abeni
2024-04-23 12:36 ` Alex Elder
0 siblings, 1 reply; 12+ messages in thread
From: Paolo Abeni @ 2024-04-23 11:21 UTC (permalink / raw)
To: Alex Elder, davem, edumazet, kuba
Cc: mka, andersson, quic_cpratapa, quic_avuyyuru, quic_jponduru,
quic_subashab, elder, netdev, linux-arm-msm, linux-kernel
On Fri, 2024-04-19 at 10:17 -0500, Alex Elder wrote:
> In "ipa_cmd.h", ipa_cmd_data_valid() is declared, but that function
> does not exist. So delete that declaration.
>
> Also, for some reason ipa_cmd_init() never gets called. It isn't
> really critical--it just validates that some memory offsets and a
> size can be represented in some register fields, and they won't fail
> with current data. Regardless, call the function in ipa_probe().
That name sounds confusing to me: I expect *init to allocate/set
something that will need some reverse operation at shutdown/removal.
What about a possible follow-up renaming the function to
ipa_cmd_validate() or the like?
Not blocking the series, I'm applying it.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next v2 7/8] net: ipa: fix two minor ipa_cmd problems
2024-04-23 11:21 ` Paolo Abeni
@ 2024-04-23 12:36 ` Alex Elder
0 siblings, 0 replies; 12+ messages in thread
From: Alex Elder @ 2024-04-23 12:36 UTC (permalink / raw)
To: Paolo Abeni, davem, edumazet, kuba
Cc: mka, andersson, quic_cpratapa, quic_avuyyuru, quic_jponduru,
quic_subashab, elder, netdev, linux-arm-msm, linux-kernel
On 4/23/24 6:21 AM, Paolo Abeni wrote:
> On Fri, 2024-04-19 at 10:17 -0500, Alex Elder wrote:
>> In "ipa_cmd.h", ipa_cmd_data_valid() is declared, but that function
>> does not exist. So delete that declaration.
>>
>> Also, for some reason ipa_cmd_init() never gets called. It isn't
>> really critical--it just validates that some memory offsets and a
>> size can be represented in some register fields, and they won't fail
>> with current data. Regardless, call the function in ipa_probe().
>
> That name sounds confusing to me: I expect *init to allocate/set
> something that will need some reverse operation at shutdown/removal.
> What about a possible follow-up renaming the function to
> ipa_cmd_validate() or the like?
In the IPA driver I have several phases of initialization that
occur:
- *_init() is done to initialize anything (like allocating memory
and looking up DT information) that does not require any access
to hardware. Its inverse is *_exit().
- *_config() is done once "primitive" (register-based) access to
the hardware is needed, where the hardware must be clocked. Its
inverse is *_deconfig().
- *_setup() is done after the above, at a point where a higher-level
command-based (submit/await completion) interface is available.
That is used for the last steps of setting up the hardware. Its
inverse is *_teardown().
You're right, that in this case all this init function does is
validate things. But at an abstract level, this is the place
in the "IPA command" module where *any* early-stage initialization
takes place. The caller doesn't "know" that at the moment this
happens to only be validation. (I don't recall, but this might
previously have done some other things.)
So that's the reasoning behind the name. Changing it to
ipa_cmd_validate() makes sense too, but wouldn't fit the
pattern used elsewhere. I'm open to it though; it's just a
design choice. But unless you're convinced such a change
would really improve the code, I plan to leave it as-is.
> Not blocking the series, I'm applying it.
Thank you very much.
-Alex
> Thanks,
>
> Paolo
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net-next v2 8/8] net: ipa: kill ipa_version_supported()
2024-04-19 15:17 [PATCH net-next v2 0/8] net: ipa: eight simple cleanups Alex Elder
` (6 preceding siblings ...)
2024-04-19 15:17 ` [PATCH net-next v2 7/8] net: ipa: fix two minor ipa_cmd problems Alex Elder
@ 2024-04-19 15:18 ` Alex Elder
2024-04-23 11:30 ` [PATCH net-next v2 0/8] net: ipa: eight simple cleanups patchwork-bot+netdevbpf
8 siblings, 0 replies; 12+ messages in thread
From: Alex Elder @ 2024-04-19 15:18 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: mka, andersson, quic_cpratapa, quic_avuyyuru, quic_jponduru,
quic_subashab, elder, netdev, linux-arm-msm, linux-kernel
The only place ipa_version_supported() is called is in the probe
function. The version comes from the match data. Rather than
checking the version validity separately, just consider anything
that has match data to be supported.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa_main.c | 5 -----
drivers/net/ipa/ipa_version.h | 18 ------------------
2 files changed, 23 deletions(-)
diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c
index 6a0fec873cddf..5f3dd5a2dcf46 100644
--- a/drivers/net/ipa/ipa_main.c
+++ b/drivers/net/ipa/ipa_main.c
@@ -810,11 +810,6 @@ static int ipa_probe(struct platform_device *pdev)
return -ENODEV;
}
- if (!ipa_version_supported(data->version)) {
- dev_err(dev, "unsupported IPA version %u\n", data->version);
- return -EINVAL;
- }
-
if (!data->modem_route_count) {
dev_err(dev, "modem_route_count cannot be zero\n");
return -EINVAL;
diff --git a/drivers/net/ipa/ipa_version.h b/drivers/net/ipa/ipa_version.h
index 156388e90a141..38c47f51a50c9 100644
--- a/drivers/net/ipa/ipa_version.h
+++ b/drivers/net/ipa/ipa_version.h
@@ -47,24 +47,6 @@ enum ipa_version {
IPA_VERSION_COUNT, /* Last; not a version */
};
-static inline bool ipa_version_supported(enum ipa_version version)
-{
- switch (version) {
- case IPA_VERSION_3_1:
- case IPA_VERSION_3_5_1:
- case IPA_VERSION_4_2:
- case IPA_VERSION_4_5:
- case IPA_VERSION_4_7:
- case IPA_VERSION_4_9:
- case IPA_VERSION_4_11:
- case IPA_VERSION_5_0:
- case IPA_VERSION_5_5:
- return true;
- default:
- return false;
- }
-}
-
/* Execution environment IDs */
enum gsi_ee_id {
GSI_EE_AP = 0x0,
--
2.40.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH net-next v2 0/8] net: ipa: eight simple cleanups
2024-04-19 15:17 [PATCH net-next v2 0/8] net: ipa: eight simple cleanups Alex Elder
` (7 preceding siblings ...)
2024-04-19 15:18 ` [PATCH net-next v2 8/8] net: ipa: kill ipa_version_supported() Alex Elder
@ 2024-04-23 11:30 ` patchwork-bot+netdevbpf
8 siblings, 0 replies; 12+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-23 11:30 UTC (permalink / raw)
To: Alex Elder
Cc: davem, edumazet, kuba, pabeni, mka, andersson, quic_cpratapa,
quic_avuyyuru, quic_jponduru, quic_subashab, elder, netdev,
linux-arm-msm, linux-kernel
Hello:
This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Fri, 19 Apr 2024 10:17:52 -0500 you wrote:
> This series contains a mix of cleanups, some dating back to
> December, 2022. Version 1 was based on an older version of
> net-next/main; this version has simply been rebased.
>
> The first two make it so the IPA SUSPEND interrupt only gets enabled
> when necessary. That make it possible in the third patch to call
> device_init_wakeup() during an earlier phase of initialization, and
> remove two functions.
>
> [...]
Here is the summary with links:
- [net-next,v2,1/8] net: ipa: maintain bitmap of suspend-enabled endpoints
https://git.kernel.org/netdev/net-next/c/2eca73444036
- [net-next,v2,2/8] net: ipa: only enable the SUSPEND IPA interrupt when needed
https://git.kernel.org/netdev/net-next/c/6f3700266369
- [net-next,v2,3/8] net: ipa: call device_init_wakeup() earlier
https://git.kernel.org/netdev/net-next/c/19790951f031
- [net-next,v2,4/8] net: ipa: remove unneeded FILT_ROUT_HASH_EN definitions
https://git.kernel.org/netdev/net-next/c/5043d6b16211
- [net-next,v2,5/8] net: ipa: make ipa_table_hash_support() a real function
https://git.kernel.org/netdev/net-next/c/b81565b7fd02
- [net-next,v2,6/8] net: ipa: fix two bogus argument names
https://git.kernel.org/netdev/net-next/c/f2e4e9ea82f9
- [net-next,v2,7/8] net: ipa: fix two minor ipa_cmd problems
https://git.kernel.org/netdev/net-next/c/319b6d4ef087
- [net-next,v2,8/8] net: ipa: kill ipa_version_supported()
https://git.kernel.org/netdev/net-next/c/dfdd70e24e38
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 12+ messages in thread