summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerry Chen <terry-ht.chen@broadcom.corp-partner.google.com>2020-04-01 14:33:28 +0800
committerAhmed ElArabawy <arabawy@google.com>2020-04-29 17:54:58 +0000
commit26c49a560fe93db62f9afaa370b7796fc33be60b (patch)
tree2cfe0323462015f9386c67cc72b0051c797a60e6
parent60388f580fe01f153104fd31f6ad2a045baa29cd (diff)
downloadwlan-26c49a560fe93db62f9afaa370b7796fc33be60b.tar.gz
Wifi: Consider ethertype in KeepAlive packet offloading
Handling the ether_type coming from framework for Keepalive packet offloading. Bug: 150341443 Test: halutil utilty command test -mkeep_alive [-start] <index (1 to 3)> <period_msec> <src_mac> <dst_mac> <ether_type> [IP packet] Select proper ether_type, valid values 0x0800(2048) for IP or 0x86dd(34525) IPv6 - Test Ipv6 ethernet type - hikey960:/ # halutil -mkeep_alive -start 1 20000 000f66f45b7e 0014a54b164f 34525 4500001e0000400040 Start mkeep_alive with ID 1, 20000 period(msec), src(00:0f:66:f4:5b:7e), dst(00:14:a5:4b:16:4f) with ether_type = 86dd Success to register mkeep_alive by ID 1 - Test Ipv4 ethernet type - hikey960:/ # halutil -mkeep_alive -start 2 20000 000f66f45b7e 0014a54b164f 2048 4500001e0000400040 Start mkeep_alive with ID 2, 20000 period(msec), src(00:0f:66:f4:5b:7e), dst(00:14:a5:4b:16:4f) with ether_type = 800 Success to register mkeep_alive by ID 2 Signed-off-by: Terry Chen <terry-ht.chen@broadcom.corp-partner.google.com> Change-Id: I43de1b12c104bc1c49e3b5837453bce8e7dd77c5 Merged-In: I43de1b12c104bc1c49e3b5837453bce8e7dd77c5 (cherry picked from commit 7b1a8ee09bb749b7e27c1b5a3869e2b675c28942)
-rwxr-xr-xbcmdhd/wifi_hal/common.h2
-rw-r--r--bcmdhd/wifi_hal/wifi_offload.cpp31
2 files changed, 25 insertions, 8 deletions
diff --git a/bcmdhd/wifi_hal/common.h b/bcmdhd/wifi_hal/common.h
index 144f859..e728b54 100755
--- a/bcmdhd/wifi_hal/common.h
+++ b/bcmdhd/wifi_hal/common.h
@@ -34,6 +34,8 @@
#define DOT11_OUI_LEN 3
#define DOT11_MAX_SSID_LEN 32
+#define ETHERTYPE_IP 0x0800 /* IP */
+#define ETHERTYPE_IPV6 0x86dd /* IP protocol version 6 */
#define MAX_PROBE_RESP_IE_LEN 2048
/*
Vendor OUI - This is a unique identifier that identifies organization. Lets
diff --git a/bcmdhd/wifi_hal/wifi_offload.cpp b/bcmdhd/wifi_hal/wifi_offload.cpp
index 99c2fec..8054f49 100644
--- a/bcmdhd/wifi_hal/wifi_offload.cpp
+++ b/bcmdhd/wifi_hal/wifi_offload.cpp
@@ -57,7 +57,8 @@ typedef enum {
MKEEP_ALIVE_ATTRIBUTE_IP_PKT_LEN,
MKEEP_ALIVE_ATTRIBUTE_SRC_MAC_ADDR,
MKEEP_ALIVE_ATTRIBUTE_DST_MAC_ADDR,
- MKEEP_ALIVE_ATTRIBUTE_PERIOD_MSEC
+ MKEEP_ALIVE_ATTRIBUTE_PERIOD_MSEC,
+ MKEEP_ALIVE_ATTRIBUTE_ETHER_TYPE
} WIFI_MKEEP_ALIVE_ATTRIBUTE;
typedef enum {
@@ -75,13 +76,14 @@ class MKeepAliveCommand : public WifiCommand
u8 *mDstMacAddr;
u32 mPeriodMsec;
GetCmdType mType;
+ u16 mEther_type;
public:
// constructor for start sending
- MKeepAliveCommand(wifi_interface_handle iface, u8 index, u8 *ip_packet, u16 ip_packet_len,
+ MKeepAliveCommand(wifi_interface_handle iface, u8 index, u16 ether_type, u8 *ip_packet, u16 ip_packet_len,
u8 *src_mac_addr, u8 *dst_mac_addr, u32 period_msec, GetCmdType cmdType)
- : WifiCommand("MKeepAliveCommand", iface, 0), mIndex(index), mIpPkt(ip_packet),
+ : WifiCommand("MKeepAliveCommand", iface, 0), mIndex(index), mEther_type(ether_type), mIpPkt(ip_packet),
mIpPktLen(ip_packet_len), mSrcMacAddr(src_mac_addr), mDstMacAddr(dst_mac_addr),
mPeriodMsec(period_msec), mType(cmdType)
{ }
@@ -89,10 +91,17 @@ public:
// constructor for stop sending
MKeepAliveCommand(wifi_interface_handle iface, u8 index, GetCmdType cmdType)
: WifiCommand("MKeepAliveCommand", iface, 0), mIndex(index), mType(cmdType)
- { }
+ {
+ mIpPkt = NULL;
+ mIpPktLen = 0;
+ mSrcMacAddr = NULL;
+ mDstMacAddr = NULL;
+ mPeriodMsec = 0;
+ mEther_type = 0;
+ }
int createRequest(WifiRequest &request) {
- int result;
+ int result = WIFI_SUCCESS;
switch (mType) {
case START_MKEEP_ALIVE:
@@ -140,6 +149,11 @@ public:
ALOGE("Failed to put period request; result = %d", result);
return result;
}
+ result = request.put_u16(MKEEP_ALIVE_ATTRIBUTE_ETHER_TYPE, mEther_type);
+ if (result < 0) {
+ ALOGE("Failed to put ether type; result = %d", result);
+ return result;
+ }
request.attr_end(data);
break;
@@ -216,13 +230,14 @@ public:
/* API to send specified mkeep_alive packet periodically. */
wifi_error wifi_start_sending_offloaded_packet(wifi_request_id index, wifi_interface_handle iface,
- u16 /* ether_type */, u8 *ip_packet, u16 ip_packet_len, u8 *src_mac_addr, u8 *dst_mac_addr,
+ u16 ether_type, u8 *ip_packet, u16 ip_packet_len, u8 *src_mac_addr, u8 *dst_mac_addr,
u32 period_msec)
{
if ((index > 0 && index <= N_AVAIL_ID) && (ip_packet != NULL) && (src_mac_addr != NULL)
&& (dst_mac_addr != NULL) && (period_msec > 0)
- && (ip_packet_len <= MKEEP_ALIVE_IP_PKT_MAX)) {
- MKeepAliveCommand *cmd = new MKeepAliveCommand(iface, index, ip_packet, ip_packet_len,
+ && (ip_packet_len <= MKEEP_ALIVE_IP_PKT_MAX) && ((ether_type == ETHERTYPE_IP) ||
+ (ether_type == ETHERTYPE_IPV6))) {
+ MKeepAliveCommand *cmd = new MKeepAliveCommand(iface, index, ether_type, ip_packet, ip_packet_len,
src_mac_addr, dst_mac_addr, period_msec, START_MKEEP_ALIVE);
NULL_CHECK_RETURN(cmd, "memory allocation failure", WIFI_ERROR_OUT_OF_MEMORY);
wifi_error result = (wifi_error)cmd->start();