Commit 3fb1d8d2 authored by Franky Lin's avatar Franky Lin Committed by John W. Linville

brcm80211: fmac: move driver up status to struct brcmf_bus

Driver up/down status to network interface need to be shared by
common layer and bus layer. Move it to bus interface structure
brcmf_bus as part of the fullmac bus interface refactoring.
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarAlwin Beukers <alwin@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b01a6b3c
...@@ -577,6 +577,7 @@ struct brcmf_bus { ...@@ -577,6 +577,7 @@ struct brcmf_bus {
void *drvr; /* pointer to driver pub structure brcmf_pub */ void *drvr; /* pointer to driver pub structure brcmf_pub */
enum brcmf_bus_state state; enum brcmf_bus_state state;
uint maxctl; /* Max size rxctl request from proto to bus */ uint maxctl; /* Max size rxctl request from proto to bus */
bool drvr_up; /* Status flag of driver up/down */
}; };
/* Forward decls for struct brcmf_pub (see below) */ /* Forward decls for struct brcmf_pub (see below) */
...@@ -594,7 +595,6 @@ struct brcmf_pub { ...@@ -594,7 +595,6 @@ struct brcmf_pub {
struct device *dev; /* fullmac dongle device pointer */ struct device *dev; /* fullmac dongle device pointer */
/* Internal brcmf items */ /* Internal brcmf items */
bool up; /* Driver up/down (to OS) */
bool txoff; /* Transmit flow-controlled */ bool txoff; /* Transmit flow-controlled */
uint hdrlen; /* Total BRCMF header length (proto + bus) */ uint hdrlen; /* Total BRCMF header length (proto + bus) */
uint rxsz; /* Rx buffer size bus module should use */ uint rxsz; /* Rx buffer size bus module should use */
......
...@@ -273,7 +273,7 @@ static void brcmf_netdev_set_multicast_list(struct net_device *ndev) ...@@ -273,7 +273,7 @@ static void brcmf_netdev_set_multicast_list(struct net_device *ndev)
int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx, struct sk_buff *pktbuf) int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx, struct sk_buff *pktbuf)
{ {
/* Reject if down */ /* Reject if down */
if (!drvr->up || (drvr->bus_if->state == BRCMF_BUS_DOWN)) if (!drvr->bus_if->drvr_up || (drvr->bus_if->state == BRCMF_BUS_DOWN))
return -ENODEV; return -ENODEV;
/* Update multicast statistic */ /* Update multicast statistic */
...@@ -303,10 +303,10 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -303,10 +303,10 @@ static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
/* Reject if down */ /* Reject if down */
if (!drvr->up || if (!drvr->bus_if->drvr_up ||
(drvr->bus_if->state == BRCMF_BUS_DOWN)) { (drvr->bus_if->state == BRCMF_BUS_DOWN)) {
brcmf_dbg(ERROR, "xmit rejected pub.up=%d state=%d\n", brcmf_dbg(ERROR, "xmit rejected drvup=%d state=%d\n",
drvr->up, drvr->bus_if->drvr_up,
drvr->bus_if->state); drvr->bus_if->state);
netif_stop_queue(ndev); netif_stop_queue(ndev);
return -ENODEV; return -ENODEV;
...@@ -487,7 +487,7 @@ static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev) ...@@ -487,7 +487,7 @@ static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev)
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
if (drvr->up) if (drvr->bus_if->drvr_up)
/* Use the protocol to get dongle stats */ /* Use the protocol to get dongle stats */
brcmf_proto_dstats(drvr); brcmf_proto_dstats(drvr);
...@@ -633,7 +633,7 @@ static int brcmf_ethtool(struct brcmf_pub *drvr, void __user *uaddr) ...@@ -633,7 +633,7 @@ static int brcmf_ethtool(struct brcmf_pub *drvr, void __user *uaddr)
} }
/* otherwise, require dongle to be up */ /* otherwise, require dongle to be up */
else if (!drvr->up) { else if (!drvr->bus_if->drvr_up) {
brcmf_dbg(ERROR, "dongle is not up\n"); brcmf_dbg(ERROR, "dongle is not up\n");
return -ENODEV; return -ENODEV;
} }
...@@ -785,11 +785,11 @@ static int brcmf_netdev_stop(struct net_device *ndev) ...@@ -785,11 +785,11 @@ static int brcmf_netdev_stop(struct net_device *ndev)
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
brcmf_cfg80211_down(drvr->config); brcmf_cfg80211_down(drvr->config);
if (drvr->up == 0) if (drvr->bus_if->drvr_up == 0)
return 0; return 0;
/* Set state and stop OS transmissions */ /* Set state and stop OS transmissions */
drvr->up = 0; drvr->bus_if->drvr_up = 0;
netif_stop_queue(ndev); netif_stop_queue(ndev);
return 0; return 0;
...@@ -826,7 +826,7 @@ static int brcmf_netdev_open(struct net_device *ndev) ...@@ -826,7 +826,7 @@ static int brcmf_netdev_open(struct net_device *ndev)
} }
/* Allow transmit calls */ /* Allow transmit calls */
netif_start_queue(ndev); netif_start_queue(ndev);
drvr->up = 1; drvr->bus_if->drvr_up = 1;
if (brcmf_cfg80211_up(drvr->config)) { if (brcmf_cfg80211_up(drvr->config)) {
brcmf_dbg(ERROR, "failed to bring up cfg80211\n"); brcmf_dbg(ERROR, "failed to bring up cfg80211\n");
return -1; return -1;
......
...@@ -2295,7 +2295,8 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) ...@@ -2295,7 +2295,8 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes)
} }
/* Deflow-control stack if needed */ /* Deflow-control stack if needed */
if (drvr->up && (drvr->bus_if->state == BRCMF_BUS_DATA) && if (drvr->bus_if->drvr_up &&
(drvr->bus_if->state == BRCMF_BUS_DATA) &&
drvr->txoff && (pktq_len(&bus->txq) < TXLOW)) drvr->txoff && (pktq_len(&bus->txq) < TXLOW))
brcmf_txflowcontrol(bus->sdiodev->dev, 0, OFF); brcmf_txflowcontrol(bus->sdiodev->dev, 0, OFF);
...@@ -2974,7 +2975,7 @@ static int brcmf_sdbrcm_downloadvars(struct brcmf_sdio *bus, void *arg, int len) ...@@ -2974,7 +2975,7 @@ static int brcmf_sdbrcm_downloadvars(struct brcmf_sdio *bus, void *arg, int len)
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
/* Basic sanity checks */ /* Basic sanity checks */
if (bus->drvr->up) { if (bus->sdiodev->bus_if->drvr_up) {
bcmerror = -EISCONN; bcmerror = -EISCONN;
goto err; goto err;
} }
......
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