/** Reinitialize the structure. * * @param filters */ int nic_rxc_clear(nic_rxc_t *rxc) { nic_addr_db_destroy(&rxc->unicast_addrs); nic_addr_db_destroy(&rxc->multicast_addrs); nic_addr_db_destroy(&rxc->blocked_sources); return nic_rxc_init(rxc); }
/** Allocate and initialize the driver data. * * @return Allocated structure or NULL. * */ static nic_t *nic_create(ddf_dev_t *dev) { nic_t *nic_data = ddf_dev_data_alloc(dev, sizeof(nic_t)); if (nic_data == NULL) return NULL; /* Force zero to all uninitialized fields (e.g. added in future) */ if (nic_rxc_init(&nic_data->rx_control) != EOK) { return NULL; } if (nic_wol_virtues_init(&nic_data->wol_virtues) != EOK) { return NULL; } nic_data->dev = NULL; nic_data->fun = NULL; nic_data->state = NIC_STATE_STOPPED; nic_data->client_session = NULL; nic_data->irc_session = NULL; nic_data->poll_mode = NIC_POLL_IMMEDIATE; nic_data->default_poll_mode = NIC_POLL_IMMEDIATE; nic_data->send_frame = NULL; nic_data->on_activating = NULL; nic_data->on_going_down = NULL; nic_data->on_stopping = NULL; nic_data->specific = NULL; fibril_rwlock_initialize(&nic_data->main_lock); fibril_rwlock_initialize(&nic_data->stats_lock); fibril_rwlock_initialize(&nic_data->rxc_lock); fibril_rwlock_initialize(&nic_data->wv_lock); bzero(&nic_data->mac, sizeof(nic_address_t)); bzero(&nic_data->default_mac, sizeof(nic_address_t)); bzero(&nic_data->stats, sizeof(nic_device_stats_t)); return nic_data; }