mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 12:57:06 +09:00
net: wireless: bcmdhd: Improve arp_hostip_table processing
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
@@ -682,6 +682,7 @@ extern void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar);
|
||||
extern void dhd_wait_event_wakeup(dhd_pub_t*dhd);
|
||||
|
||||
#ifdef ARP_OFFLOAD_SUPPORT
|
||||
#define MAX_IPV4_ENTRIES 8
|
||||
/* dhd_commn arp offload wrapers */
|
||||
void dhd_aoe_hostip_clr(dhd_pub_t *dhd);
|
||||
void dhd_aoe_arp_clr(dhd_pub_t *dhd);
|
||||
|
||||
@@ -1486,11 +1486,8 @@ void dhd_arp_offload_add_ip(dhd_pub_t *dhd, uint32 ipaddr)
|
||||
__FUNCTION__));
|
||||
}
|
||||
|
||||
|
||||
int dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen)
|
||||
{
|
||||
#define MAX_IPV4_ENTRIES 8
|
||||
|
||||
int retcode, i;
|
||||
int iov_len = 0;
|
||||
uint32 *ptr32 = buf;
|
||||
@@ -1502,27 +1499,28 @@ int dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen)
|
||||
iov_len = bcm_mkiovar("arp_hostip", 0, 0, buf, buflen);
|
||||
retcode = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, buflen, TRUE, 0);
|
||||
|
||||
/* clean up the buf, ascii reminder */
|
||||
for (i = 0; i < MAX_IPV4_ENTRIES; i++) {
|
||||
|
||||
if (!clr_bottom) {
|
||||
if (*ptr32 == 0)
|
||||
clr_bottom = TRUE;
|
||||
} else {
|
||||
*ptr32 = 0;
|
||||
}
|
||||
ptr32++;
|
||||
}
|
||||
|
||||
if (retcode) {
|
||||
DHD_TRACE(("%s: ioctl WLC_GET_VAR error %d\n",
|
||||
__FUNCTION__, retcode));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* clean up the buf, ascii reminder */
|
||||
for (i = 0; i < MAX_IPV4_ENTRIES; i++) {
|
||||
if (!clr_bottom) {
|
||||
if (*ptr32 == 0)
|
||||
clr_bottom = TRUE;
|
||||
} else {
|
||||
*ptr32 = 0;
|
||||
}
|
||||
ptr32++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* ARP_OFFLOAD_SUPPORT */
|
||||
|
||||
int
|
||||
dhd_preinit_ioctls(dhd_pub_t *dhd)
|
||||
{
|
||||
|
||||
@@ -2804,20 +2804,27 @@ int dhd_change_mtu(dhd_pub_t *dhdp, int new_mtu, int ifidx)
|
||||
/* add or remove AOE host ip(s) (up to 8 IPs on the interface) */
|
||||
void aoe_update_host_ipv4_table(dhd_pub_t *dhd_pub, u32 ipa, bool add)
|
||||
{
|
||||
u32 ipv4_buf[8]; /* temp save for AOE host_ip table */
|
||||
u32 ipv4_buf[MAX_IPV4_ENTRIES]; /* temp save for AOE host_ip table */
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
bzero(ipv4_buf, sizeof(ipv4_buf));
|
||||
|
||||
/* display what we've got */
|
||||
dhd_arp_get_arp_hostip_table(dhd_pub, ipv4_buf, sizeof(ipv4_buf));
|
||||
ret = dhd_arp_get_arp_hostip_table(dhd_pub, ipv4_buf, sizeof(ipv4_buf));
|
||||
DHD_ARPOE(("%s: hostip table read from Dongle:\n", __FUNCTION__));
|
||||
/* dhd_print_buf(ipv4_buf, 32, 4); */ /* max 8 IPs 4b each */
|
||||
|
||||
#ifdef AOE_DBG
|
||||
dhd_print_buf(ipv4_buf, 32, 4); /* max 8 IPs 4b each */
|
||||
#endif
|
||||
/* now we saved hoste_ip table, clr it in the dongle AOE */
|
||||
dhd_aoe_hostip_clr(dhd_pub);
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (ret) {
|
||||
DHD_ERROR(("%s failed\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_IPV4_ENTRIES; i++) {
|
||||
|
||||
if (add && (ipv4_buf[i] == 0)) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user