Changes in uspace/lib/nic/src/nic_impl.c [cde999a:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nic/src/nic_impl.c
rcde999a rb7fd2a0 52 52 * @return EOK always. 53 53 */ 54 int nic_get_state_impl(ddf_fun_t *fun, nic_device_state_t *state)54 errno_t nic_get_state_impl(ddf_fun_t *fun, nic_device_state_t *state) 55 55 { 56 56 nic_t *nic_data = nic_get_from_ddf_fun(fun); … … 72 72 * @return EINVAL If the state cannot be changed 73 73 */ 74 int nic_set_state_impl(ddf_fun_t *fun, nic_device_state_t state)74 errno_t nic_set_state_impl(ddf_fun_t *fun, nic_device_state_t state) 75 75 { 76 76 if (state >= NIC_STATE_MAX) { … … 108 108 } 109 109 if (event_handler != NULL) { 110 int rc = event_handler(nic_data);110 errno_t rc = event_handler(nic_data); 111 111 if (rc != EOK) { 112 112 fibril_rwlock_write_unlock(&nic_data->main_lock); … … 117 117 if (state == NIC_STATE_STOPPED) { 118 118 /* Notify upper layers that we are reseting the MAC */ 119 int rc = nic_ev_addr_changed(nic_data->client_session,119 errno_t rc = nic_ev_addr_changed(nic_data->client_session, 120 120 &nic_data->default_mac); 121 121 nic_data->poll_mode = nic_data->default_poll_mode; … … 168 168 * @return EBUSY If the device is not in state when the frame can be sent. 169 169 */ 170 int nic_send_frame_impl(ddf_fun_t *fun, void *data, size_t size)170 errno_t nic_send_frame_impl(ddf_fun_t *fun, void *data, size_t size) 171 171 { 172 172 nic_t *nic_data = nic_get_from_ddf_fun(fun); … … 191 191 * @return EOK On success, or an error code. 192 192 */ 193 int nic_callback_create_impl(ddf_fun_t *fun)193 errno_t nic_callback_create_impl(ddf_fun_t *fun) 194 194 { 195 195 nic_t *nic = nic_get_from_ddf_fun(fun); … … 216 216 * @return ELIMIT If the buffer is too short 217 217 */ 218 int nic_get_address_impl(ddf_fun_t *fun, nic_address_t *address)218 errno_t nic_get_address_impl(ddf_fun_t *fun, nic_address_t *address) 219 219 { 220 220 assert(address); … … 235 235 * @return EOK (cannot fail) 236 236 */ 237 int nic_get_stats_impl(ddf_fun_t *fun, nic_device_stats_t *stats)237 errno_t nic_get_stats_impl(ddf_fun_t *fun, nic_device_stats_t *stats) 238 238 { 239 239 nic_t *nic_data = nic_get_from_ddf_fun(fun); … … 257 257 * @return EOK 258 258 */ 259 int nic_unicast_get_mode_impl(ddf_fun_t *fun, nic_unicast_mode_t *mode,259 errno_t nic_unicast_get_mode_impl(ddf_fun_t *fun, nic_unicast_mode_t *mode, 260 260 size_t max_count, nic_address_t *addr_list, size_t *addr_count) 261 261 { … … 281 281 * @return ENOMEM 282 282 */ 283 int nic_unicast_set_mode_impl(ddf_fun_t *fun,283 errno_t nic_unicast_set_mode_impl(ddf_fun_t *fun, 284 284 nic_unicast_mode_t mode, const nic_address_t *addr_list, size_t addr_count) 285 285 { … … 294 294 nic_t *nic_data = nic_get_from_ddf_fun(fun); 295 295 fibril_rwlock_write_lock(&nic_data->rxc_lock); 296 int rc = ENOTSUP;296 errno_t rc = ENOTSUP; 297 297 if (nic_data->on_unicast_mode_change) { 298 298 rc = nic_data->on_unicast_mode_change(nic_data, … … 324 324 * @return EOK 325 325 */ 326 int nic_multicast_get_mode_impl(ddf_fun_t *fun, nic_multicast_mode_t *mode,326 errno_t nic_multicast_get_mode_impl(ddf_fun_t *fun, nic_multicast_mode_t *mode, 327 327 size_t max_count, nic_address_t *addr_list, size_t *addr_count) 328 328 { … … 348 348 * @return ENOMEM 349 349 */ 350 int nic_multicast_set_mode_impl(ddf_fun_t *fun, nic_multicast_mode_t mode,350 errno_t nic_multicast_set_mode_impl(ddf_fun_t *fun, nic_multicast_mode_t mode, 351 351 const nic_address_t *addr_list, size_t addr_count) 352 352 { … … 361 361 nic_t *nic_data = nic_get_from_ddf_fun(fun); 362 362 fibril_rwlock_write_lock(&nic_data->rxc_lock); 363 int rc = ENOTSUP;363 errno_t rc = ENOTSUP; 364 364 if (nic_data->on_multicast_mode_change) { 365 365 rc = nic_data->on_multicast_mode_change(nic_data, mode, addr_list, addr_count); … … 381 381 * @return EOK 382 382 */ 383 int nic_broadcast_get_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t *mode)383 errno_t nic_broadcast_get_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t *mode) 384 384 { 385 385 nic_t *nic_data = nic_get_from_ddf_fun(fun); … … 401 401 * @return ENOMEM 402 402 */ 403 int nic_broadcast_set_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t mode)403 errno_t nic_broadcast_set_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t mode) 404 404 { 405 405 nic_t *nic_data = nic_get_from_ddf_fun(fun); 406 406 fibril_rwlock_write_lock(&nic_data->rxc_lock); 407 int rc = ENOTSUP;407 errno_t rc = ENOTSUP; 408 408 if (nic_data->on_broadcast_mode_change) { 409 409 rc = nic_data->on_broadcast_mode_change(nic_data, mode); … … 427 427 * @return EOK 428 428 */ 429 int nic_blocked_sources_get_impl(ddf_fun_t *fun,429 errno_t nic_blocked_sources_get_impl(ddf_fun_t *fun, 430 430 size_t max_count, nic_address_t *addr_list, size_t *addr_count) 431 431 { … … 450 450 * @return ENOMEM 451 451 */ 452 int nic_blocked_sources_set_impl(ddf_fun_t *fun,452 errno_t nic_blocked_sources_set_impl(ddf_fun_t *fun, 453 453 const nic_address_t *addr_list, size_t addr_count) 454 454 { … … 458 458 nic_data->on_blocked_sources_change(nic_data, addr_list, addr_count); 459 459 } 460 int rc = nic_rxc_blocked_sources_set(&nic_data->rx_control,460 errno_t rc = nic_rxc_blocked_sources_set(&nic_data->rx_control, 461 461 addr_list, addr_count); 462 462 fibril_rwlock_write_unlock(&nic_data->rxc_lock); … … 473 473 * @return ENOENT If the mask is not set 474 474 */ 475 int nic_vlan_get_mask_impl(ddf_fun_t *fun, nic_vlan_mask_t *mask)475 errno_t nic_vlan_get_mask_impl(ddf_fun_t *fun, nic_vlan_mask_t *mask) 476 476 { 477 477 nic_t *nic_data = nic_get_from_ddf_fun(fun); 478 478 fibril_rwlock_read_lock(&nic_data->rxc_lock); 479 int rc = nic_rxc_vlan_get_mask(&nic_data->rx_control, mask);479 errno_t rc = nic_rxc_vlan_get_mask(&nic_data->rx_control, mask); 480 480 fibril_rwlock_read_unlock(&nic_data->rxc_lock); 481 481 return rc; … … 491 491 * @return ENOMEM 492 492 */ 493 int nic_vlan_set_mask_impl(ddf_fun_t *fun, const nic_vlan_mask_t *mask)493 errno_t nic_vlan_set_mask_impl(ddf_fun_t *fun, const nic_vlan_mask_t *mask) 494 494 { 495 495 nic_t *nic_data = nic_get_from_ddf_fun(fun); 496 496 fibril_rwlock_write_lock(&nic_data->rxc_lock); 497 int rc = nic_rxc_vlan_set_mask(&nic_data->rx_control, mask);497 errno_t rc = nic_rxc_vlan_set_mask(&nic_data->rx_control, mask); 498 498 if (rc == EOK && nic_data->on_vlan_mask_change) { 499 499 nic_data->on_vlan_mask_change(nic_data, mask); … … 518 518 * @return ENOMEM If there was not enough memory to complete the operation 519 519 */ 520 int nic_wol_virtue_add_impl(ddf_fun_t *fun, nic_wv_type_t type,520 errno_t nic_wol_virtue_add_impl(ddf_fun_t *fun, nic_wv_type_t type, 521 521 const void *data, size_t length, nic_wv_id_t *new_id) 522 522 { … … 560 560 } 561 561 /* Call the user-defined add callback */ 562 int rc = nic_data->on_wol_virtue_add(nic_data, virtue);562 errno_t rc = nic_data->on_wol_virtue_add(nic_data, virtue); 563 563 if (rc != EOK) { 564 564 free(virtue->data); … … 593 593 * @return ENOENT If the virtue identifier is not valid. 594 594 */ 595 int nic_wol_virtue_remove_impl(ddf_fun_t *fun, nic_wv_id_t id)595 errno_t nic_wol_virtue_remove_impl(ddf_fun_t *fun, nic_wv_id_t id) 596 596 { 597 597 nic_t *nic_data = nic_get_from_ddf_fun(fun); … … 629 629 * @return ENOMEM If there was not enough memory to complete the operation 630 630 */ 631 int nic_wol_virtue_probe_impl(ddf_fun_t *fun, nic_wv_id_t id,631 errno_t nic_wol_virtue_probe_impl(ddf_fun_t *fun, nic_wv_id_t id, 632 632 nic_wv_type_t *type, size_t max_length, void *data, size_t *length) 633 633 { … … 667 667 * @return ENOMEM If there was not enough memory to complete the operation 668 668 */ 669 int nic_wol_virtue_list_impl(ddf_fun_t *fun, nic_wv_type_t type,669 errno_t nic_wol_virtue_list_impl(ddf_fun_t *fun, nic_wv_type_t type, 670 670 size_t max_count, nic_wv_id_t *id_list, size_t *id_count) 671 671 { 672 672 nic_t *nic_data = nic_get_from_ddf_fun(fun); 673 673 fibril_rwlock_read_lock(&nic_data->wv_lock); 674 int rc = nic_wol_virtues_list(&nic_data->wol_virtues, type,674 errno_t rc = nic_wol_virtues_list(&nic_data->wol_virtues, type, 675 675 max_count, id_list, id_count); 676 676 fibril_rwlock_read_unlock(&nic_data->wv_lock); … … 688 688 * @return EOK If the operation was successfully completed 689 689 */ 690 int nic_wol_virtue_get_caps_impl(ddf_fun_t *fun, nic_wv_type_t type, int *count)690 errno_t nic_wol_virtue_get_caps_impl(ddf_fun_t *fun, nic_wv_type_t type, int *count) 691 691 { 692 692 nic_t *nic_data = nic_get_from_ddf_fun(fun); … … 710 710 * @return EPARTY Error in communication protocol 711 711 */ 712 int nic_poll_get_mode_impl(ddf_fun_t *fun,712 errno_t nic_poll_get_mode_impl(ddf_fun_t *fun, 713 713 nic_poll_mode_t *mode, struct timeval *period) 714 714 { … … 733 733 * @return EPARTY Error in communication protocol 734 734 */ 735 int nic_poll_set_mode_impl(ddf_fun_t *fun,735 errno_t nic_poll_set_mode_impl(ddf_fun_t *fun, 736 736 nic_poll_mode_t mode, const struct timeval *period) 737 737 { … … 754 754 } 755 755 fibril_rwlock_write_lock(&nic_data->main_lock); 756 int rc = nic_data->on_poll_mode_change(nic_data, mode, period);756 errno_t rc = nic_data->on_poll_mode_change(nic_data, mode, period); 757 757 assert(rc == EOK || rc == ENOTSUP || rc == EINVAL); 758 758 if (rc == ENOTSUP && (nic_data->on_poll_request != NULL) && … … 783 783 * @return EINVAL If the NIC is not in state where it allows on demand polling 784 784 */ 785 int nic_poll_now_impl(ddf_fun_t *fun) {785 errno_t nic_poll_now_impl(ddf_fun_t *fun) { 786 786 nic_t *nic_data = nic_get_from_ddf_fun(fun); 787 787 fibril_rwlock_read_lock(&nic_data->main_lock); … … 821 821 * @return EOK always. 822 822 */ 823 int nic_open_impl(ddf_fun_t *fun)823 errno_t nic_open_impl(ddf_fun_t *fun) 824 824 { 825 825 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.