1
0
Fork 0

MLK-17362-01 Changes for wireless and cfg80211 support

[Patch] Pulling the following commits and some general changes
from custom v3.10 kernel for supporting qcacld2.0 on kernel v4.9.11.
1. cfg80211: Using new wiphy flag WIPHY_FLAG_DFS_OFFLOAD
When flag WIPHY_FLAG_DFS_OFFLOAD is defined, the driver would handle
all the DFS related operations. Therefore the kernel needs to ignore
the DFS state that it uses to block the userspace calls to the driver
through cfg80211 APIs. Also it should treat the userspace calls to
start radar detection as a no-op.

Please note that changes in util.c is not picked up explicitly.
Kernel v4.9.11 uses wrapper cfg80211_get_chans_dfs_required which takes
care of this change.

Change-Id: I9dd2076945581ca67e54dfc96dd3dbc526c6f0a2
IRs-Fixed: 202686

2. New db.txt from git/sforshee/wireless-regdb.git
CONFIG_CFG80211_INTERNAL_REGDB is enabled in build. This causes
kernel warn messages as db.txt is empty. A new db.txt is added
from:
git://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git

IRs-Fixed: 202686

3. Picked up the declaration and definition of the function
cfg80211_is_gratuitous_arp_unsolicited_na

Change-Id: I1e4083a2327c121073226aa6b75bb6b5b97cec00
CRs-fixed: 1079453

Signed-off-by: Nakul Kachhwaha <nkachh@codeaurora.org>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
pull/10/head
Nakul Kachhwaha 2017-02-28 11:47:01 +05:30 committed by Jason Liu
parent d822226c30
commit 7945bb4556
5 changed files with 1391 additions and 13 deletions

View File

@ -3277,6 +3277,7 @@ enum wiphy_flags {
WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
WIPHY_FLAG_DFS_OFFLOAD = BIT(25)
};
/**
@ -4512,6 +4513,32 @@ const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
*/
int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
/**
* regulatory_hint_user - hint to the wireless core a regulatory domain
* which the driver has received from an application
* @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
* should be in. If @rd is set this should be NULL. Note that if you
* set this to NULL you should still set rd->alpha2 to some accepted
* alpha2.
* @user_reg_hint_type: the type of user regulatory hint.
*
* Wireless drivers can use this function to hint to the wireless core
* the current regulatory domain as specified by trusted applications,
* it is the driver's responsibilty to estbalish which applications it
* trusts.
*
* The wiphy should be registered to cfg80211 prior to this call.
* For cfg80211 drivers this means you must first use wiphy_register(),
* for mac80211 drivers you must first use ieee80211_register_hw().
*
* Drivers should check the return value, its possible you can get
* an -ENOMEM or an -EINVAL.
*
* Return: 0 on success. -ENOMEM, -EINVAL.
*/
int regulatory_hint_user(const char *alpha2,
enum nl80211_user_reg_hint_type user_reg_hint_type);
/**
* regulatory_set_wiphy_regd - set regdom info for self managed drivers
* @wiphy: the wireless device we want to process the regulatory domain on
@ -6188,6 +6215,16 @@ void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
/* ethtool helper */
void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
/**
* cfg80211_is_gratuitous_arp_unsolicited_na - packet is grat. ARP/unsol. NA
* @skb: the input packet, must be an ethernet frame already
*
* Return: %true if the packet is a gratuitous ARP or unsolicited NA packet.
* This is used to drop packets that shouldn't occur because the AP implements
* a proxy service.
*/
bool cfg80211_is_gratuitous_arp_unsolicited_na(struct sk_buff *skb);
/* Logging, debugging and troubleshooting/diagnostic helpers. */
/* wiphy_printk helpers, similar to dev_printk */

View File

@ -710,7 +710,8 @@ static bool cfg80211_secondary_chans_ok(struct wiphy *wiphy,
for (freq = start_freq; freq <= end_freq; freq += 20) {
c = ieee80211_get_channel(wiphy, freq);
if (!c || c->flags & prohibited_flags)
if (!c || ((c->flags & prohibited_flags) &&
!(wiphy->flags & WIPHY_FLAG_DFS_OFFLOAD)))
return false;
}

File diff suppressed because it is too large Load Diff

View File

@ -2416,6 +2416,7 @@ int regulatory_hint_user(const char *alpha2,
return 0;
}
EXPORT_SYMBOL(regulatory_hint_user);
int regulatory_hint_indoor(bool is_indoor, u32 portid)
{

View File

@ -1872,3 +1872,54 @@ EXPORT_SYMBOL(rfc1042_header);
const unsigned char bridge_tunnel_header[] __aligned(2) =
{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
EXPORT_SYMBOL(bridge_tunnel_header);
bool cfg80211_is_gratuitous_arp_unsolicited_na(struct sk_buff *skb)
{
const struct ethhdr *eth = (void *)skb->data;
const struct {
struct arphdr hdr;
u8 ar_sha[ETH_ALEN];
u8 ar_sip[4];
u8 ar_tha[ETH_ALEN];
u8 ar_tip[4];
} __packed *arp;
const struct ipv6hdr *ipv6;
const struct icmp6hdr *icmpv6;
switch (eth->h_proto) {
case cpu_to_be16(ETH_P_ARP):
/* can't say - but will probably be dropped later anyway */
if (!pskb_may_pull(skb, sizeof(*eth) + sizeof(*arp)))
return false;
arp = (void *)(eth + 1);
if ((arp->hdr.ar_op == cpu_to_be16(ARPOP_REPLY) ||
arp->hdr.ar_op == cpu_to_be16(ARPOP_REQUEST)) &&
!memcmp(arp->ar_sip, arp->ar_tip, sizeof(arp->ar_sip)))
return true;
break;
case cpu_to_be16(ETH_P_IPV6):
/* can't say - but will probably be dropped later anyway */
if (!pskb_may_pull(skb, sizeof(*eth) + sizeof(*ipv6) +
sizeof(*icmpv6)))
return false;
ipv6 = (void *)(eth + 1);
icmpv6 = (void *)(ipv6 + 1);
if (icmpv6->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT &&
!memcmp(&ipv6->saddr, &ipv6->daddr, sizeof(ipv6->saddr)))
return true;
break;
default:
/*
* no need to support other protocols, proxy service isn't
* specified for any others
*/
break;
}
return false;
}
EXPORT_SYMBOL(cfg80211_is_gratuitous_arp_unsolicited_na);