Commit f2fc2280 authored by David S. Miller's avatar David S. Miller

Merge branch 'wwan-iosm-fixes'

M Chetan Kumar says:

====================
net: wwan: iosm: fix build errors & bugs

This patch series fixes iosm driver bugs & build errors.

PATCH1: Fix kernel build robot reported error.
PATCH2: Fix build error reported on armhf while preparing
        6.1-rc5 for Debian.
PATCH3: Fix UL throughput crash.
PATCH4: Fix incorrect skb length.

Refer to commit message for details.

Changes since v1:
* PATCH4: Fix sparse warning.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7642cc28 c34ca4f3
...@@ -365,7 +365,8 @@ static void ipc_mux_dl_cmd_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb) ...@@ -365,7 +365,8 @@ static void ipc_mux_dl_cmd_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
/* Pass the DL packet to the netif layer. */ /* Pass the DL packet to the netif layer. */
static int ipc_mux_net_receive(struct iosm_mux *ipc_mux, int if_id, static int ipc_mux_net_receive(struct iosm_mux *ipc_mux, int if_id,
struct iosm_wwan *wwan, u32 offset, struct iosm_wwan *wwan, u32 offset,
u8 service_class, struct sk_buff *skb) u8 service_class, struct sk_buff *skb,
u32 pkt_len)
{ {
struct sk_buff *dest_skb = skb_clone(skb, GFP_ATOMIC); struct sk_buff *dest_skb = skb_clone(skb, GFP_ATOMIC);
...@@ -373,7 +374,7 @@ static int ipc_mux_net_receive(struct iosm_mux *ipc_mux, int if_id, ...@@ -373,7 +374,7 @@ static int ipc_mux_net_receive(struct iosm_mux *ipc_mux, int if_id,
return -ENOMEM; return -ENOMEM;
skb_pull(dest_skb, offset); skb_pull(dest_skb, offset);
skb_set_tail_pointer(dest_skb, dest_skb->len); skb_trim(dest_skb, pkt_len);
/* Pass the packet to the netif layer. */ /* Pass the packet to the netif layer. */
dest_skb->priority = service_class; dest_skb->priority = service_class;
...@@ -429,7 +430,7 @@ static void ipc_mux_dl_fcth_decode(struct iosm_mux *ipc_mux, ...@@ -429,7 +430,7 @@ static void ipc_mux_dl_fcth_decode(struct iosm_mux *ipc_mux,
static void ipc_mux_dl_adgh_decode(struct iosm_mux *ipc_mux, static void ipc_mux_dl_adgh_decode(struct iosm_mux *ipc_mux,
struct sk_buff *skb) struct sk_buff *skb)
{ {
u32 pad_len, packet_offset; u32 pad_len, packet_offset, adgh_len;
struct iosm_wwan *wwan; struct iosm_wwan *wwan;
struct mux_adgh *adgh; struct mux_adgh *adgh;
u8 *block = skb->data; u8 *block = skb->data;
...@@ -470,10 +471,12 @@ static void ipc_mux_dl_adgh_decode(struct iosm_mux *ipc_mux, ...@@ -470,10 +471,12 @@ static void ipc_mux_dl_adgh_decode(struct iosm_mux *ipc_mux,
packet_offset = sizeof(*adgh) + pad_len; packet_offset = sizeof(*adgh) + pad_len;
if_id += ipc_mux->wwan_q_offset; if_id += ipc_mux->wwan_q_offset;
adgh_len = le16_to_cpu(adgh->length);
/* Pass the packet to the netif layer */ /* Pass the packet to the netif layer */
rc = ipc_mux_net_receive(ipc_mux, if_id, wwan, packet_offset, rc = ipc_mux_net_receive(ipc_mux, if_id, wwan, packet_offset,
adgh->service_class, skb); adgh->service_class, skb,
adgh_len - packet_offset);
if (rc) { if (rc) {
dev_err(ipc_mux->dev, "mux adgh decoding error"); dev_err(ipc_mux->dev, "mux adgh decoding error");
return; return;
...@@ -547,7 +550,7 @@ static int mux_dl_process_dg(struct iosm_mux *ipc_mux, struct mux_adbh *adbh, ...@@ -547,7 +550,7 @@ static int mux_dl_process_dg(struct iosm_mux *ipc_mux, struct mux_adbh *adbh,
int if_id, int nr_of_dg) int if_id, int nr_of_dg)
{ {
u32 dl_head_pad_len = ipc_mux->session[if_id].dl_head_pad_len; u32 dl_head_pad_len = ipc_mux->session[if_id].dl_head_pad_len;
u32 packet_offset, i, rc; u32 packet_offset, i, rc, dg_len;
for (i = 0; i < nr_of_dg; i++, dg++) { for (i = 0; i < nr_of_dg; i++, dg++) {
if (le32_to_cpu(dg->datagram_index) if (le32_to_cpu(dg->datagram_index)
...@@ -562,11 +565,12 @@ static int mux_dl_process_dg(struct iosm_mux *ipc_mux, struct mux_adbh *adbh, ...@@ -562,11 +565,12 @@ static int mux_dl_process_dg(struct iosm_mux *ipc_mux, struct mux_adbh *adbh,
packet_offset = packet_offset =
le32_to_cpu(dg->datagram_index) + le32_to_cpu(dg->datagram_index) +
dl_head_pad_len; dl_head_pad_len;
dg_len = le16_to_cpu(dg->datagram_length);
/* Pass the packet to the netif layer. */ /* Pass the packet to the netif layer. */
rc = ipc_mux_net_receive(ipc_mux, if_id, ipc_mux->wwan, rc = ipc_mux_net_receive(ipc_mux, if_id, ipc_mux->wwan,
packet_offset, packet_offset,
dg->service_class, dg->service_class, skb,
skb); dg_len - dl_head_pad_len);
if (rc) if (rc)
goto dg_error; goto dg_error;
} }
...@@ -1207,10 +1211,9 @@ static int mux_ul_dg_update_tbl_index(struct iosm_mux *ipc_mux, ...@@ -1207,10 +1211,9 @@ static int mux_ul_dg_update_tbl_index(struct iosm_mux *ipc_mux,
qlth_n_ql_size, ul_list); qlth_n_ql_size, ul_list);
ipc_mux_ul_adb_finish(ipc_mux); ipc_mux_ul_adb_finish(ipc_mux);
if (ipc_mux_ul_adb_allocate(ipc_mux, adb, &ipc_mux->size_needed, if (ipc_mux_ul_adb_allocate(ipc_mux, adb, &ipc_mux->size_needed,
IOSM_AGGR_MUX_SIG_ADBH)) { IOSM_AGGR_MUX_SIG_ADBH))
dev_kfree_skb(src_skb);
return -ENOMEM; return -ENOMEM;
}
ipc_mux->size_needed = le32_to_cpu(adb->adbh->block_length); ipc_mux->size_needed = le32_to_cpu(adb->adbh->block_length);
ipc_mux->size_needed += offsetof(struct mux_adth, dg); ipc_mux->size_needed += offsetof(struct mux_adth, dg);
...@@ -1471,8 +1474,7 @@ void ipc_mux_ul_encoded_process(struct iosm_mux *ipc_mux, struct sk_buff *skb) ...@@ -1471,8 +1474,7 @@ void ipc_mux_ul_encoded_process(struct iosm_mux *ipc_mux, struct sk_buff *skb)
ipc_mux->ul_data_pend_bytes); ipc_mux->ul_data_pend_bytes);
/* Reset the skb settings. */ /* Reset the skb settings. */
skb->tail = 0; skb_trim(skb, 0);
skb->len = 0;
/* Add the consumed ADB to the free list. */ /* Add the consumed ADB to the free list. */
skb_queue_tail((&ipc_mux->ul_adb.free_list), skb); skb_queue_tail((&ipc_mux->ul_adb.free_list), skb);
......
...@@ -122,7 +122,7 @@ struct iosm_protocol { ...@@ -122,7 +122,7 @@ struct iosm_protocol {
struct iosm_imem *imem; struct iosm_imem *imem;
struct ipc_rsp *rsp_ring[IPC_MEM_MSG_ENTRIES]; struct ipc_rsp *rsp_ring[IPC_MEM_MSG_ENTRIES];
struct device *dev; struct device *dev;
phys_addr_t phy_ap_shm; dma_addr_t phy_ap_shm;
u32 old_msg_tail; u32 old_msg_tail;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment