FreeBSD/sys/arm/cavium/cns11xx/if_ece.c
/**
 * The behavior of ARL table reading and deletion is not well defined
 * in the documentation. To be safe, all mac addresses are put to a
 * list, then deleted.
 *
 */
The behavior of ARL table reading and deletion is not well defined
in the documentation. To be safe, all mac addresses are put to a
list, then deleted.
The behavior of ARL table reading and deletion is not well defined in the documentation . To be safe all mac addresses are put to a list then deleted .
static void
clear_mac_entries(struct ece_softc *ec, int include_this_mac)
{
	int table_end;
	struct mac_list * temp;
	struct mac_list * mac_list_header;
	struct mac_list * current;
	char mac[ETHER_ADDR_LEN];
	current = NULL;
	mac_list_header = NULL;
	table_end = read_mac_entry(ec, mac, 1);
	while (!table_end) {
		if (!include_this_mac &&
		    memcmp(mac, vlan0_mac, ETHER_ADDR_LEN) == 0) {
			table_end = read_mac_entry(ec, mac, 0);
			continue;
		}
		temp = (struct mac_list*)malloc(sizeof(struct mac_list),
		    M_DEVBUF,
		    M_NOWAIT | M_ZERO);
		memcpy(temp->mac_addr, mac, ETHER_ADDR_LEN);
		temp->next = 0;
		if (mac_list_header) {
			current->next = temp;
			current = temp;
		} else {
			mac_list_header = temp;
			current = temp;
		}
		table_end = read_mac_entry(ec, mac, 0);
	}
	current = mac_list_header;
	while (current) {
		remove_mac_entry(ec, current->mac_addr);
		temp = current;
		current = current->next;
		free(temp, M_DEVBUF);
	}
}
static void clear_mac_entries ( struct ece_softc * ec , int include_this_mac ) { int table_end ; struct mac_list * temp ; struct mac_list * mac_list_header ; struct mac_list * current ; char mac [ ETHER_ADDR_LEN ] ; current = NULL ; mac_list_header = NULL ; table_end = read_mac_entry ( ec , mac , 1 ) ; while ( ! table_end ) { if ( ! include_this_mac && memcmp ( mac , vlan0_mac , ETHER_ADDR_LEN ) == 0 ) { table_end = read_mac_entry ( ec , mac , 0 ) ; continue ; } temp = ( struct mac_list * ) malloc ( sizeof ( struct mac_list ) , M_DEVBUF , M_NOWAIT | M_ZERO ) ; memcpy ( temp -> mac_addr , mac , ETHER_ADDR_LEN ) ; temp -> next = 0 ; if ( mac_list_header ) { current -> next = temp ; current = temp ; } else { mac_list_header = temp ; current = temp ; } table_end = read_mac_entry ( ec , mac , 0 ) ; } current = mac_list_header ; while ( current ) { remove_mac_entry ( ec , current -> mac_addr ) ; temp = current ; current = current -> next ; free ( temp , M_DEVBUF ) ; } }
The behavior of ARL table reading and deletion is not well defined
 in the documentation.
The behavior of ARL table reading and deletion is not well defined in the documentation .
/* Read next entry. */ /* Read next Entry */