BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mangoh-drivers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
mangoh-drivers
Commits
9e531c86
Commit
9e531c86
authored
Sep 20, 2017
by
David Clark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates after getting encryption working
parent
cf879ddc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
172 deletions
+67
-172
ioctl.c
linux_kernel_modules/mt7697wifi/ioctl.c
+20
-5
main.c
linux_kernel_modules/mt7697wifi/main.c
+4
-3
mt7697wifi_core.mdef
linux_kernel_modules/mt7697wifi/mt7697wifi_core.mdef
+0
-16
mt7697ap.sh
linux_kernel_modules/mt7697wifi/scripts/mt7697ap.sh
+35
-47
mtwifi
linux_kernel_modules/mt7697wifi/scripts/mtwifi
+4
-16
txrx.c
linux_kernel_modules/mt7697wifi/txrx.c
+2
-83
wmi.c
linux_kernel_modules/mt7697wifi/wmi.c
+2
-2
No files found.
linux_kernel_modules/mt7697wifi/ioctl.c
View file @
9e531c86
...
...
@@ -257,6 +257,7 @@ static int mt7697_wext_siwessid(struct net_device *ndev,
struct
iw_point
*
data
,
char
*
ssid
)
{
u8
pmk
[
MT7697_WIFI_LENGTH_PMK
]
=
{
0
};
struct
mt7697_cfg80211_info
*
cfg
=
mt7697_priv
(
ndev
);
struct
wireless_dev
*
wdev
=
ndev
->
ieee80211_ptr
;
struct
mt7697_vif
*
vif
=
mt7697_vif_from_wdev
(
wdev
);
...
...
@@ -317,11 +318,25 @@ static int mt7697_wext_siwessid(struct net_device *ndev,
}
}
ret
=
mt7697_wr_set_pmk_req
(
cfg
,
vif
->
pmk
);
if
(
ret
<
0
)
{
dev_err
(
cfg
->
dev
,
"%s(): mt7697_wr_set_pmk_req() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
if
(
memcmp
(
pmk
,
vif
->
pmk
,
sizeof
(
pmk
)))
{
ret
=
mt7697_wr_set_pmk_req
(
cfg
,
vif
->
pmk
);
if
(
ret
<
0
)
{
dev_err
(
cfg
->
dev
,
"%s(): mt7697_wr_set_pmk_req() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
}
else
{
ret
=
mt7697_wr_set_security_mode_req
(
cfg
,
MT7697_WIFI_AUTH_MODE_OPEN
,
MT7697_WIFI_ENCRYPT_TYPE_ENCRYPT_DISABLED
);
if
(
ret
<
0
)
{
dev_err
(
cfg
->
dev
,
"%s(): mt7697_wr_set_security_mode_req() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
}
if
(
len
>
0
)
{
...
...
linux_kernel_modules/mt7697wifi/main.c
View file @
9e531c86
...
...
@@ -34,7 +34,7 @@ static int mt7697_open(struct net_device *ndev)
{
struct
mt7697_cfg80211_info
*
cfg
=
mt7697_priv
(
ndev
);
struct
mt7697_vif
*
vif
=
netdev_priv
(
ndev
);
int
ret
;
int
ret
=
0
;
dev_dbg
(
cfg
->
dev
,
"%s(): open net device
\n
"
,
__func__
);
...
...
@@ -57,7 +57,7 @@ static int mt7697_open(struct net_device *ndev)
netif_carrier_on
(
ndev
);
netif_wake_queue
(
ndev
);
}
else
netif_carrier_o
ff
(
ndev
);
netif_carrier_o
n
(
ndev
);
cleanup:
return
ret
;
...
...
@@ -97,7 +97,8 @@ static void mt7697_set_multicast_list(struct net_device *ndev)
bool
mc_all_on
=
false
;
int
mc_count
=
netdev_mc_count
(
ndev
);
dev_dbg
(
cfg
->
dev
,
"%s(): net device set multicast
\n
"
,
__func__
);
dev_dbg
(
cfg
->
dev
,
"%s(): net device set multicast flags(0x%08x)
\n
"
,
__func__
,
ndev
->
flags
);
/* Enable multicast-all filter. */
mc_all_on
=
!!
(
ndev
->
flags
&
IFF_PROMISC
)
||
...
...
linux_kernel_modules/mt7697wifi/mt7697wifi_core.mdef
deleted
100644 → 0
View file @
cf879ddc
sources:
{
wmi.c
cfg80211.c
main.c
txrx.c
ioctl.c
}
cflags:
{
// -DDEBUG
-DCONFIG_WIRELESS_EXT
-DCONFIG_CFG80211_WEXT
-I$MANGOH_ROOT/linux_kernel_modules/mt7697q
}
linux_kernel_modules/mt7697wifi/scripts/mt7697ap.sh
View file @
9e531c86
...
...
@@ -11,17 +11,31 @@ export ITF_WAN="rmnet0" # 3G/4G interface as WLAN interface
export
WIFIAPIP
=
"192.168.20.1"
export
WIFIAPMASK
=
"255.255.255.0"
export
SUBNET
=
"192.168.0.0/24"
#
export SUBNET="192.168.0.0/24"
export
WIFIAPSTART
=
"192.168.20.10"
export
WIFIAPSTOP
=
"192.168.20.100"
# DHCP config file
export
DHCP_CFG_FILE
=
dnsmasq.wlan.conf
/sbin/ifup wlan1
echo
"Mounting of
$ITF_LAN
..."
/sbin/ifup
$ITF_LAN
ifconfig
$ITF_LAN
$WIFIAPIP
netmask
$WIFIAPMASK
up
echo
"Reconfiguring the DHCP server..."
/etc/init.d/dnsmasq stop
||
echo
-ne
">>>>>>>>>>>>>>>>>>> UNABLE TO STOP THE DHCP server"
### Configure the IP addresses range for DHCP (dnsmasq)
test
-L
/etc/dnsmasq.d/
$DHCP_CFG_FILE
||
ln
-s
/tmp/
$DHCP_CFG_FILE
/etc/dnsmasq.d/
$DHCP_CFG_FILE
echo
"Generating the configuration file for the DHCP server..."
echo
-ne
"log-dhcp
\n
log-queries
\n
"
\
"log-facility=/tmp/dnsmasq.log
\n
"
\
"interface=
$ITF_LAN
\n
"
\
"dhcp-option=
$ITF_LAN
,3,
$WIFIAPIP
\n
"
\
"dhcp-option=
$ITF_LAN
,6,
$WIFIAPIP
\n
"
\
"dhcp-range=
$WIFIAPSTART
,
$WIFIAPSTOP
,24h
\n
"
\
"server=8.8.8.8
\n
"
>>
/tmp/
$DHCP_CFG_FILE
echo
"Mounting the relay interface
$ITF_WAN
..."
case
"
$ITF_WAN
"
in
eth
*
)
...
...
@@ -38,56 +52,30 @@ case "$ITF_WAN" in
echo
"Waiting for data connection on
$ITF_WAN
..."
;;
esac
RETRY
=
0
while
[
$RETRY
-lt
30
]
;
do
ITF_WAN_ADDR
=
$(
ifconfig
$ITF_WAN
|
grep
"inet addr"
|
cut
-d
':'
-f
2 |
cut
-d
' '
-f
1
)
if
[
"
$ITF_WAN_ADDR
"
==
""
]
;
then
sleep
1
RETRY
=
$((
$RETRY
+
1
))
else
break
fi
done
if
[
"
$ITF_WAN_ADDR
"
==
""
]
;
then
echo
"Mounting of relay interface
$ITF_WAN
failed..."
else
echo
"Relay interface
$ITF_WAN
IP address is
$ITF_WAN_ADDR
"
route add default gw
$ITF_WAN_ADDR
$ITF_WAN
fi
### Start the DHCP server
echo
"Restarting the DHCP server..."
/etc/init.d/dnsmasq start
||
echo
">>>>>>>>>>>>>>>>>>> UNABLE TO START THE DHCP server"
echo
"Enabling IP forwarding..."
echo
1
>
/proc/sys/net/ipv4/ip_forward
echo
"Configuring the NAT..."
modprobe ipt_MASQUERADE
iptables
-A
POSTROUTING
-t
nat
-o
$ITF_WAN
-j
MASQUERADE
iptables
-A
FORWARD
--match
state
--state
RELATED,ESTABLISHED
--jump
ACCEPT
iptables
-A
FORWARD
-i
$ITF_LAN
--destination
$SUBNET
--match
state
--state
NEW
--jump
ACCEPT
iptables
-A
INPUT
-s
$SUBNET
--jump
ACCEPT
echo
"Check SIM inserted..."
cm sim
echo
"Moving IP tables rules..."
if
[
!
-d
/etc/iptables/backup
]
;
then
mkdir
/etc/iptables/backup
fi
if
[
!
-f
/etc/iptables/rules.v4
]
;
then
mv
/etc/iptables/rules.v4 /etc/iptables/backup/.
fi
if
[
!
-f
/etc/iptables/rules.v4
]
;
then
mv
/etc/iptables/rules.v6 /etc/iptables/backup/.
fi
echo
"Cleaning IP tables..."
iptables
--flush
iptables
--table
nat
--flush
iptables
--table
nat
--delete-chain
echo
"Reconfiguring the DHCP server..."
/etc/init.d/dnsmasq stop
||
echo
-ne
">>>>>>>>>>>>>>>>>>> UNABLE TO STOP THE DHCP server"
### Configure the IP addresses range for DHCP (dnsmasq)
test
-L
/etc/dnsmasq.d/
$DHCP_CFG_FILE
||
ln
-s
/tmp/
$DHCP_CFG_FILE
/etc/dnsmasq.d/
$DHCP_CFG_FILE
echo
"Configuring the NAT..."
iptables
-P
INPUT ACCEPT
iptables
-P
OUTPUT ACCEPT
iptables
-P
FORWARD ACCEPT
iptables
--table
nat
-A
POSTROUTING
-o
$ITF_WAN
-j
MASQUERADE
iptables
-A
FORWARD
-i
$ITF_WAN
-o
$ITF_LAN
-m
state
--state
RELATED,ESTABLISHED
-j
ACCEPT
iptables
-A
FORWARD
-i
$ITF_LAN
-o
$ITF_WAN
-m
state
--state
NEW
-j
ACCEPT
echo
"Generating the configuration file for the DHCP server..."
echo
-ne
"log-dhcp
\n
log-queries
\n
log-facility=/tmp/dnsmasq.log
\n
dhcp-range=
$ITF_LAN
,
$WIFIAPSTART
,
$WIFIAPSTOP
,24h
\n
server=8.8.8.8
\n
"
>>
/tmp/
$DHCP_CFG_FILE
### Start the DHCP server
echo
"Restarting the DHCP server..."
/etc/init.d/dnsmasq start
||
echo
">>>>>>>>>>>>>>>>>>> UNABLE TO START THE DHCP server"
echo
"Enabling IP forwarding..."
sysctl
-w
net.ipv4.ip_forward
=
1
echo
"Start wpa supplicant...."
export
LD_LIBRARY_PATH
=
$LD_LIBRARY_PATH
:/mnt/flash/wifi
/mnt/flash/mtwifi/wpa_supplicant
-Dwext
-i
wlan1
-c
/etc/mt7697-ap
-B
/mnt/flash/mtwifi/wpa_supplicant
-Dwext
-i
$ITF_LAN
-c
/etc/mt7697-ap
-B
linux_kernel_modules/mt7697wifi/scripts/mtwifi
View file @
9e531c86
...
...
@@ -14,31 +14,19 @@ mt_wifi_start() {
lsmod |
grep
0_cp2130
>
/dev/null
if
[
$?
-eq
1
]
;
then
insmod /
mnt/flash/mtwifi
/0-cp2130.ko
||
exit
127
insmod /
legato/systems/current/modules
/0-cp2130.ko
||
exit
127
echo
"Initialized CP2130"
;
fi
lsmod |
grep
1_mt7697q
>
/dev/null
if
[
$?
-eq
1
]
;
then
insmod /
mnt/flash/mtwifi
/1-mt7697q.ko
||
exit
127
insmod /
legato/systems/current/modules
/1-mt7697q.ko
||
exit
127
echo
"Initialized MT7697 queues"
;
fi
lsmod |
grep
cfg80211
>
/dev/null
if
[
$?
-eq
1
]
;
then
insmod /mnt/flash/mtwifi/cfg80211.ko
||
exit
127
echo
"Initialized cfg80211"
;
fi
lsmod |
grep
mac80211
>
/dev/null
if
[
$?
-eq
1
]
;
then
insmod /mnt/flash/mtwifi/mac80211.ko
||
exit
127
echo
"Initialized mac80211"
;
fi
fi
lsmod |
grep
2_mt7697wifi_core
>
/dev/null
if
[
$?
-eq
1
]
;
then
insmod /
mnt/flash/mtwifi
/2-mt7697wifi_core.ko
itf_idx_start
=
$1
||
exit
127
insmod /
legato/systems/current/modules
/2-mt7697wifi_core.ko
itf_idx_start
=
$1
||
exit
127
echo
"Initialized MT7697 80211 core"
;
sleep
2
fi
...
...
linux_kernel_modules/mt7697wifi/txrx.c
View file @
9e531c86
...
...
@@ -18,82 +18,6 @@
#include "common.h"
#include "core.h"
static
int
mt7697_ethernet_to_80211
(
struct
sk_buff
*
skb
,
struct
net_device
*
ndev
)
{
struct
ieee80211_hdr
hdr
;
struct
mt7697_cfg80211_info
*
cfg
=
mt7697_priv
(
ndev
);
struct
mt7697_vif
*
vif
=
netdev_priv
(
ndev
);
struct
ethhdr
*
eth_hdr
=
(
struct
ethhdr
*
)
skb
->
data
;
struct
mt7697_llc_snap_hdr
*
llc_hdr
;
u8
*
datap
;
int
ret
=
0
;
__be16
type
=
eth_hdr
->
h_proto
;
__le16
fc
;
u16
hdrlen
;
dev_dbg
(
cfg
->
dev
,
"%s(): Tx 802.3 Frame len(%u)
\n
"
,
__func__
,
skb
->
len
);
// print_hex_dump(KERN_DEBUG, DRVNAME" 802.3 Frame ", DUMP_PREFIX_OFFSET,
// 16, 1, skb->data, skb->len, 0);
fc
=
cpu_to_le16
(
IEEE80211_FTYPE_DATA
|
IEEE80211_STYPE_DATA
);
switch
(
vif
->
wdev
.
iftype
)
{
case
NL80211_IFTYPE_STATION
:
fc
|=
cpu_to_le16
(
IEEE80211_FCTL_TODS
);
/* BSSID SA DA */
hdr
.
frame_control
=
fc
;
memcpy
(
hdr
.
addr1
,
vif
->
bssid
,
ETH_ALEN
);
memcpy
(
hdr
.
addr2
,
eth_hdr
->
h_source
,
ETH_ALEN
);
memcpy
(
hdr
.
addr3
,
eth_hdr
->
h_dest
,
ETH_ALEN
);
break
;
case
NL80211_IFTYPE_AP
:
fc
|=
cpu_to_le16
(
IEEE80211_FCTL_FROMDS
);
/* DA BSSID SA */
hdr
.
frame_control
=
fc
;
memcpy
(
hdr
.
addr1
,
eth_hdr
->
h_dest
,
ETH_ALEN
);
memcpy
(
hdr
.
addr2
,
cfg
->
mac_addr
.
addr
,
ETH_ALEN
);
memcpy
(
hdr
.
addr3
,
eth_hdr
->
h_source
,
ETH_ALEN
);
break
;
default:
dev_warn
(
cfg
->
dev
,
"%s(): unsupported iftype(%d)
\n
"
,
__func__
,
vif
->
wdev
.
iftype
);
ret
=
-
EINVAL
;
goto
cleanup
;
}
hdr
.
duration_id
=
0
;
hdr
.
seq_ctrl
=
0
;
hdrlen
=
sizeof
(
struct
ieee80211_hdr_3addr
);
datap
=
skb_push
(
skb
,
hdrlen
+
sizeof
(
struct
mt7697_llc_snap_hdr
)
-
sizeof
(
struct
ethhdr
));
memcpy
(
datap
,
&
hdr
,
hdrlen
);
llc_hdr
=
(
struct
mt7697_llc_snap_hdr
*
)(
datap
+
hdrlen
);
llc_hdr
->
dsap
=
0xAA
;
llc_hdr
->
ssap
=
0xAA
;
llc_hdr
->
cntl
=
0x03
;
llc_hdr
->
org_code
[
0
]
=
0x0
;
llc_hdr
->
org_code
[
1
]
=
0x0
;
llc_hdr
->
org_code
[
2
]
=
0x0
;
llc_hdr
->
eth_type
=
type
;
dev_dbg
(
cfg
->
dev
,
"%s(): Tx 802.11 Frame len(%u)
\n
"
,
__func__
,
skb
->
len
);
// print_hex_dump(KERN_DEBUG, DRVNAME" <-- Tx 802.11 Frame ",
// DUMP_PREFIX_OFFSET, 16, 1, skb->data, skb->len, 0);
cleanup:
return
ret
;
}
int
mt7697_data_tx
(
struct
sk_buff
*
skb
,
struct
net_device
*
ndev
)
{
struct
mt7697_cfg80211_info
*
cfg
=
mt7697_priv
(
ndev
);
...
...
@@ -125,13 +49,6 @@ int mt7697_data_tx(struct sk_buff *skb, struct net_device *ndev)
}
}
ret
=
mt7697_ethernet_to_80211
(
skb
,
ndev
);
if
(
ret
<
0
)
{
dev_err
(
cfg
->
dev
,
"%s(): mt7697_ethernet_to_80211() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
cookie
=
mt7697_alloc_cookie
(
cfg
);
if
(
cookie
==
NULL
)
{
ret
=
-
ENOMEM
;
...
...
@@ -263,6 +180,8 @@ int mt7697_rx_data(struct mt7697_cfg80211_info *cfg, u32 len, u32 if_idx)
vif
->
net_stats
.
rx_bytes
+=
len
;
skb
->
protocol
=
eth_type_trans
(
skb
,
skb
->
dev
);
dev_dbg
(
cfg
->
dev
,
"%s(): rx frame protocol(%u) type(%u)
\n
"
,
__func__
,
skb
->
protocol
,
skb
->
pkt_type
);
ret
=
netif_rx_ni
(
skb
);
if
(
ret
!=
NET_RX_SUCCESS
)
{
...
...
linux_kernel_modules/mt7697wifi/wmi.c
View file @
9e531c86
...
...
@@ -792,8 +792,8 @@ static int mt7697_rx_raw(const struct mt7697q_rsp_hdr* rsp,
goto
cleanup
;
}
//
print_hex_dump(KERN_DEBUG, DRVNAME" RX ", DUMP_PREFIX_OFFSET,
//
16, 1, cfg->rx_data, rsp->result, 0);
print_hex_dump
(
KERN_DEBUG
,
DRVNAME
" RX "
,
DUMP_PREFIX_OFFSET
,
16
,
1
,
cfg
->
rx_data
,
rsp
->
result
,
0
);
if
(
list_empty
(
&
cfg
->
vif_list
))
{
dev_dbg
(
cfg
->
dev
,
"%s(): no interfaces
\n
"
,
__func__
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment