Android: Remove sd lists
Change-Id: I135d58bf8b382fc9c735507df72193e9665357a7
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 61cafe4..5b9e5f3 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -120,12 +120,6 @@
p2p_dbg(p2p, "Expiring old peer entry " MACSTR,
MAC2STR(dev->info.p2p_device_addr));
-
-#ifdef ANDROID_P2P
- /* SD_FAIR_POLICY: Update the current sd_dev_list pointer to next device */
- if(&dev->list == p2p->sd_dev_list)
- p2p->sd_dev_list = dev->list.next;
-#endif
dl_list_del(&dev->list);
p2p_device_free(p2p, dev);
}
@@ -421,11 +415,6 @@
}
if (count + 1 > p2p->cfg->max_peers && oldest) {
p2p_dbg(p2p, "Remove oldest peer entry to make room for a new peer");
-#ifdef ANDROID_P2P
- /* SD_FAIR_POLICY: Update the current sd_dev_list pointer to next device */
- if(&oldest->list == p2p->sd_dev_list)
- p2p->sd_dev_list = oldest->list.next;
-#endif
dl_list_del(&oldest->list);
p2p_device_free(p2p, oldest);
}
@@ -964,15 +953,7 @@
p2p->after_scan_tx->wait_time);
os_free(p2p->after_scan_tx);
p2p->after_scan_tx = NULL;
-#ifdef ANDROID_P2P
- /* For SD frames, there is a scenario, where we can receive a SD request frame during p2p_scan.
- * At that moment, we will send the SD response from this context. After sending the SD response,
- * we need to continue p2p_find. But if we return 1 from here, p2p_find is going to be stopped.
- */
- return 0;
-#else
return 1;
-#endif
}
op = p2p->start_after_scan;
@@ -2414,8 +2395,6 @@
* increasing min listen time to 200ms.
*/
p2p->min_disc_int = 2;
- /* SD_FAIR_POLICY: Initializing the SD current serviced pointer to NULL */
- p2p->sd_dev_list = NULL;
#else
p2p->min_disc_int = 1;
#endif
@@ -2493,10 +2472,6 @@
dl_list_del(&dev->list);
p2p_device_free(p2p, dev);
}
-#ifdef ANDROID_P2P
- /* SD_FAIR_POLICY: Initializing the SD current serviced pointer to NULL */
- p2p->sd_dev_list = NULL;
-#endif
p2p_free_sd_queries(p2p);
os_free(p2p->after_scan_tx);
p2p->after_scan_tx = NULL;
@@ -2674,37 +2649,8 @@
void p2p_continue_find(struct p2p_data *p2p)
{
struct p2p_device *dev;
-#ifdef ANDROID_P2P
- int skip=1;
-#endif
p2p_set_state(p2p, P2P_SEARCH);
dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
-#ifdef ANDROID_P2P
- /* SD_FAIR_POLICY: We need to give chance to all devices in the device list
- * There may be a scenario, where a particular peer device have
- * not registered any query response. When we send a SD request to such device,
- * no response will be received. And if we continue to get probe responses from that device,
- * and if that device happens to be on top in our device list,
- * we will always continue to send SD requests always to that peer only.
- * We will not be able to send SD requests to other devices in that case.
- * This implementation keeps track of last serviced peer device.
- * And then takes the next one from the device list, in the next iteration.
- */
- if (p2p->sd_dev_list && p2p->sd_dev_list != &p2p->devices) {
- if(skip) {
- if ((&dev->list == p2p->sd_dev_list) ) {
- skip = 0;
- if (dev->list.next == &p2p->devices)
- p2p->sd_dev_list = NULL;
- }
- continue;
- }
- }
- p2p->sd_dev_list = &dev->list;
- wpa_printf(MSG_DEBUG, "P2P: ### Servicing %p dev->flags 0x%x SD schedule %s devaddr " MACSTR,
- p2p->sd_dev_list, dev->flags, dev->flags & P2P_DEV_SD_SCHEDULE ? "TRUE": "FALSE",
- MAC2STR(dev->info.p2p_device_addr));
-#endif
if (dev->flags & P2P_DEV_SD_SCHEDULE) {
if (p2p_start_sd(p2p, dev) == 0)
return;
diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
index fef223f..3e105eb 100644
--- a/src/p2p/p2p_i.h
+++ b/src/p2p/p2p_i.h
@@ -227,14 +227,6 @@
*/
struct dl_list devices;
-#ifdef ANDROID_P2P
- /**
- * sd_dev_list - device pointer to be serviced next
- * for service discovery
- */
- struct dl_list *sd_dev_list;
-#endif
-
/**
* go_neg_peer - Pointer to GO Negotiation peer
*/
diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c
index 795ca6b..ade93a2 100644
--- a/src/p2p/p2p_sd.c
+++ b/src/p2p/p2p_sd.c
@@ -430,15 +430,7 @@
u16 slen;
u16 update_indic;
-#ifdef ANDROID_P2P
- if (p2p->state != P2P_SD_DURING_FIND) {
- p2p_dbg(p2p, "P2P: #### Not ignoring unexpected GAS Initial Response from "
- MACSTR " state %d", MAC2STR(sa), p2p->state);
- }
- if (p2p->sd_peer == NULL ||
-#else
if (p2p->state != P2P_SD_DURING_FIND || p2p->sd_peer == NULL ||
-#endif
os_memcmp(sa, p2p->sd_peer->info.p2p_device_addr, ETH_ALEN) != 0) {
p2p_dbg(p2p, "Ignore unexpected GAS Initial Response from "
MACSTR, MAC2STR(sa));
@@ -653,15 +645,7 @@
wpa_hexdump(MSG_DEBUG, "P2P: RX GAS Comeback Response", data, len);
-#ifdef ANDROID_P2P
- if (p2p->state != P2P_SD_DURING_FIND) {
- p2p_dbg(p2p, "P2P: #### Not ignoring unexpected GAS Comeback Response from "
- MACSTR " state %d", MAC2STR(sa), p2p->state);
- }
- if (p2p->sd_peer == NULL ||
-#else
if (p2p->state != P2P_SD_DURING_FIND || p2p->sd_peer == NULL ||
-#endif
os_memcmp(sa, p2p->sd_peer->info.p2p_device_addr, ETH_ALEN) != 0) {
p2p_dbg(p2p, "Ignore unexpected GAS Comeback Response from "
MACSTR, MAC2STR(sa));
@@ -901,9 +885,6 @@
{
if (p2p_unlink_sd_query(p2p, req)) {
p2p_dbg(p2p, "Cancel pending SD query %p", req);
-#ifdef ANDROID_P2P
- p2p->sd_dev_list = NULL;
-#endif
p2p_free_sd_query(req);
return 0;
}