Skip to content

Commit

Permalink
Merge branch 'wwan-iosm-fixes'
Browse files Browse the repository at this point in the history
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 <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Nov 28, 2022
2 parents 7642cc2 + c34ca4f commit f2fc228
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 14 additions & 12 deletions drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,16 @@ static void ipc_mux_dl_cmd_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
/* Pass the DL packet to the netif layer. */
static int ipc_mux_net_receive(struct iosm_mux *ipc_mux, int if_id,
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);

if (!dest_skb)
return -ENOMEM;

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. */
dest_skb->priority = service_class;

Expand Down Expand Up @@ -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,
struct sk_buff *skb)
{
u32 pad_len, packet_offset;
u32 pad_len, packet_offset, adgh_len;
struct iosm_wwan *wwan;
struct mux_adgh *adgh;
u8 *block = skb->data;
Expand Down Expand Up @@ -470,10 +471,12 @@ static void ipc_mux_dl_adgh_decode(struct iosm_mux *ipc_mux,
packet_offset = sizeof(*adgh) + pad_len;

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

/* Pass the packet to the netif layer */
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) {
dev_err(ipc_mux->dev, "mux adgh decoding error");
return;
Expand Down Expand Up @@ -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)
{
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++) {
if (le32_to_cpu(dg->datagram_index)
Expand All @@ -562,11 +565,12 @@ static int mux_dl_process_dg(struct iosm_mux *ipc_mux, struct mux_adbh *adbh,
packet_offset =
le32_to_cpu(dg->datagram_index) +
dl_head_pad_len;
dg_len = le16_to_cpu(dg->datagram_length);
/* Pass the packet to the netif layer. */
rc = ipc_mux_net_receive(ipc_mux, if_id, ipc_mux->wwan,
packet_offset,
dg->service_class,
skb);
dg->service_class, skb,
dg_len - dl_head_pad_len);
if (rc)
goto dg_error;
}
Expand Down Expand Up @@ -1207,10 +1211,9 @@ static int mux_ul_dg_update_tbl_index(struct iosm_mux *ipc_mux,
qlth_n_ql_size, ul_list);
ipc_mux_ul_adb_finish(ipc_mux);
if (ipc_mux_ul_adb_allocate(ipc_mux, adb, &ipc_mux->size_needed,
IOSM_AGGR_MUX_SIG_ADBH)) {
dev_kfree_skb(src_skb);
IOSM_AGGR_MUX_SIG_ADBH))
return -ENOMEM;
}

ipc_mux->size_needed = le32_to_cpu(adb->adbh->block_length);

ipc_mux->size_needed += offsetof(struct mux_adth, dg);
Expand Down Expand Up @@ -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);

/* Reset the skb settings. */
skb->tail = 0;
skb->len = 0;
skb_trim(skb, 0);

/* Add the consumed ADB to the free list. */
skb_queue_tail((&ipc_mux->ul_adb.free_list), skb);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wwan/iosm/iosm_ipc_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ struct iosm_protocol {
struct iosm_imem *imem;
struct ipc_rsp *rsp_ring[IPC_MEM_MSG_ENTRIES];
struct device *dev;
phys_addr_t phy_ap_shm;
dma_addr_t phy_ap_shm;
u32 old_msg_tail;
};

Expand Down

0 comments on commit f2fc228

Please sign in to comment.