qcacld-3.0: Handle NUD event if subnet gateway is configured

Add protective check in driver to handle NUD events only if
subnet gateway is configured.

Change-Id: I5142e4d50490ea4726f337e19c8282359d23423d
CRs-Fixed: 2373552
This commit is contained in:
Alok Kumar 2018-12-31 14:32:09 +05:30 • committed by nshrivas
commit d9111bb36b
2 changed files with 22 additions and 9 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2018, 2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -28,6 +28,7 @@ void hdd_nud_set_gateway_addr(struct hdd_adapter *adapter,
qdf_mem_copy(adapter->nud_tracking.gw_mac_addr.bytes,
gw_mac_addr.bytes,
sizeof(struct qdf_mac_addr));
adapter->nud_tracking.is_gw_updated = true;
}
void hdd_nud_incr_gw_rx_pkt_cnt(struct hdd_adapter *adapter,
@ -36,6 +37,9 @@ void hdd_nud_incr_gw_rx_pkt_cnt(struct hdd_adapter *adapter,
if (!adapter->nud_tracking.is_gw_rx_pkt_track_enabled)
return;
if (!adapter->nud_tracking.is_gw_updated)
return;
if (qdf_is_macaddr_equal(&adapter->nud_tracking.gw_mac_addr,
mac_addr))
qdf_atomic_inc(&adapter
@ -83,6 +87,7 @@ void hdd_nud_reset_tracking(struct hdd_adapter *adapter)
hdd_debug("Reset the NUD tracking");
qdf_zero_macaddr(&adapter->nud_tracking.gw_mac_addr);
adapter->nud_tracking.is_gw_updated = false;
qdf_mem_zero(&adapter->nud_tracking.tx_rx_stats,
sizeof(struct hdd_nud_tx_rx_stats));
@ -171,11 +176,13 @@ static bool hdd_nud_honour_failure(struct hdd_adapter *adapter)
->nud_tracking.tx_rx_stats.gw_rx_packets);
if (!tx_transmitted || !tx_acked || !gw_rx_pkt) {
hdd_debug("NUD_FAILURE_HONORED");
hdd_debug("NUD_FAILURE_HONORED [mac:%pM]",
adapter->nud_tracking.gw_mac_addr.bytes);
hdd_nud_stats_info(adapter);
return true;
}
hdd_debug("NUD_FAILURE_NOT_HONORED");
hdd_debug("NUD_FAILURE_NOT_HONORED [mac:%pM]",
adapter->nud_tracking.gw_mac_addr.bytes);
hdd_nud_stats_info(adapter);
return false;
}
@ -288,6 +295,7 @@ void hdd_nud_init_tracking(struct hdd_adapter *adapter)
adapter->nud_tracking.curr_state = NUD_NONE;
adapter->nud_tracking.ignore_nud_tracking = false;
adapter->nud_tracking.is_gw_updated = false;
qdf_atomic_init(&adapter
->nud_tracking.tx_rx_stats.gw_rx_packets);
@ -352,6 +360,14 @@ static void hdd_nud_filter_netevent(struct neighbour *neigh)
if (status)
return;
if (adapter->nud_tracking.ignore_nud_tracking) {
hdd_debug("NUD Tracking is Disabled");
return;
}
if (!adapter->nud_tracking.is_gw_updated)
return;
if (adapter->device_mode != QDF_STA_MODE)
return;
@ -363,11 +379,6 @@ static void hdd_nud_filter_netevent(struct neighbour *neigh)
return;
}
if (adapter->nud_tracking.ignore_nud_tracking) {
hdd_debug("NUD Tracking is Disabled");
return;
}
if (!qdf_is_macaddr_equal(&adapter->nud_tracking.gw_mac_addr,
(struct qdf_mac_addr *)&neigh->ha[0]))
return;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2018, 2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -55,6 +55,7 @@ struct hdd_nud_tx_rx_stats {
* @nud_event_work: work to be scheduled during NUD_FAILED
* @is_gw_rx_pkt_track_enabled: true if rx pkt capturing is enabled for GW,
* else false
* @is_gw_updated: true if GW is updated for NUD Tracking
*/
struct hdd_nud_tracking_info {
uint8_t curr_state;
@ -63,6 +64,7 @@ struct hdd_nud_tracking_info {
struct qdf_mac_addr gw_mac_addr;
qdf_work_t nud_event_work;
bool is_gw_rx_pkt_track_enabled;
bool is_gw_updated;
};
/**