Commit deb09280 authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville

brcmfmac: only use ifidx from BDC header in brcmf_rx_frames()

In brcmf_rx_frames() the call to brcmf_fweh_process_skb() could
change the ifidx using information in the event data. This is
only different to the BDC ifidx for IF ADD event. However, the
creation of the new interface is deferred to event worker so
it does not exist. After brcmf_fweh_process_skb() it is only
used to set statistics.
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5b57af6e
...@@ -323,13 +323,8 @@ void brcmf_rx_frames(struct device *dev, struct sk_buff_head *skb_list) ...@@ -323,13 +323,8 @@ void brcmf_rx_frames(struct device *dev, struct sk_buff_head *skb_list)
/* Strip header, count, deliver upward */ /* Strip header, count, deliver upward */
skb_pull(skb, ETH_HLEN); skb_pull(skb, ETH_HLEN);
/* Process special event packets and then discard them */ /* Process special event packets */
brcmf_fweh_process_skb(drvr, skb, &ifidx); brcmf_fweh_process_skb(drvr, skb);
if (drvr->iflist[ifidx]) {
ifp = drvr->iflist[ifidx];
ifp->ndev->last_rx = jiffies;
}
if (!(ifp->ndev->flags & IFF_UP)) { if (!(ifp->ndev->flags & IFF_UP)) {
brcmu_pkt_buf_free_skb(skb); brcmu_pkt_buf_free_skb(skb);
......
...@@ -407,13 +407,12 @@ int brcmf_fweh_activate_events(struct brcmf_if *ifp) ...@@ -407,13 +407,12 @@ int brcmf_fweh_activate_events(struct brcmf_if *ifp)
* *
* @drvr: driver information object. * @drvr: driver information object.
* @event_packet: event packet to process. * @event_packet: event packet to process.
* @ifidx: index of the firmware interface (may change).
* *
* If the packet buffer contains a firmware event message it will * If the packet buffer contains a firmware event message it will
* dispatch the event to a registered handler (using worker). * dispatch the event to a registered handler (using worker).
*/ */
void brcmf_fweh_process_event(struct brcmf_pub *drvr, void brcmf_fweh_process_event(struct brcmf_pub *drvr,
struct brcmf_event *event_packet, u8 *ifidx) struct brcmf_event *event_packet)
{ {
enum brcmf_fweh_event_code code; enum brcmf_fweh_event_code code;
struct brcmf_fweh_info *fweh = &drvr->fweh; struct brcmf_fweh_info *fweh = &drvr->fweh;
...@@ -425,7 +424,6 @@ void brcmf_fweh_process_event(struct brcmf_pub *drvr, ...@@ -425,7 +424,6 @@ void brcmf_fweh_process_event(struct brcmf_pub *drvr,
/* get event info */ /* get event info */
code = get_unaligned_be32(&event_packet->msg.event_type); code = get_unaligned_be32(&event_packet->msg.event_type);
datalen = get_unaligned_be32(&event_packet->msg.datalen); datalen = get_unaligned_be32(&event_packet->msg.datalen);
*ifidx = event_packet->msg.ifidx;
data = &event_packet[1]; data = &event_packet[1];
if (code >= BRCMF_E_LAST) if (code >= BRCMF_E_LAST)
...@@ -442,7 +440,7 @@ void brcmf_fweh_process_event(struct brcmf_pub *drvr, ...@@ -442,7 +440,7 @@ void brcmf_fweh_process_event(struct brcmf_pub *drvr,
return; return;
event->code = code; event->code = code;
event->ifidx = *ifidx; event->ifidx = event_packet->msg.ifidx;
/* use memcpy to get aligned event message */ /* use memcpy to get aligned event message */
memcpy(&event->emsg, &event_packet->msg, sizeof(event->emsg)); memcpy(&event->emsg, &event_packet->msg, sizeof(event->emsg));
......
...@@ -187,10 +187,10 @@ void brcmf_fweh_unregister(struct brcmf_pub *drvr, ...@@ -187,10 +187,10 @@ void brcmf_fweh_unregister(struct brcmf_pub *drvr,
enum brcmf_fweh_event_code code); enum brcmf_fweh_event_code code);
int brcmf_fweh_activate_events(struct brcmf_if *ifp); int brcmf_fweh_activate_events(struct brcmf_if *ifp);
void brcmf_fweh_process_event(struct brcmf_pub *drvr, void brcmf_fweh_process_event(struct brcmf_pub *drvr,
struct brcmf_event *event_packet, u8 *ifidx); struct brcmf_event *event_packet);
static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr, static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
struct sk_buff *skb, u8 *ifidx) struct sk_buff *skb)
{ {
struct brcmf_event *event_packet; struct brcmf_event *event_packet;
u8 *data; u8 *data;
...@@ -213,7 +213,7 @@ static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr, ...@@ -213,7 +213,7 @@ static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
if (usr_stype != BCMILCP_BCM_SUBTYPE_EVENT) if (usr_stype != BCMILCP_BCM_SUBTYPE_EVENT)
return; return;
brcmf_fweh_process_event(drvr, event_packet, ifidx); brcmf_fweh_process_event(drvr, event_packet);
} }
#endif /* FWEH_H_ */ #endif /* FWEH_H_ */
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