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: fixes

This patch series contains IOSM Driver fixes and details are
are mentioned below.

Patch1: Corrects uevent reporting format key=value pair.
Patch2: Removes redundant IP session checks.
Patch3: Correct link-Id number to be in sycn with MBIM session Id.
Patch4: Update netdev tx stats.
Patch5: Set netdev default mtu size.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jul 1, 2021
2 parents 764a4af + d7340f4 commit 8882735
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 25 deletions.
21 changes: 4 additions & 17 deletions drivers/net/wwan/iosm/iosm_ipc_imem_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ int ipc_imem_sys_wwan_open(struct iosm_imem *ipc_imem, int if_id)
return -EIO;
}

/* check for the interafce id
* if if_id 1 to 8 then create IP MUX channel sessions.
* To start MUX session from 0 as network interface id would start
* from 1 so map it to if_id = if_id - 1
*/
if (if_id >= IP_MUX_SESSION_START && if_id <= IP_MUX_SESSION_END)
return ipc_mux_open_session(ipc_imem->mux, if_id - 1);

return -EINVAL;
return ipc_mux_open_session(ipc_imem->mux, if_id);
}

/* Release a net link to CP. */
Expand All @@ -41,7 +33,7 @@ void ipc_imem_sys_wwan_close(struct iosm_imem *ipc_imem, int if_id,
{
if (ipc_imem->mux && if_id >= IP_MUX_SESSION_START &&
if_id <= IP_MUX_SESSION_END)
ipc_mux_close_session(ipc_imem->mux, if_id - 1);
ipc_mux_close_session(ipc_imem->mux, if_id);
}

/* Tasklet call to do uplink transfer. */
Expand Down Expand Up @@ -83,13 +75,8 @@ int ipc_imem_sys_wwan_transmit(struct iosm_imem *ipc_imem,
goto out;
}

if (if_id >= IP_MUX_SESSION_START && if_id <= IP_MUX_SESSION_END)
/* Route the UL packet through IP MUX Layer */
ret = ipc_mux_ul_trigger_encode(ipc_imem->mux,
if_id - 1, skb);
else
dev_err(ipc_imem->dev,
"invalid if_id %d: ", if_id);
/* Route the UL packet through IP MUX Layer */
ret = ipc_mux_ul_trigger_encode(ipc_imem->mux, if_id, skb);
out:
return ret;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/wwan/iosm/iosm_ipc_imem_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
#define BOOT_CHECK_DEFAULT_TIMEOUT 400

/* IP MUX channel range */
#define IP_MUX_SESSION_START 1
#define IP_MUX_SESSION_END 8
#define IP_MUX_SESSION_START 0
#define IP_MUX_SESSION_END 7

/* Default IP MUX channel */
#define IP_MUX_SESSION_DEFAULT 1
#define IP_MUX_SESSION_DEFAULT 0

/**
* ipc_imem_sys_port_open - Open a port link to CP.
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ static int ipc_mux_net_receive(struct iosm_mux *ipc_mux, int if_id,
/* Pass the packet to the netif layer. */
dest_skb->priority = service_class;

return ipc_wwan_receive(wwan, dest_skb, false, if_id + 1);
return ipc_wwan_receive(wwan, dest_skb, false, if_id);
}

/* Decode Flow Credit Table in the block */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wwan/iosm/iosm_ipc_uevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void ipc_uevent_send(struct device *dev, char *uevent)

/* Store the device and event information */
info->dev = dev;
snprintf(info->uevent, MAX_UEVENT_LEN, "%s: %s", dev_name(dev), uevent);
snprintf(info->uevent, MAX_UEVENT_LEN, "IOSM_EVENT=%s", uevent);

/* Schedule uevent in process context using work queue */
schedule_work(&info->work);
Expand Down
11 changes: 8 additions & 3 deletions drivers/net/wwan/iosm/iosm_ipc_wwan.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ static int ipc_wwan_link_transmit(struct sk_buff *skb,
{
struct iosm_netdev_priv *priv = wwan_netdev_drvpriv(netdev);
struct iosm_wwan *ipc_wwan = priv->ipc_wwan;
unsigned int len = skb->len;
int if_id = priv->if_id;
int ret;

Expand All @@ -123,6 +124,8 @@ static int ipc_wwan_link_transmit(struct sk_buff *skb,

/* Return code of zero is success */
if (ret == 0) {
netdev->stats.tx_packets++;
netdev->stats.tx_bytes += len;
ret = NETDEV_TX_OK;
} else if (ret == -EBUSY) {
ret = NETDEV_TX_BUSY;
Expand All @@ -140,7 +143,8 @@ static int ipc_wwan_link_transmit(struct sk_buff *skb,
ret);

dev_kfree_skb_any(skb);
return ret;
netdev->stats.tx_dropped++;
return NETDEV_TX_OK;
}

/* Ops structure for wwan net link */
Expand All @@ -158,6 +162,7 @@ static void ipc_wwan_setup(struct net_device *iosm_dev)
iosm_dev->priv_flags |= IFF_NO_QUEUE;

iosm_dev->type = ARPHRD_NONE;
iosm_dev->mtu = ETH_DATA_LEN;
iosm_dev->min_mtu = ETH_MIN_MTU;
iosm_dev->max_mtu = ETH_MAX_MTU;

Expand Down Expand Up @@ -252,8 +257,8 @@ int ipc_wwan_receive(struct iosm_wwan *ipc_wwan, struct sk_buff *skb_arg,

skb->pkt_type = PACKET_HOST;

if (if_id < (IP_MUX_SESSION_START - 1) ||
if_id > (IP_MUX_SESSION_END - 1)) {
if (if_id < IP_MUX_SESSION_START ||
if_id > IP_MUX_SESSION_END) {
ret = -EINVAL;
goto free;
}
Expand Down

0 comments on commit 8882735

Please sign in to comment.