From 5b8b2262b3b439a7d6e29e35051720a0fe6db518 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Mon, 9 Nov 2020 10:56:32 -0600 Subject: net: ipa: don't break build on large transaction size The following call in ipa_validate_build() is erroneous: BUILD_BUG_ON(sizeof(struct gsi_trans) > 128); The fact is, it is not a bug for the size of a GSI transaction to be bigger than 128 bytes. The correct operation of the driver is not dependent on the size of this structure. The only consequence of the transaction being large is that the amount of memory required is larger. The problem this was trying to flag is that a *slight* increase in the size of this structure will have a disproportionate effect on the amount of memory used. E.g. if the structure grew to 132 bytes the memory requirement for the transaction arrays would be about double. With various debugging build flags enabled, the size grows to 160 bytes. But there's no reason to treat that as a build-time bug. Signed-off-by: Alex Elder Signed-off-by: Jakub Kicinski --- drivers/net/ipa/ipa_main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index a580cab794b1..d1e582707800 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -680,9 +680,6 @@ static void ipa_validate_build(void) */ BUILD_BUG_ON(GSI_TLV_MAX > U8_MAX); - /* Exceeding 128 bytes makes the transaction pool *much* larger */ - BUILD_BUG_ON(sizeof(struct gsi_trans) > 128); - /* This is used as a divisor */ BUILD_BUG_ON(!IPA_AGGR_GRANULARITY); -- cgit v1.2.3 From 49e3aeeb211ca9f870e06b71b770d70343e5231f Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Mon, 9 Nov 2020 10:56:33 -0600 Subject: net: ipa: get rid of a useless line of code Delete a spurious line of code in ipa_hardware_config(). It reads a register value then ignores the value, so is completely unnecessary. Add a missing word in a comment. Signed-off-by: Alex Elder Signed-off-by: Jakub Kicinski --- drivers/net/ipa/ipa_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index d1e582707800..bfe95a46acaf 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -335,7 +335,6 @@ static void ipa_hardware_config(struct ipa *ipa) ipa_hardware_config_qsb(ipa); /* Configure aggregation granularity */ - val = ioread32(ipa->reg_virt + IPA_REG_COUNTER_CFG_OFFSET); granularity = ipa_aggr_granularity_val(IPA_AGGR_GRANULARITY); val = u32_encode_bits(granularity, AGGR_GRANULARITY); iowrite32(val, ipa->reg_virt + IPA_REG_COUNTER_CFG_OFFSET); @@ -787,7 +786,7 @@ static int ipa_probe(struct platform_device *pdev) if (ret) goto err_mem_exit; - /* Result is a non-zero mask endpoints that support filtering */ + /* Result is a non-zero mask of endpoints that support filtering */ ipa->filter_map = ipa_endpoint_init(ipa, data->endpoint_count, data->endpoint_data); if (!ipa->filter_map) { -- cgit v1.2.3 From 2c642c48b3620d85f4e0ac66de01195a6096b333 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Mon, 9 Nov 2020 10:56:34 -0600 Subject: net: ipa: change a warning to debug When we determine from hardware what the size of IPA memory is we compare it against what we learned about it from DT. If DT defines a region that's larger than actual memory, we use the smaller actual size and issue a warning. If DT defines a smaller region than actual memory we issue a warning too. But in this case the difference is harmless; so rather than issuing a warning, just provide a debug message instead. Reorder these checks so the one that matters more is done first. Reported-by: Stephen Boyd Signed-off-by: Alex Elder Signed-off-by: Jakub Kicinski --- drivers/net/ipa/ipa_mem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c index ecfd1f91fce3..0cc3a3374caa 100644 --- a/drivers/net/ipa/ipa_mem.c +++ b/drivers/net/ipa/ipa_mem.c @@ -160,13 +160,13 @@ int ipa_mem_config(struct ipa *ipa) mem_size = 8 * u32_get_bits(val, SHARED_MEM_SIZE_FMASK); /* If the sizes don't match, issue a warning */ - if (ipa->mem_offset + mem_size > ipa->mem_size) { - dev_warn(dev, "ignoring larger reported memory size: 0x%08x\n", - mem_size); - } else if (ipa->mem_offset + mem_size < ipa->mem_size) { + if (ipa->mem_offset + mem_size < ipa->mem_size) { dev_warn(dev, "limiting IPA memory size to 0x%08x\n", mem_size); ipa->mem_size = mem_size; + } else if (ipa->mem_offset + mem_size > ipa->mem_size) { + dev_dbg(dev, "ignoring larger reported memory size: 0x%08x\n", + mem_size); } /* Prealloc DMA memory for zeroing regions */ -- cgit v1.2.3 From bf795af1d42a6e7711e39c4fc64f452cc83dde97 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Mon, 9 Nov 2020 10:56:35 -0600 Subject: net: ipa: drop an error message There is no need for gsi_modem_channel_halt() to report an error, because gsi_generic_command() will already have done that if the command times out. So get rid of the extra message. Signed-off-by: Alex Elder Signed-off-by: Jakub Kicinski --- drivers/net/ipa/gsi.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 961a11d4fb27..3a5998a037da 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1661,12 +1661,7 @@ static int gsi_modem_channel_alloc(struct gsi *gsi, u32 channel_id) static void gsi_modem_channel_halt(struct gsi *gsi, u32 channel_id) { - int ret; - - ret = gsi_generic_command(gsi, channel_id, GSI_GENERIC_HALT_CHANNEL); - if (ret) - dev_err(gsi->dev, "error %d halting modem channel %u\n", - ret, channel_id); + (void)gsi_generic_command(gsi, channel_id, GSI_GENERIC_HALT_CHANNEL); } /* Setup function for channels */ -- cgit v1.2.3