android_kernel_xiaomi_sm8450/drivers/net/ipa
Alex Elder ddd47f1cd6 net: ipa: properly limit modem routing table use
[ Upstream commit cf412ec333250cb82bafe57169204e14a9f1c2ac ]

IPA can route packets between IPA-connected entities.  The AP and
modem are currently the only such entities supported, and no routing
is required to transfer packets between them.

The number of entries in each routing table is fixed, and defined at
initialization time.  Some of these entries are designated for use
by the modem, and the rest are available for the AP to use.  The AP
sends a QMI message to the modem which describes (among other
things) information about routing table memory available for the
modem to use.

Currently the QMI initialization packet gives wrong information in
its description of routing tables.  What *should* be supplied is the
maximum index that the modem can use for the routing table memory
located at a given location.  The current code instead supplies the
total *number* of routing table entries.  Furthermore, the modem is
granted the entire table, not just the subset it's supposed to use.

This patch fixes this.  First, the ipa_mem_bounds structure is
generalized so its "end" field can be interpreted either as a final
byte offset, or a final array index.  Second, the IPv4 and IPv6
(non-hashed and hashed) table information fields in the QMI
ipa_init_modem_driver_req structure are changed to be ipa_mem_bounds
rather than ipa_mem_array structures.  Third, we set the "end" value
for each routing table to be the last index, rather than setting the
"count" to be the number of indices.  Finally, instead of allowing
the modem to use all of a routing table's memory, it is limited to
just the portion meant to be used by the modem.  In all versions of
IPA currently supported, that is IPA_ROUTE_MODEM_COUNT (8) entries.

Update a few comments for clarity.

Fixes: 530f9216a9 ("soc: qcom: ipa: AP/modem communications")
Signed-off-by: Alex Elder <elder@linaro.org>
Link: https://lore.kernel.org/r/20220913204602.1803004-1-elder@linaro.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-09-28 11:10:34 +02:00
..
gsi_private.h net: ipa: DMA addresses are nicely aligned 2022-09-28 11:10:34 +02:00
gsi_reg.h net: ipa: remove two unused register definitions 2021-04-07 15:00:08 +02:00
gsi_trans.c net: ipa: DMA addresses are nicely aligned 2022-09-28 11:10:34 +02:00
gsi_trans.h net: ipa: fix kerneldoc comments 2020-07-13 17:11:53 -07:00
gsi.c net: ipa: DMA addresses are nicely aligned 2022-09-28 11:10:34 +02:00
gsi.h net: ipa: do not enable GSI interrupt for wakeup 2020-09-18 17:47:07 -07:00
ipa_clock.c net: ipa: manage endpoints separate from clock 2020-09-18 17:47:07 -07:00
ipa_clock.h net: ipa: fix kerneldoc comments 2020-07-13 17:11:53 -07:00
ipa_cmd.c net: ipa: kill IPA_TABLE_ENTRY_SIZE 2022-09-28 11:10:34 +02:00
ipa_cmd.h net: ipa: fix kerneldoc comments 2020-07-13 17:11:53 -07:00
ipa_data-sc7180.c net: ipa: fix modem LAN RX endpoint id 2020-06-11 18:39:08 -07:00
ipa_data-sdm845.c net: ipa: no checksum offload for SDM845 LAN RX 2020-06-30 13:10:57 -07:00
ipa_data.h net: ipa: DMA addresses are nicely aligned 2022-09-28 11:10:34 +02:00
ipa_endpoint.c net: ipa: fix page free in ipa_endpoint_replenish_one() 2022-06-09 10:21:29 +02:00
ipa_endpoint.h net: ipa: prevent concurrent replenish 2022-02-05 12:37:55 +01:00
ipa_gsi.c net: ipa: include declarations in "ipa_gsi.c" 2020-07-07 12:43:18 -07:00
ipa_gsi.h net: ipa: fix kerneldoc comments 2020-07-13 17:11:53 -07:00
ipa_interrupt.c net: ipa: enable wakeup on IPA interrupt 2020-09-18 17:47:07 -07:00
ipa_interrupt.h net: ipa: fix kerneldoc comments 2020-07-13 17:11:53 -07:00
ipa_main.c net: ipa: Add missing of_node_put() in ipa_firmware_load() 2021-07-19 09:44:51 +02:00
ipa_mem.c net: ipa: don't assume SMEM is page-aligned 2022-08-31 17:15:16 +02:00
ipa_mem.h net: ipa: redefine struct ipa_mem_data 2020-05-04 11:26:55 -07:00
ipa_modem.c net: ipa: modem: add missing SET_NETDEV_DEV() for proper sysfs links 2021-01-23 16:03:59 +01:00
ipa_modem.h soc: qcom: ipa: modem and microcontroller 2020-03-08 22:07:10 -07:00
ipa_qmi_msg.c net: ipa: properly limit modem routing table use 2022-09-28 11:10:34 +02:00
ipa_qmi_msg.h net: ipa: properly limit modem routing table use 2022-09-28 11:10:34 +02:00
ipa_qmi.c net: ipa: properly limit modem routing table use 2022-09-28 11:10:34 +02:00
ipa_qmi.h soc: qcom: ipa: AP/modem communications 2020-03-08 22:07:10 -07:00
ipa_reg.c
ipa_reg.h net: ipa: fix two comments 2020-09-28 18:34:56 -07:00
ipa_smp2p.c drivers: ipa: fix typos for ipa_smp2p structure doc 2020-05-14 13:06:55 -07:00
ipa_smp2p.h net: ipa: fix kerneldoc comments 2020-07-13 17:11:53 -07:00
ipa_table.c net: ipa: properly limit modem routing table use 2022-09-28 11:10:34 +02:00
ipa_table.h net: ipa: properly limit modem routing table use 2022-09-28 11:10:34 +02:00
ipa_uc.c net: ipa: fix two comments 2020-09-28 18:34:56 -07:00
ipa_uc.h soc: qcom: ipa: modem and microcontroller 2020-03-08 22:07:10 -07:00
ipa_version.h
ipa.h net: ipa: memory region array is variable size 2021-06-03 09:00:46 +02:00
Kconfig remoteproc: clean up notification config 2020-03-16 17:31:51 -07:00
Makefile soc: qcom: ipa: support build of IPA code 2020-03-08 22:07:10 -07:00