Commit c9c00438 authored by Hante Meuleman's avatar Hante Meuleman Committed by Kalle Valo

brcmfmac: Simplify and fix usage of brcmf_ifname.

brcmf_ifname is a debug function to return a name related to an ifp,
but is using a rather complex implementation. It was also used
wrongly from bcdc as it did not use the bsscfgidx as it was supposed
to, but bssidx. This patch fixes that bug and simplifies
brcmf_ifname.
Reviewed-by: default avatarArend Van Spriel <arend@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarHante Meuleman <meuleman@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 2aff0303
...@@ -187,7 +187,8 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, ...@@ -187,7 +187,8 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
goto retry; goto retry;
if (id != bcdc->reqid) { if (id != bcdc->reqid) {
brcmf_err("%s: unexpected request id %d (expected %d)\n", brcmf_err("%s: unexpected request id %d (expected %d)\n",
brcmf_ifname(drvr, ifidx), id, bcdc->reqid); brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
bcdc->reqid);
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
} }
...@@ -234,7 +235,8 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, ...@@ -234,7 +235,8 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
if (id != bcdc->reqid) { if (id != bcdc->reqid) {
brcmf_err("%s: unexpected request id %d (expected %d)\n", brcmf_err("%s: unexpected request id %d (expected %d)\n",
brcmf_ifname(drvr, ifidx), id, bcdc->reqid); brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
bcdc->reqid);
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
} }
...@@ -298,13 +300,13 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, ...@@ -298,13 +300,13 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) != if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
BCDC_PROTO_VER) { BCDC_PROTO_VER) {
brcmf_err("%s: non-BCDC packet received, flags 0x%x\n", brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
brcmf_ifname(drvr, tmp_if->ifidx), h->flags); brcmf_ifname(tmp_if), h->flags);
return -EBADE; return -EBADE;
} }
if (h->flags & BCDC_FLAG_SUM_GOOD) { if (h->flags & BCDC_FLAG_SUM_GOOD) {
brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n", brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
brcmf_ifname(drvr, tmp_if->ifidx), h->flags); brcmf_ifname(tmp_if), h->flags);
pktbuf->ip_summed = CHECKSUM_UNNECESSARY; pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
} }
......
...@@ -66,20 +66,13 @@ static int brcmf_p2p_enable; ...@@ -66,20 +66,13 @@ static int brcmf_p2p_enable;
module_param_named(p2pon, brcmf_p2p_enable, int, 0); module_param_named(p2pon, brcmf_p2p_enable, int, 0);
MODULE_PARM_DESC(p2pon, "enable legacy p2p management functionality"); MODULE_PARM_DESC(p2pon, "enable legacy p2p management functionality");
char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx) char *brcmf_ifname(struct brcmf_if *ifp)
{ {
if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) { if (!ifp)
brcmf_err("ifidx %d out of range\n", ifidx);
return "<if_bad>";
}
if (drvr->iflist[ifidx] == NULL) {
brcmf_err("null i/f %d\n", ifidx);
return "<if_null>"; return "<if_null>";
}
if (drvr->iflist[ifidx]->ndev) if (ifp->ndev)
return drvr->iflist[ifidx]->ndev->name; return ifp->ndev->name;
return "<if_none>"; return "<if_none>";
} }
...@@ -237,14 +230,14 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, ...@@ -237,14 +230,14 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
struct sk_buff *skb2; struct sk_buff *skb2;
brcmf_dbg(INFO, "%s: insufficient headroom\n", brcmf_dbg(INFO, "%s: insufficient headroom\n",
brcmf_ifname(drvr, ifp->bssidx)); brcmf_ifname(ifp));
drvr->bus_if->tx_realloc++; drvr->bus_if->tx_realloc++;
skb2 = skb_realloc_headroom(skb, drvr->hdrlen); skb2 = skb_realloc_headroom(skb, drvr->hdrlen);
dev_kfree_skb(skb); dev_kfree_skb(skb);
skb = skb2; skb = skb2;
if (skb == NULL) { if (skb == NULL) {
brcmf_err("%s: skb_realloc_headroom failed\n", brcmf_err("%s: skb_realloc_headroom failed\n",
brcmf_ifname(drvr, ifp->bssidx)); brcmf_ifname(ifp));
ret = -ENOMEM; ret = -ENOMEM;
goto done; goto done;
} }
......
...@@ -205,7 +205,7 @@ struct brcmf_skb_reorder_data { ...@@ -205,7 +205,7 @@ struct brcmf_skb_reorder_data {
int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp); int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);
/* Return pointer to interface name */ /* Return pointer to interface name */
char *brcmf_ifname(struct brcmf_pub *drvr, int idx); char *brcmf_ifname(struct brcmf_if *ifp);
struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx); struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx, struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
......
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