| .. | .. |
|---|
| 1 | 1 | /* |
|---|
| 2 | | - * Marvell Wireless LAN device driver: utility functions |
|---|
| 2 | + * NXP Wireless LAN device driver: utility functions |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * Copyright (C) 2011-2014, Marvell International Ltd. |
|---|
| 4 | + * Copyright 2011-2020 NXP |
|---|
| 5 | 5 | * |
|---|
| 6 | | - * This software file (the "File") is distributed by Marvell International |
|---|
| 7 | | - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 |
|---|
| 6 | + * This software file (the "File") is distributed by NXP |
|---|
| 7 | + * under the terms of the GNU General Public License Version 2, June 1991 |
|---|
| 8 | 8 | * (the "License"). You may use, redistribute and/or modify this File in |
|---|
| 9 | 9 | * accordance with the terms and conditions of the License, a copy of which |
|---|
| 10 | 10 | * is available by writing to the Free Software Foundation, Inc., |
|---|
| .. | .. |
|---|
| 405 | 405 | } |
|---|
| 406 | 406 | |
|---|
| 407 | 407 | rx_pd = (struct rxpd *)skb->data; |
|---|
| 408 | + pkt_len = le16_to_cpu(rx_pd->rx_pkt_length); |
|---|
| 409 | + if (pkt_len < sizeof(struct ieee80211_hdr) + sizeof(pkt_len)) { |
|---|
| 410 | + mwifiex_dbg(priv->adapter, ERROR, "invalid rx_pkt_length"); |
|---|
| 411 | + return -1; |
|---|
| 412 | + } |
|---|
| 408 | 413 | |
|---|
| 409 | 414 | skb_pull(skb, le16_to_cpu(rx_pd->rx_pkt_offset)); |
|---|
| 410 | 415 | skb_pull(skb, sizeof(pkt_len)); |
|---|
| 411 | | - |
|---|
| 412 | | - pkt_len = le16_to_cpu(rx_pd->rx_pkt_length); |
|---|
| 416 | + pkt_len -= sizeof(pkt_len); |
|---|
| 413 | 417 | |
|---|
| 414 | 418 | ieee_hdr = (void *)skb->data; |
|---|
| 415 | 419 | if (ieee80211_is_mgmt(ieee_hdr->frame_control)) { |
|---|
| .. | .. |
|---|
| 422 | 426 | skb->data + sizeof(struct ieee80211_hdr), |
|---|
| 423 | 427 | pkt_len - sizeof(struct ieee80211_hdr)); |
|---|
| 424 | 428 | |
|---|
| 425 | | - pkt_len -= ETH_ALEN + sizeof(pkt_len); |
|---|
| 429 | + pkt_len -= ETH_ALEN; |
|---|
| 426 | 430 | rx_pd->rx_pkt_length = cpu_to_le16(pkt_len); |
|---|
| 427 | 431 | |
|---|
| 428 | 432 | cfg80211_rx_mgmt(&priv->wdev, priv->roc_cfg.chan.center_freq, |
|---|
| .. | .. |
|---|
| 488 | 492 | (skb->truesize > MWIFIEX_RX_DATA_BUF_SIZE)) |
|---|
| 489 | 493 | skb->truesize += (skb->len - MWIFIEX_RX_DATA_BUF_SIZE); |
|---|
| 490 | 494 | |
|---|
| 491 | | - if (in_interrupt()) |
|---|
| 492 | | - netif_rx(skb); |
|---|
| 493 | | - else |
|---|
| 494 | | - netif_rx_ni(skb); |
|---|
| 495 | | - |
|---|
| 495 | + netif_rx_any_context(skb); |
|---|
| 496 | 496 | return 0; |
|---|
| 497 | 497 | } |
|---|
| 498 | 498 | |
|---|
| .. | .. |
|---|
| 607 | 607 | mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac) |
|---|
| 608 | 608 | { |
|---|
| 609 | 609 | struct mwifiex_sta_node *node; |
|---|
| 610 | | - unsigned long flags; |
|---|
| 611 | 610 | |
|---|
| 612 | 611 | if (!mac) |
|---|
| 613 | 612 | return NULL; |
|---|
| 614 | 613 | |
|---|
| 615 | | - spin_lock_irqsave(&priv->sta_list_spinlock, flags); |
|---|
| 614 | + spin_lock_bh(&priv->sta_list_spinlock); |
|---|
| 616 | 615 | node = mwifiex_get_sta_entry(priv, mac); |
|---|
| 617 | 616 | if (node) |
|---|
| 618 | 617 | goto done; |
|---|
| .. | .. |
|---|
| 625 | 624 | list_add_tail(&node->list, &priv->sta_list); |
|---|
| 626 | 625 | |
|---|
| 627 | 626 | done: |
|---|
| 628 | | - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); |
|---|
| 627 | + spin_unlock_bh(&priv->sta_list_spinlock); |
|---|
| 629 | 628 | return node; |
|---|
| 630 | 629 | } |
|---|
| 631 | 630 | |
|---|
| .. | .. |
|---|
| 662 | 661 | void mwifiex_del_sta_entry(struct mwifiex_private *priv, const u8 *mac) |
|---|
| 663 | 662 | { |
|---|
| 664 | 663 | struct mwifiex_sta_node *node; |
|---|
| 665 | | - unsigned long flags; |
|---|
| 666 | 664 | |
|---|
| 667 | | - spin_lock_irqsave(&priv->sta_list_spinlock, flags); |
|---|
| 665 | + spin_lock_bh(&priv->sta_list_spinlock); |
|---|
| 668 | 666 | |
|---|
| 669 | 667 | node = mwifiex_get_sta_entry(priv, mac); |
|---|
| 670 | 668 | if (node) { |
|---|
| .. | .. |
|---|
| 672 | 670 | kfree(node); |
|---|
| 673 | 671 | } |
|---|
| 674 | 672 | |
|---|
| 675 | | - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); |
|---|
| 673 | + spin_unlock_bh(&priv->sta_list_spinlock); |
|---|
| 676 | 674 | return; |
|---|
| 677 | 675 | } |
|---|
| 678 | 676 | |
|---|
| .. | .. |
|---|
| 680 | 678 | void mwifiex_del_all_sta_list(struct mwifiex_private *priv) |
|---|
| 681 | 679 | { |
|---|
| 682 | 680 | struct mwifiex_sta_node *node, *tmp; |
|---|
| 683 | | - unsigned long flags; |
|---|
| 684 | 681 | |
|---|
| 685 | | - spin_lock_irqsave(&priv->sta_list_spinlock, flags); |
|---|
| 682 | + spin_lock_bh(&priv->sta_list_spinlock); |
|---|
| 686 | 683 | |
|---|
| 687 | 684 | list_for_each_entry_safe(node, tmp, &priv->sta_list, list) { |
|---|
| 688 | 685 | list_del(&node->list); |
|---|
| .. | .. |
|---|
| 690 | 687 | } |
|---|
| 691 | 688 | |
|---|
| 692 | 689 | INIT_LIST_HEAD(&priv->sta_list); |
|---|
| 693 | | - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); |
|---|
| 690 | + spin_unlock_bh(&priv->sta_list_spinlock); |
|---|
| 694 | 691 | return; |
|---|
| 695 | 692 | } |
|---|
| 696 | 693 | |
|---|