Skip to content

Commit f2fc228

Browse files
committed
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: David S. Miller <[email protected]>
2 parents 7642cc2 + c34ca4f commit f2fc228

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

drivers/net/wwan/iosm/iosm_ipc_mux_codec.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,16 @@ static void ipc_mux_dl_cmd_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
365365
/* Pass the DL packet to the netif layer. */
366366
static int ipc_mux_net_receive(struct iosm_mux *ipc_mux, int if_id,
367367
struct iosm_wwan *wwan, u32 offset,
368-
u8 service_class, struct sk_buff *skb)
368+
u8 service_class, struct sk_buff *skb,
369+
u32 pkt_len)
369370
{
370371
struct sk_buff *dest_skb = skb_clone(skb, GFP_ATOMIC);
371372

372373
if (!dest_skb)
373374
return -ENOMEM;
374375

375376
skb_pull(dest_skb, offset);
376-
skb_set_tail_pointer(dest_skb, dest_skb->len);
377+
skb_trim(dest_skb, pkt_len);
377378
/* Pass the packet to the netif layer. */
378379
dest_skb->priority = service_class;
379380

@@ -429,7 +430,7 @@ static void ipc_mux_dl_fcth_decode(struct iosm_mux *ipc_mux,
429430
static void ipc_mux_dl_adgh_decode(struct iosm_mux *ipc_mux,
430431
struct sk_buff *skb)
431432
{
432-
u32 pad_len, packet_offset;
433+
u32 pad_len, packet_offset, adgh_len;
433434
struct iosm_wwan *wwan;
434435
struct mux_adgh *adgh;
435436
u8 *block = skb->data;
@@ -470,10 +471,12 @@ static void ipc_mux_dl_adgh_decode(struct iosm_mux *ipc_mux,
470471
packet_offset = sizeof(*adgh) + pad_len;
471472

472473
if_id += ipc_mux->wwan_q_offset;
474+
adgh_len = le16_to_cpu(adgh->length);
473475

474476
/* Pass the packet to the netif layer */
475477
rc = ipc_mux_net_receive(ipc_mux, if_id, wwan, packet_offset,
476-
adgh->service_class, skb);
478+
adgh->service_class, skb,
479+
adgh_len - packet_offset);
477480
if (rc) {
478481
dev_err(ipc_mux->dev, "mux adgh decoding error");
479482
return;
@@ -547,7 +550,7 @@ static int mux_dl_process_dg(struct iosm_mux *ipc_mux, struct mux_adbh *adbh,
547550
int if_id, int nr_of_dg)
548551
{
549552
u32 dl_head_pad_len = ipc_mux->session[if_id].dl_head_pad_len;
550-
u32 packet_offset, i, rc;
553+
u32 packet_offset, i, rc, dg_len;
551554

552555
for (i = 0; i < nr_of_dg; i++, dg++) {
553556
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,
562565
packet_offset =
563566
le32_to_cpu(dg->datagram_index) +
564567
dl_head_pad_len;
568+
dg_len = le16_to_cpu(dg->datagram_length);
565569
/* Pass the packet to the netif layer. */
566570
rc = ipc_mux_net_receive(ipc_mux, if_id, ipc_mux->wwan,
567571
packet_offset,
568-
dg->service_class,
569-
skb);
572+
dg->service_class, skb,
573+
dg_len - dl_head_pad_len);
570574
if (rc)
571575
goto dg_error;
572576
}
@@ -1207,10 +1211,9 @@ static int mux_ul_dg_update_tbl_index(struct iosm_mux *ipc_mux,
12071211
qlth_n_ql_size, ul_list);
12081212
ipc_mux_ul_adb_finish(ipc_mux);
12091213
if (ipc_mux_ul_adb_allocate(ipc_mux, adb, &ipc_mux->size_needed,
1210-
IOSM_AGGR_MUX_SIG_ADBH)) {
1211-
dev_kfree_skb(src_skb);
1214+
IOSM_AGGR_MUX_SIG_ADBH))
12121215
return -ENOMEM;
1213-
}
1216+
12141217
ipc_mux->size_needed = le32_to_cpu(adb->adbh->block_length);
12151218

12161219
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)
14711474
ipc_mux->ul_data_pend_bytes);
14721475

14731476
/* Reset the skb settings. */
1474-
skb->tail = 0;
1475-
skb->len = 0;
1477+
skb_trim(skb, 0);
14761478

14771479
/* Add the consumed ADB to the free list. */
14781480
skb_queue_tail((&ipc_mux->ul_adb.free_list), skb);

drivers/net/wwan/iosm/iosm_ipc_protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ struct iosm_protocol {
122122
struct iosm_imem *imem;
123123
struct ipc_rsp *rsp_ring[IPC_MEM_MSG_ENTRIES];
124124
struct device *dev;
125-
phys_addr_t phy_ap_shm;
125+
dma_addr_t phy_ap_shm;
126126
u32 old_msg_tail;
127127
};
128128

0 commit comments

Comments
 (0)