Changes in uspace/lib/nic/src/nic_impl.c [acdb5bac:9cd8165] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nic/src/nic_impl.c
racdb5bac r9cd8165 54 54 int nic_get_state_impl(ddf_fun_t *fun, nic_device_state_t *state) 55 55 { 56 nic_t *nic_data = nic_get_from_ddf_fun(fun);56 nic_t *nic_data = (nic_t *) fun->driver_data; 57 57 fibril_rwlock_read_lock(&nic_data->main_lock); 58 58 *state = nic_data->state; … … 78 78 } 79 79 80 nic_t *nic_data = nic_get_from_ddf_fun(fun);80 nic_t *nic_data = (nic_t *) fun->driver_data; 81 81 82 82 fibril_rwlock_write_lock(&nic_data->main_lock); … … 129 129 130 130 fibril_rwlock_write_lock(&nic_data->stats_lock); 131 memset(&nic_data->stats, 0, sizeof(nic_device_stats_t));131 bzero(&nic_data->stats, sizeof (nic_device_stats_t)); 132 132 fibril_rwlock_write_unlock(&nic_data->stats_lock); 133 133 … … 170 170 int nic_send_frame_impl(ddf_fun_t *fun, void *data, size_t size) 171 171 { 172 nic_t *nic_data = nic_get_from_ddf_fun(fun);172 nic_t *nic_data = (nic_t *) fun->driver_data; 173 173 174 174 fibril_rwlock_read_lock(&nic_data->main_lock); … … 192 192 int nic_callback_create_impl(ddf_fun_t *fun) 193 193 { 194 nic_t *nic = nic_get_from_ddf_fun(fun);194 nic_t *nic = (nic_t *) fun->driver_data; 195 195 fibril_rwlock_write_lock(&nic->main_lock); 196 196 … … 218 218 { 219 219 assert(address); 220 nic_t *nic_data = nic_get_from_ddf_fun(fun);220 nic_t *nic_data = (nic_t *) fun->driver_data; 221 221 fibril_rwlock_read_lock(&nic_data->main_lock); 222 222 memcpy(address, &nic_data->mac, sizeof (nic_address_t)); … … 236 236 int nic_get_stats_impl(ddf_fun_t *fun, nic_device_stats_t *stats) 237 237 { 238 nic_t *nic_data = nic_get_from_ddf_fun(fun);238 nic_t *nic_data = (nic_t *) fun->driver_data; 239 239 assert (stats != NULL); 240 240 fibril_rwlock_read_lock(&nic_data->stats_lock); … … 259 259 size_t max_count, nic_address_t *addr_list, size_t *addr_count) 260 260 { 261 nic_t *nic_data = nic_get_from_ddf_fun(fun);261 nic_t *nic_data = (nic_t *) fun->driver_data; 262 262 fibril_rwlock_read_lock(&nic_data->rxc_lock); 263 263 nic_rxc_unicast_get_mode(&nic_data->rx_control, mode, max_count, … … 291 291 } 292 292 293 nic_t *nic_data = nic_get_from_ddf_fun(fun);293 nic_t *nic_data = (nic_t *) fun->driver_data; 294 294 fibril_rwlock_write_lock(&nic_data->rxc_lock); 295 295 int rc = ENOTSUP; … … 326 326 size_t max_count, nic_address_t *addr_list, size_t *addr_count) 327 327 { 328 nic_t *nic_data = nic_get_from_ddf_fun(fun);328 nic_t *nic_data = (nic_t *) fun->driver_data; 329 329 fibril_rwlock_read_lock(&nic_data->rxc_lock); 330 330 nic_rxc_multicast_get_mode(&nic_data->rx_control, mode, max_count, … … 358 358 } 359 359 360 nic_t *nic_data = nic_get_from_ddf_fun(fun);360 nic_t *nic_data = (nic_t *) fun->dev->driver_data; 361 361 fibril_rwlock_write_lock(&nic_data->rxc_lock); 362 362 int rc = ENOTSUP; … … 382 382 int nic_broadcast_get_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t *mode) 383 383 { 384 nic_t *nic_data = nic_get_from_ddf_fun(fun);384 nic_t *nic_data = (nic_t *) fun->driver_data; 385 385 fibril_rwlock_read_lock(&nic_data->rxc_lock); 386 386 nic_rxc_broadcast_get_mode(&nic_data->rx_control, mode); … … 402 402 int nic_broadcast_set_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t mode) 403 403 { 404 nic_t *nic_data = nic_get_from_ddf_fun(fun);404 nic_t *nic_data = (nic_t *) fun->driver_data; 405 405 fibril_rwlock_write_lock(&nic_data->rxc_lock); 406 406 int rc = ENOTSUP; … … 429 429 size_t max_count, nic_address_t *addr_list, size_t *addr_count) 430 430 { 431 nic_t *nic_data = nic_get_from_ddf_fun(fun);431 nic_t *nic_data = (nic_t *) fun->driver_data; 432 432 fibril_rwlock_read_lock(&nic_data->rxc_lock); 433 433 nic_rxc_blocked_sources_get(&nic_data->rx_control, … … 452 452 const nic_address_t *addr_list, size_t addr_count) 453 453 { 454 nic_t *nic_data = nic_get_from_ddf_fun(fun);454 nic_t *nic_data = (nic_t *) fun->driver_data; 455 455 fibril_rwlock_write_lock(&nic_data->rxc_lock); 456 456 if (nic_data->on_blocked_sources_change) { … … 474 474 int nic_vlan_get_mask_impl(ddf_fun_t *fun, nic_vlan_mask_t *mask) 475 475 { 476 nic_t *nic_data = nic_get_from_ddf_fun(fun);476 nic_t *nic_data = (nic_t *) fun->driver_data; 477 477 fibril_rwlock_read_lock(&nic_data->rxc_lock); 478 478 int rc = nic_rxc_vlan_get_mask(&nic_data->rx_control, mask); … … 492 492 int nic_vlan_set_mask_impl(ddf_fun_t *fun, const nic_vlan_mask_t *mask) 493 493 { 494 nic_t *nic_data = nic_get_from_ddf_fun(fun);494 nic_t *nic_data = (nic_t *) fun->driver_data; 495 495 fibril_rwlock_write_lock(&nic_data->rxc_lock); 496 496 int rc = nic_rxc_vlan_set_mask(&nic_data->rx_control, mask); … … 520 520 const void *data, size_t length, nic_wv_id_t *new_id) 521 521 { 522 nic_t *nic_data = nic_get_from_ddf_fun(fun);522 nic_t *nic_data = (nic_t *) fun->driver_data; 523 523 if (nic_data->on_wol_virtue_add == NULL 524 524 || nic_data->on_wol_virtue_remove == NULL) { … … 535 535 return ENOMEM; 536 536 } 537 memset(virtue, 0, sizeof(nic_wol_virtue_t));537 bzero(virtue, sizeof (nic_wol_virtue_t)); 538 538 if (length != 0) { 539 539 virtue->data = malloc(length); … … 594 594 int nic_wol_virtue_remove_impl(ddf_fun_t *fun, nic_wv_id_t id) 595 595 { 596 nic_t *nic_data = nic_get_from_ddf_fun(fun);596 nic_t *nic_data = (nic_t *) fun->driver_data; 597 597 if (nic_data->on_wol_virtue_add == NULL 598 598 || nic_data->on_wol_virtue_remove == NULL) { … … 631 631 nic_wv_type_t *type, size_t max_length, void *data, size_t *length) 632 632 { 633 nic_t *nic_data = nic_get_from_ddf_fun(fun);633 nic_t *nic_data = (nic_t *) fun->driver_data; 634 634 fibril_rwlock_read_lock(&nic_data->wv_lock); 635 635 const nic_wol_virtue_t *virtue = … … 669 669 size_t max_count, nic_wv_id_t *id_list, size_t *id_count) 670 670 { 671 nic_t *nic_data = nic_get_from_ddf_fun(fun);671 nic_t *nic_data = (nic_t *) fun->driver_data; 672 672 fibril_rwlock_read_lock(&nic_data->wv_lock); 673 673 int rc = nic_wol_virtues_list(&nic_data->wol_virtues, type, … … 689 689 int nic_wol_virtue_get_caps_impl(ddf_fun_t *fun, nic_wv_type_t type, int *count) 690 690 { 691 nic_t *nic_data = nic_get_from_ddf_fun(fun);691 nic_t *nic_data = (nic_t *) fun->driver_data; 692 692 fibril_rwlock_read_lock(&nic_data->wv_lock); 693 693 *count = nic_data->wol_virtues.caps_max[type] … … 712 712 nic_poll_mode_t *mode, struct timeval *period) 713 713 { 714 nic_t *nic_data = nic_get_from_ddf_fun(fun);714 nic_t *nic_data = (nic_t *) fun->driver_data; 715 715 fibril_rwlock_read_lock(&nic_data->main_lock); 716 716 *mode = nic_data->poll_mode; … … 735 735 nic_poll_mode_t mode, const struct timeval *period) 736 736 { 737 nic_t *nic_data = nic_get_from_ddf_fun(fun);737 nic_t *nic_data = (nic_t *) fun->driver_data; 738 738 /* If the driver does not implement the poll mode change handler it cannot 739 739 * switch off interrupts and this is not supported. */ … … 783 783 */ 784 784 int nic_poll_now_impl(ddf_fun_t *fun) { 785 nic_t *nic_data = nic_get_from_ddf_fun(fun);785 nic_t *nic_data = (nic_t *) fun->driver_data; 786 786 fibril_rwlock_read_lock(&nic_data->main_lock); 787 787 if (nic_data->poll_mode != NIC_POLL_ON_DEMAND) {
Note:
See TracChangeset
for help on using the changeset viewer.