Changeset 8565a42 in mainline for uspace/lib/drv/generic/remote_nic.c
- Timestamp:
- 2018-03-02T20:34:50Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a1a81f69, d5e5fd1
- Parents:
- 3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
- git-committer:
- GitHub <noreply@…> (2018-03-02 20:34:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_nic.c
r3061bc1 r8565a42 101 101 { 102 102 async_exch_t *exch = async_exchange_begin(dev_sess); 103 103 104 104 ipc_call_t answer; 105 105 aid_t req = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 106 106 NIC_SEND_MESSAGE, &answer); 107 107 errno_t retval = async_data_write_start(exch, data, size); 108 109 async_exchange_end(exch); 110 108 109 async_exchange_end(exch); 110 111 111 if (retval != EOK) { 112 112 async_forget(req); … … 132 132 errno_t rc; 133 133 errno_t retval; 134 134 135 135 async_exch_t *exch = async_exchange_begin(dev_sess); 136 136 aid_t req = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 137 137 NIC_CALLBACK_CREATE, &answer); 138 138 139 139 port_id_t port; 140 140 rc = async_create_callback_port(exch, INTERFACE_NIC_CB, 0, 0, … … 145 145 } 146 146 async_exchange_end(exch); 147 147 148 148 async_wait_for(req, &retval); 149 149 return retval; … … 161 161 { 162 162 assert(state); 163 163 164 164 sysarg_t _state; 165 165 166 166 async_exch_t *exch = async_exchange_begin(dev_sess); 167 167 errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 168 168 NIC_GET_STATE, &_state); 169 169 async_exchange_end(exch); 170 170 171 171 *state = (nic_device_state_t) _state; 172 172 173 173 return rc; 174 174 } … … 188 188 NIC_SET_STATE, state); 189 189 async_exchange_end(exch); 190 190 191 191 return rc; 192 192 } … … 203 203 { 204 204 assert(address); 205 205 206 206 async_exch_t *exch = async_exchange_begin(dev_sess); 207 207 aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), … … 209 209 errno_t rc = async_data_read_start(exch, address, sizeof(nic_address_t)); 210 210 async_exchange_end(exch); 211 211 212 212 errno_t res; 213 213 async_wait_for(aid, &res); 214 214 215 215 if (rc != EOK) 216 216 return rc; 217 217 218 218 return res; 219 219 } … … 230 230 { 231 231 assert(address); 232 232 233 233 async_exch_t *exch = async_exchange_begin(dev_sess); 234 234 aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), … … 236 236 errno_t rc = async_data_write_start(exch, address, sizeof(nic_address_t)); 237 237 async_exchange_end(exch); 238 238 239 239 errno_t res; 240 240 async_wait_for(aid, &res); 241 241 242 242 if (rc != EOK) 243 243 return rc; 244 244 245 245 return res; 246 246 } … … 257 257 { 258 258 assert(stats); 259 260 async_exch_t *exch = async_exchange_begin(dev_sess); 261 259 260 async_exch_t *exch = async_exchange_begin(dev_sess); 261 262 262 errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 263 263 NIC_GET_STATS); … … 266 266 return rc; 267 267 } 268 268 269 269 rc = async_data_read_start(exch, stats, sizeof(nic_device_stats_t)); 270 271 async_exchange_end(exch); 272 270 271 async_exchange_end(exch); 272 273 273 return rc; 274 274 } … … 287 287 { 288 288 assert(device_info); 289 290 async_exch_t *exch = async_exchange_begin(dev_sess); 291 289 290 async_exch_t *exch = async_exchange_begin(dev_sess); 291 292 292 aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 293 293 NIC_GET_DEVICE_INFO, NULL); … … 297 297 errno_t res; 298 298 async_wait_for(aid, &res); 299 299 300 300 if (rc != EOK) 301 301 return rc; 302 302 303 303 return res; 304 304 } … … 315 315 { 316 316 assert(cable_state); 317 317 318 318 sysarg_t _cable_state; 319 319 320 320 async_exch_t *exch = async_exchange_begin(dev_sess); 321 321 errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 322 322 NIC_GET_CABLE_STATE, &_cable_state); 323 323 async_exchange_end(exch); 324 324 325 325 *cable_state = (nic_cable_state_t) _cable_state; 326 326 327 327 return rc; 328 328 } … … 344 344 sysarg_t _duplex; 345 345 sysarg_t _role; 346 346 347 347 async_exch_t *exch = async_exchange_begin(dev_sess); 348 348 errno_t rc = async_req_1_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 349 349 NIC_GET_OPERATION_MODE, &_speed, &_duplex, &_role); 350 350 async_exchange_end(exch); 351 351 352 352 if (speed) 353 353 *speed = (int) _speed; 354 354 355 355 if (duplex) 356 356 *duplex = (nic_channel_mode_t) _duplex; 357 357 358 358 if (role) 359 359 *role = (nic_role_t) _role; 360 360 361 361 return rc; 362 362 } … … 383 383 (sysarg_t) role); 384 384 async_exchange_end(exch); 385 385 386 386 return rc; 387 387 } … … 406 406 NIC_AUTONEG_ENABLE, (sysarg_t) advertisement); 407 407 async_exchange_end(exch); 408 408 409 409 return rc; 410 410 } … … 423 423 NIC_AUTONEG_DISABLE); 424 424 async_exchange_end(exch); 425 425 426 426 return rc; 427 427 } … … 452 452 sysarg_t _result; 453 453 sysarg_t _their_result; 454 454 455 455 async_exch_t *exch = async_exchange_begin(dev_sess); 456 456 errno_t rc = async_req_1_4(exch, DEV_IFACE_ID(NIC_DEV_IFACE), … … 458 458 &_result, &_their_result); 459 459 async_exchange_end(exch); 460 460 461 461 if (our_advertisement) 462 462 *our_advertisement = (uint32_t) _our_advertisement; 463 463 464 464 if (*their_advertisement) 465 465 *their_advertisement = (uint32_t) _their_advertisement; 466 466 467 467 if (result) 468 468 *result = (nic_result_t) _result; 469 469 470 470 if (their_result) 471 471 *their_result = (nic_result_t) _their_result; 472 472 473 473 return rc; 474 474 } … … 487 487 NIC_AUTONEG_RESTART); 488 488 async_exchange_end(exch); 489 489 490 490 return rc; 491 491 } … … 507 507 sysarg_t _we_receive; 508 508 sysarg_t _pause; 509 509 510 510 async_exch_t *exch = async_exchange_begin(dev_sess); 511 511 errno_t rc = async_req_1_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 512 512 NIC_GET_PAUSE, &_we_send, &_we_receive, &_pause); 513 513 async_exchange_end(exch); 514 514 515 515 if (we_send) 516 516 *we_send = _we_send; 517 517 518 518 if (we_receive) 519 519 *we_receive = _we_receive; 520 520 521 521 if (pause) 522 522 *pause = _pause; 523 523 524 524 return rc; 525 525 } … … 546 546 NIC_SET_PAUSE, allow_send, allow_receive, pause); 547 547 async_exchange_end(exch); 548 548 549 549 return rc; 550 550 } … … 570 570 { 571 571 assert(mode); 572 572 573 573 sysarg_t _mode; 574 574 sysarg_t _address_count; 575 575 576 576 if (!address_list) 577 577 max_count = 0; 578 579 async_exch_t *exch = async_exchange_begin(dev_sess); 580 578 579 async_exch_t *exch = async_exchange_begin(dev_sess); 580 581 581 errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 582 582 NIC_UNICAST_GET_MODE, max_count, &_mode, &_address_count); … … 585 585 return rc; 586 586 } 587 587 588 588 *mode = (nic_unicast_mode_t) _mode; 589 589 if (address_count) 590 590 *address_count = (size_t) _address_count; 591 591 592 592 if ((max_count) && (_address_count)) 593 593 rc = async_data_read_start(exch, address_list, 594 594 max_count * sizeof(nic_address_t)); 595 596 async_exchange_end(exch); 597 595 596 async_exchange_end(exch); 597 598 598 return rc; 599 599 } … … 614 614 if (address_list == NULL) 615 615 address_count = 0; 616 617 async_exch_t *exch = async_exchange_begin(dev_sess); 618 616 617 async_exch_t *exch = async_exchange_begin(dev_sess); 618 619 619 aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 620 620 NIC_UNICAST_SET_MODE, (sysarg_t) mode, address_count, NULL); 621 621 622 622 errno_t rc; 623 623 if (address_count) … … 626 626 else 627 627 rc = EOK; 628 629 async_exchange_end(exch); 630 628 629 async_exchange_end(exch); 630 631 631 errno_t res; 632 632 async_wait_for(message_id, &res); 633 633 634 634 if (rc != EOK) 635 635 return rc; 636 636 637 637 return res; 638 638 } … … 659 659 { 660 660 assert(mode); 661 661 662 662 sysarg_t _mode; 663 663 664 664 if (!address_list) 665 665 max_count = 0; 666 667 async_exch_t *exch = async_exchange_begin(dev_sess); 668 666 667 async_exch_t *exch = async_exchange_begin(dev_sess); 668 669 669 sysarg_t ac; 670 670 errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE), … … 674 674 return rc; 675 675 } 676 676 677 677 *mode = (nic_multicast_mode_t) _mode; 678 678 if (address_count) 679 679 *address_count = (size_t) ac; 680 680 681 681 if ((max_count) && (ac)) 682 682 rc = async_data_read_start(exch, address_list, 683 683 max_count * sizeof(nic_address_t)); 684 684 685 685 async_exchange_end(exch); 686 686 return rc; … … 702 702 if (address_list == NULL) 703 703 address_count = 0; 704 705 async_exch_t *exch = async_exchange_begin(dev_sess); 706 704 705 async_exch_t *exch = async_exchange_begin(dev_sess); 706 707 707 aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 708 708 NIC_MULTICAST_SET_MODE, (sysarg_t) mode, address_count, NULL); 709 709 710 710 errno_t rc; 711 711 if (address_count) … … 714 714 else 715 715 rc = EOK; 716 717 async_exchange_end(exch); 718 716 717 async_exchange_end(exch); 718 719 719 errno_t res; 720 720 async_wait_for(message_id, &res); 721 721 722 722 if (rc != EOK) 723 723 return rc; 724 724 725 725 return res; 726 726 } … … 737 737 { 738 738 assert(mode); 739 739 740 740 sysarg_t _mode; 741 741 742 742 async_exch_t *exch = async_exchange_begin(dev_sess); 743 743 errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 744 744 NIC_BROADCAST_GET_MODE, &_mode); 745 745 async_exchange_end(exch); 746 746 747 747 *mode = (nic_broadcast_mode_t) _mode; 748 748 749 749 return rc; 750 750 } … … 764 764 NIC_BROADCAST_SET_MODE, mode); 765 765 async_exchange_end(exch); 766 766 767 767 return rc; 768 768 } … … 779 779 { 780 780 assert(mode); 781 781 782 782 sysarg_t _mode; 783 783 784 784 async_exch_t *exch = async_exchange_begin(dev_sess); 785 785 errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 786 786 NIC_DEFECTIVE_GET_MODE, &_mode); 787 787 async_exchange_end(exch); 788 788 789 789 *mode = (uint32_t) _mode; 790 790 791 791 return rc; 792 792 } … … 806 806 NIC_DEFECTIVE_SET_MODE, mode); 807 807 async_exchange_end(exch); 808 808 809 809 return rc; 810 810 } … … 827 827 if (!address_list) 828 828 max_count = 0; 829 830 async_exch_t *exch = async_exchange_begin(dev_sess); 831 829 830 async_exch_t *exch = async_exchange_begin(dev_sess); 831 832 832 sysarg_t ac; 833 833 errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), … … 837 837 return rc; 838 838 } 839 839 840 840 if (address_count) 841 841 *address_count = (size_t) ac; 842 842 843 843 if ((max_count) && (ac)) 844 844 rc = async_data_read_start(exch, address_list, 845 845 max_count * sizeof(nic_address_t)); 846 846 847 847 async_exchange_end(exch); 848 848 return rc; … … 863 863 if (address_list == NULL) 864 864 address_count = 0; 865 866 async_exch_t *exch = async_exchange_begin(dev_sess); 867 865 866 async_exch_t *exch = async_exchange_begin(dev_sess); 867 868 868 aid_t message_id = async_send_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 869 869 NIC_BLOCKED_SOURCES_SET, address_count, NULL); 870 870 871 871 errno_t rc; 872 872 if (address_count) … … 875 875 else 876 876 rc = EOK; 877 878 async_exchange_end(exch); 879 877 878 async_exchange_end(exch); 879 880 880 errno_t res; 881 881 async_wait_for(message_id, &res); 882 882 883 883 if (rc != EOK) 884 884 return rc; 885 885 886 886 return res; 887 887 } … … 898 898 { 899 899 assert(mask); 900 900 901 901 async_exch_t *exch = async_exchange_begin(dev_sess); 902 902 errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), … … 906 906 return rc; 907 907 } 908 908 909 909 rc = async_data_read_start(exch, mask, sizeof(nic_vlan_mask_t)); 910 910 async_exchange_end(exch); 911 911 912 912 return rc; 913 913 } … … 926 926 { 927 927 async_exch_t *exch = async_exchange_begin(dev_sess); 928 928 929 929 aid_t message_id = async_send_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 930 930 NIC_VLAN_SET_MASK, mask != NULL, NULL); 931 931 932 932 errno_t rc; 933 933 if (mask != NULL) … … 935 935 else 936 936 rc = EOK; 937 938 async_exchange_end(exch); 939 937 938 async_exchange_end(exch); 939 940 940 errno_t res; 941 941 async_wait_for(message_id, &res); 942 942 943 943 if (rc != EOK) 944 944 return rc; 945 945 946 946 return res; 947 947 } … … 969 969 NIC_VLAN_SET_TAG, (sysarg_t) tag, (sysarg_t) add, (sysarg_t) strip); 970 970 async_exchange_end(exch); 971 971 972 972 return rc; 973 973 } … … 989 989 { 990 990 assert(id); 991 991 992 992 bool send_data = ((data != NULL) && (length != 0)); 993 993 async_exch_t *exch = async_exchange_begin(dev_sess); 994 994 995 995 ipc_call_t result; 996 996 aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 997 997 NIC_WOL_VIRTUE_ADD, (sysarg_t) type, send_data, &result); 998 998 999 999 errno_t res; 1000 1000 if (send_data) { … … 1006 1006 } 1007 1007 } 1008 1008 1009 1009 async_exchange_end(exch); 1010 1010 async_wait_for(message_id, &res); 1011 1011 1012 1012 *id = IPC_GET_ARG1(result); 1013 1013 return res; … … 1028 1028 NIC_WOL_VIRTUE_REMOVE, (sysarg_t) id); 1029 1029 async_exchange_end(exch); 1030 1030 1031 1031 return rc; 1032 1032 } … … 1050 1050 sysarg_t _type; 1051 1051 sysarg_t _length; 1052 1052 1053 1053 if (data == NULL) 1054 1054 max_length = 0; 1055 1056 async_exch_t *exch = async_exchange_begin(dev_sess); 1057 1055 1056 async_exch_t *exch = async_exchange_begin(dev_sess); 1057 1058 1058 errno_t rc = async_req_3_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 1059 1059 NIC_WOL_VIRTUE_PROBE, (sysarg_t) id, max_length, … … 1063 1063 return rc; 1064 1064 } 1065 1065 1066 1066 if (type) 1067 1067 *type = _type; 1068 1068 1069 1069 if (length) 1070 1070 *length = _length; 1071 1071 1072 1072 if ((max_length) && (_length != 0)) 1073 1073 rc = async_data_read_start(exch, data, max_length); 1074 1074 1075 1075 async_exchange_end(exch); 1076 1076 return rc; … … 1100 1100 if (id_list == NULL) 1101 1101 max_count = 0; 1102 1103 async_exch_t *exch = async_exchange_begin(dev_sess); 1104 1102 1103 async_exch_t *exch = async_exchange_begin(dev_sess); 1104 1105 1105 sysarg_t count; 1106 1106 errno_t rc = async_req_3_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 1107 1107 NIC_WOL_VIRTUE_LIST, (sysarg_t) type, max_count, &count); 1108 1108 1109 1109 if (id_count) 1110 1110 *id_count = (size_t) count; 1111 1111 1112 1112 if ((rc != EOK) || (!max_count)) { 1113 1113 async_exchange_end(exch); 1114 1114 return rc; 1115 1115 } 1116 1116 1117 1117 rc = async_data_read_start(exch, id_list, 1118 1118 max_count * sizeof(nic_wv_id_t)); 1119 1119 1120 1120 async_exchange_end(exch); 1121 1121 return rc; … … 1139 1139 { 1140 1140 assert(count); 1141 1141 1142 1142 sysarg_t _count; 1143 1143 1144 1144 async_exch_t *exch = async_exchange_begin(dev_sess); 1145 1145 errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 1146 1146 NIC_WOL_VIRTUE_GET_CAPS, (sysarg_t) type, &_count); 1147 1147 async_exchange_end(exch); 1148 1148 1149 1149 *count = (int) _count; 1150 1150 return rc; … … 1177 1177 { 1178 1178 assert(matched_type); 1179 1179 1180 1180 sysarg_t _matched_type; 1181 1181 sysarg_t _frame_length; 1182 1182 1183 1183 if (frame == NULL) 1184 1184 max_length = 0; 1185 1186 async_exch_t *exch = async_exchange_begin(dev_sess); 1187 1185 1186 async_exch_t *exch = async_exchange_begin(dev_sess); 1187 1188 1188 errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 1189 1189 NIC_WOL_LOAD_INFO, max_length, &_matched_type, &_frame_length); … … 1192 1192 return rc; 1193 1193 } 1194 1194 1195 1195 *matched_type = (nic_wv_type_t) _matched_type; 1196 1196 if (frame_length) 1197 1197 *frame_length = (size_t) _frame_length; 1198 1198 1199 1199 if ((max_length != 0) && (_frame_length != 0)) 1200 1200 rc = async_data_read_start(exch, frame, max_length); 1201 1201 1202 1202 async_exchange_end(exch); 1203 1203 return rc; … … 1218 1218 assert(supported); 1219 1219 assert(active); 1220 1220 1221 1221 sysarg_t _supported; 1222 1222 sysarg_t _active; 1223 1223 1224 1224 async_exch_t *exch = async_exchange_begin(dev_sess); 1225 1225 errno_t rc = async_req_1_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 1226 1226 NIC_OFFLOAD_PROBE, &_supported, &_active); 1227 1227 async_exchange_end(exch); 1228 1228 1229 1229 *supported = (uint32_t) _supported; 1230 1230 *active = (uint32_t) _active; … … 1247 1247 NIC_AUTONEG_RESTART, (sysarg_t) mask, (sysarg_t) active); 1248 1248 async_exchange_end(exch); 1249 1249 1250 1250 return rc; 1251 1251 } … … 1265 1265 { 1266 1266 assert(mode); 1267 1267 1268 1268 sysarg_t _mode; 1269 1270 async_exch_t *exch = async_exchange_begin(dev_sess); 1271 1269 1270 async_exch_t *exch = async_exchange_begin(dev_sess); 1271 1272 1272 errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 1273 1273 NIC_POLL_GET_MODE, period != NULL, &_mode); … … 1276 1276 return rc; 1277 1277 } 1278 1278 1279 1279 *mode = (nic_poll_mode_t) _mode; 1280 1280 1281 1281 if (period != NULL) 1282 1282 rc = async_data_read_start(exch, period, sizeof(struct timeval)); 1283 1283 1284 1284 async_exchange_end(exch); 1285 1285 return rc; … … 1299 1299 { 1300 1300 async_exch_t *exch = async_exchange_begin(dev_sess); 1301 1301 1302 1302 aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE), 1303 1303 NIC_POLL_SET_MODE, (sysarg_t) mode, period != NULL, NULL); 1304 1304 1305 1305 errno_t rc; 1306 1306 if (period) … … 1308 1308 else 1309 1309 rc = EOK; 1310 1311 async_exchange_end(exch); 1312 1310 1311 async_exchange_end(exch); 1312 1313 1313 errno_t res; 1314 1314 async_wait_for(message_id, &res); 1315 1315 1316 1316 if (rc != EOK) 1317 1317 return rc; 1318 1318 1319 1319 return res; 1320 1320 } … … 1332 1332 errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), NIC_POLL_NOW); 1333 1333 async_exchange_end(exch); 1334 1334 1335 1335 return rc; 1336 1336 } … … 1341 1341 nic_iface_t *nic_iface = (nic_iface_t *) iface; 1342 1342 assert(nic_iface->send_frame); 1343 1343 1344 1344 void *data; 1345 1345 size_t size; 1346 1346 errno_t rc; 1347 1347 1348 1348 rc = async_data_write_accept(&data, false, 0, 0, 0, &size); 1349 1349 if (rc != EOK) { … … 1351 1351 return; 1352 1352 } 1353 1353 1354 1354 rc = nic_iface->send_frame(dev, data, size); 1355 1355 async_answer_0(callid, rc); … … 1362 1362 nic_iface_t *nic_iface = (nic_iface_t *) iface; 1363 1363 assert(nic_iface->callback_create); 1364 1364 1365 1365 errno_t rc = nic_iface->callback_create(dev); 1366 1366 async_answer_0(callid, rc); … … 1372 1372 nic_iface_t *nic_iface = (nic_iface_t *) iface; 1373 1373 assert(nic_iface->get_state); 1374 1374 1375 1375 nic_device_state_t state = NIC_STATE_MAX; 1376 1376 1377 1377 errno_t rc = nic_iface->get_state(dev, &state); 1378 1378 async_answer_1(callid, rc, state); … … 1384 1384 nic_iface_t *nic_iface = (nic_iface_t *) iface; 1385 1385 assert(nic_iface->set_state); 1386 1386 1387 1387 nic_device_state_t state = (nic_device_state_t) IPC_GET_ARG2(*call); 1388 1388 1389 1389 errno_t rc = nic_iface->set_state(dev, state); 1390 1390 async_answer_0(callid, rc); … … 1396 1396 nic_iface_t *nic_iface = (nic_iface_t *) iface; 1397 1397 assert(nic_iface->get_address); 1398 1398 1399 1399 nic_address_t address; 1400 1400 memset(&address, 0, sizeof(nic_address_t)); 1401 1401 1402 1402 errno_t rc = nic_iface->get_address(dev, &address); 1403 1403 if (rc == EOK) { 1404 1404 size_t max_len; 1405 1405 ipc_callid_t data_callid; 1406 1406 1407 1407 /* All errors will be translated into EPARTY anyway */ 1408 1408 if (!async_data_read_receive(&data_callid, &max_len)) { … … 1411 1411 return; 1412 1412 } 1413 1413 1414 1414 if (max_len != sizeof(nic_address_t)) { 1415 1415 async_answer_0(data_callid, ELIMIT); … … 1417 1417 return; 1418 1418 } 1419 1419 1420 1420 async_data_read_finalize(data_callid, &address, 1421 1421 sizeof(nic_address_t)); 1422 1422 } 1423 1423 1424 1424 async_answer_0(callid, rc); 1425 1425 } … … 1429 1429 { 1430 1430 nic_iface_t *nic_iface = (nic_iface_t *) iface; 1431 1431 1432 1432 size_t length; 1433 1433 ipc_callid_t data_callid; … … 1437 1437 return; 1438 1438 } 1439 1439 1440 1440 if (length > sizeof(nic_address_t)) { 1441 1441 async_answer_0(data_callid, ELIMIT); … … 1443 1443 return; 1444 1444 } 1445 1445 1446 1446 nic_address_t address; 1447 1447 if (async_data_write_finalize(data_callid, &address, length) != EOK) { … … 1449 1449 return; 1450 1450 } 1451 1451 1452 1452 if (nic_iface->set_address != NULL) { 1453 1453 errno_t rc = nic_iface->set_address(dev, &address); … … 1465 1465 return; 1466 1466 } 1467 1467 1468 1468 nic_device_stats_t stats; 1469 1469 memset(&stats, 0, sizeof(nic_device_stats_t)); 1470 1470 1471 1471 errno_t rc = nic_iface->get_stats(dev, &stats); 1472 1472 if (rc == EOK) { … … 1478 1478 return; 1479 1479 } 1480 1480 1481 1481 if (max_len < sizeof(nic_device_stats_t)) { 1482 1482 async_answer_0(data_callid, ELIMIT); … … 1484 1484 return; 1485 1485 } 1486 1486 1487 1487 async_data_read_finalize(data_callid, &stats, 1488 1488 sizeof(nic_device_stats_t)); 1489 1489 } 1490 1490 1491 1491 async_answer_0(callid, rc); 1492 1492 } … … 1500 1500 return; 1501 1501 } 1502 1502 1503 1503 nic_device_info_t info; 1504 1504 memset(&info, 0, sizeof(nic_device_info_t)); 1505 1505 1506 1506 errno_t rc = nic_iface->get_device_info(dev, &info); 1507 1507 if (rc == EOK) { … … 1513 1513 return; 1514 1514 } 1515 1515 1516 1516 if (max_len < sizeof (nic_device_info_t)) { 1517 1517 async_answer_0(data_callid, ELIMIT); … … 1519 1519 return; 1520 1520 } 1521 1521 1522 1522 async_data_read_finalize(data_callid, &info, 1523 1523 sizeof(nic_device_info_t)); 1524 1524 } 1525 1525 1526 1526 async_answer_0(callid, rc); 1527 1527 } … … 1535 1535 return; 1536 1536 } 1537 1537 1538 1538 nic_cable_state_t cs = NIC_CS_UNKNOWN; 1539 1539 1540 1540 errno_t rc = nic_iface->get_cable_state(dev, &cs); 1541 1541 async_answer_1(callid, rc, (sysarg_t) cs); … … 1550 1550 return; 1551 1551 } 1552 1552 1553 1553 int speed = 0; 1554 1554 nic_channel_mode_t duplex = NIC_CM_UNKNOWN; 1555 1555 nic_role_t role = NIC_ROLE_UNKNOWN; 1556 1556 1557 1557 errno_t rc = nic_iface->get_operation_mode(dev, &speed, &duplex, &role); 1558 1558 async_answer_3(callid, rc, (sysarg_t) speed, (sysarg_t) duplex, … … 1568 1568 return; 1569 1569 } 1570 1570 1571 1571 int speed = (int) IPC_GET_ARG2(*call); 1572 1572 nic_channel_mode_t duplex = (nic_channel_mode_t) IPC_GET_ARG3(*call); 1573 1573 nic_role_t role = (nic_role_t) IPC_GET_ARG4(*call); 1574 1574 1575 1575 errno_t rc = nic_iface->set_operation_mode(dev, speed, duplex, role); 1576 1576 async_answer_0(callid, rc); … … 1585 1585 return; 1586 1586 } 1587 1587 1588 1588 uint32_t advertisement = (uint32_t) IPC_GET_ARG2(*call); 1589 1589 1590 1590 errno_t rc = nic_iface->autoneg_enable(dev, advertisement); 1591 1591 async_answer_0(callid, rc); … … 1600 1600 return; 1601 1601 } 1602 1602 1603 1603 errno_t rc = nic_iface->autoneg_disable(dev); 1604 1604 async_answer_0(callid, rc); … … 1613 1613 return; 1614 1614 } 1615 1615 1616 1616 uint32_t our_adv = 0; 1617 1617 uint32_t their_adv = 0; 1618 1618 nic_result_t result = NIC_RESULT_NOT_AVAILABLE; 1619 1619 nic_result_t their_result = NIC_RESULT_NOT_AVAILABLE; 1620 1620 1621 1621 errno_t rc = nic_iface->autoneg_probe(dev, &our_adv, &their_adv, &result, 1622 1622 &their_result); … … 1633 1633 return; 1634 1634 } 1635 1635 1636 1636 errno_t rc = nic_iface->autoneg_restart(dev); 1637 1637 async_answer_0(callid, rc); … … 1646 1646 return; 1647 1647 } 1648 1648 1649 1649 nic_result_t we_send; 1650 1650 nic_result_t we_receive; 1651 1651 uint16_t pause; 1652 1652 1653 1653 errno_t rc = nic_iface->get_pause(dev, &we_send, &we_receive, &pause); 1654 1654 async_answer_3(callid, rc, we_send, we_receive, pause); … … 1663 1663 return; 1664 1664 } 1665 1665 1666 1666 int allow_send = (int) IPC_GET_ARG2(*call); 1667 1667 int allow_receive = (int) IPC_GET_ARG3(*call); 1668 1668 uint16_t pause = (uint16_t) IPC_GET_ARG4(*call); 1669 1669 1670 1670 errno_t rc = nic_iface->set_pause(dev, allow_send, allow_receive, 1671 1671 pause); … … 1681 1681 return; 1682 1682 } 1683 1683 1684 1684 size_t max_count = IPC_GET_ARG2(*call); 1685 1685 nic_address_t *address_list = NULL; 1686 1686 1687 1687 if (max_count != 0) { 1688 1688 address_list = malloc(max_count * sizeof (nic_address_t)); … … 1692 1692 } 1693 1693 } 1694 1694 1695 1695 memset(address_list, 0, max_count * sizeof(nic_address_t)); 1696 1696 nic_unicast_mode_t mode = NIC_UNICAST_DEFAULT; 1697 1697 size_t address_count = 0; 1698 1698 1699 1699 errno_t rc = nic_iface->unicast_get_mode(dev, &mode, max_count, address_list, 1700 1700 &address_count); 1701 1701 1702 1702 if ((rc != EOK) || (max_count == 0) || (address_count == 0)) { 1703 1703 free(address_list); … … 1705 1705 return; 1706 1706 } 1707 1707 1708 1708 ipc_callid_t data_callid; 1709 1709 size_t max_len; … … 1714 1714 return; 1715 1715 } 1716 1716 1717 1717 if (max_len > address_count * sizeof(nic_address_t)) 1718 1718 max_len = address_count * sizeof(nic_address_t); 1719 1719 1720 1720 if (max_len > max_count * sizeof(nic_address_t)) 1721 1721 max_len = max_count * sizeof(nic_address_t); 1722 1722 1723 1723 async_data_read_finalize(data_callid, address_list, max_len); 1724 1724 async_answer_0(data_callid, EINVAL); 1725 1725 1726 1726 free(address_list); 1727 1727 async_answer_2(callid, rc, mode, address_count); … … 1732 1732 { 1733 1733 nic_iface_t *nic_iface = (nic_iface_t *) iface; 1734 1734 1735 1735 size_t length; 1736 1736 nic_unicast_mode_t mode = IPC_GET_ARG2(*call); 1737 1737 size_t address_count = IPC_GET_ARG3(*call); 1738 1738 nic_address_t *address_list = NULL; 1739 1739 1740 1740 if (address_count) { 1741 1741 ipc_callid_t data_callid; … … 1745 1745 return; 1746 1746 } 1747 1747 1748 1748 if (length != address_count * sizeof(nic_address_t)) { 1749 1749 async_answer_0(data_callid, ELIMIT); … … 1751 1751 return; 1752 1752 } 1753 1753 1754 1754 address_list = malloc(length); 1755 1755 if (address_list == NULL) { … … 1758 1758 return; 1759 1759 } 1760 1760 1761 1761 if (async_data_write_finalize(data_callid, address_list, 1762 1762 length) != EOK) { … … 1766 1766 } 1767 1767 } 1768 1768 1769 1769 if (nic_iface->unicast_set_mode != NULL) { 1770 1770 errno_t rc = nic_iface->unicast_set_mode(dev, mode, address_list, … … 1773 1773 } else 1774 1774 async_answer_0(callid, ENOTSUP); 1775 1775 1776 1776 free(address_list); 1777 1777 } … … 1785 1785 return; 1786 1786 } 1787 1787 1788 1788 size_t max_count = IPC_GET_ARG2(*call); 1789 1789 nic_address_t *address_list = NULL; 1790 1790 1791 1791 if (max_count != 0) { 1792 1792 address_list = malloc(max_count * sizeof(nic_address_t)); … … 1796 1796 } 1797 1797 } 1798 1798 1799 1799 memset(address_list, 0, max_count * sizeof(nic_address_t)); 1800 1800 nic_multicast_mode_t mode = NIC_MULTICAST_BLOCKED; 1801 1801 size_t address_count = 0; 1802 1802 1803 1803 errno_t rc = nic_iface->multicast_get_mode(dev, &mode, max_count, address_list, 1804 1804 &address_count); 1805 1806 1805 1806 1807 1807 if ((rc != EOK) || (max_count == 0) || (address_count == 0)) { 1808 1808 free(address_list); … … 1810 1810 return; 1811 1811 } 1812 1812 1813 1813 ipc_callid_t data_callid; 1814 1814 size_t max_len; … … 1819 1819 return; 1820 1820 } 1821 1821 1822 1822 if (max_len > address_count * sizeof(nic_address_t)) 1823 1823 max_len = address_count * sizeof(nic_address_t); 1824 1824 1825 1825 if (max_len > max_count * sizeof(nic_address_t)) 1826 1826 max_len = max_count * sizeof(nic_address_t); 1827 1827 1828 1828 async_data_read_finalize(data_callid, address_list, max_len); 1829 1829 1830 1830 free(address_list); 1831 1831 async_answer_2(callid, rc, mode, address_count); … … 1836 1836 { 1837 1837 nic_iface_t *nic_iface = (nic_iface_t *) iface; 1838 1838 1839 1839 nic_multicast_mode_t mode = IPC_GET_ARG2(*call); 1840 1840 size_t address_count = IPC_GET_ARG3(*call); 1841 1841 nic_address_t *address_list = NULL; 1842 1842 1843 1843 if (address_count) { 1844 1844 ipc_callid_t data_callid; … … 1849 1849 return; 1850 1850 } 1851 1851 1852 1852 if (length != address_count * sizeof (nic_address_t)) { 1853 1853 async_answer_0(data_callid, ELIMIT); … … 1855 1855 return; 1856 1856 } 1857 1857 1858 1858 address_list = malloc(length); 1859 1859 if (address_list == NULL) { … … 1862 1862 return; 1863 1863 } 1864 1864 1865 1865 if (async_data_write_finalize(data_callid, address_list, 1866 1866 length) != EOK) { … … 1870 1870 } 1871 1871 } 1872 1872 1873 1873 if (nic_iface->multicast_set_mode != NULL) { 1874 1874 errno_t rc = nic_iface->multicast_set_mode(dev, mode, address_list, … … 1877 1877 } else 1878 1878 async_answer_0(callid, ENOTSUP); 1879 1879 1880 1880 free(address_list); 1881 1881 } … … 1889 1889 return; 1890 1890 } 1891 1891 1892 1892 nic_broadcast_mode_t mode = NIC_BROADCAST_ACCEPTED; 1893 1893 1894 1894 errno_t rc = nic_iface->broadcast_get_mode(dev, &mode); 1895 1895 async_answer_1(callid, rc, mode); … … 1904 1904 return; 1905 1905 } 1906 1906 1907 1907 nic_broadcast_mode_t mode = IPC_GET_ARG2(*call); 1908 1908 1909 1909 errno_t rc = nic_iface->broadcast_set_mode(dev, mode); 1910 1910 async_answer_0(callid, rc); … … 1919 1919 return; 1920 1920 } 1921 1921 1922 1922 uint32_t mode = 0; 1923 1923 1924 1924 errno_t rc = nic_iface->defective_get_mode(dev, &mode); 1925 1925 async_answer_1(callid, rc, mode); … … 1934 1934 return; 1935 1935 } 1936 1936 1937 1937 uint32_t mode = IPC_GET_ARG2(*call); 1938 1938 1939 1939 errno_t rc = nic_iface->defective_set_mode(dev, mode); 1940 1940 async_answer_0(callid, rc); … … 1949 1949 return; 1950 1950 } 1951 1951 1952 1952 size_t max_count = IPC_GET_ARG2(*call); 1953 1953 nic_address_t *address_list = NULL; 1954 1954 1955 1955 if (max_count != 0) { 1956 1956 address_list = malloc(max_count * sizeof(nic_address_t)); … … 1960 1960 } 1961 1961 } 1962 1962 1963 1963 memset(address_list, 0, max_count * sizeof(nic_address_t)); 1964 1964 size_t address_count = 0; 1965 1965 1966 1966 errno_t rc = nic_iface->blocked_sources_get(dev, max_count, address_list, 1967 1967 &address_count); 1968 1968 1969 1969 if ((rc != EOK) || (max_count == 0) || (address_count == 0)) { 1970 1970 async_answer_1(callid, rc, address_count); … … 1972 1972 return; 1973 1973 } 1974 1974 1975 1975 ipc_callid_t data_callid; 1976 1976 size_t max_len; … … 1981 1981 return; 1982 1982 } 1983 1983 1984 1984 if (max_len > address_count * sizeof(nic_address_t)) 1985 1985 max_len = address_count * sizeof(nic_address_t); 1986 1986 1987 1987 if (max_len > max_count * sizeof(nic_address_t)) 1988 1988 max_len = max_count * sizeof(nic_address_t); 1989 1989 1990 1990 async_data_read_finalize(data_callid, address_list, max_len); 1991 1991 async_answer_0(data_callid, EINVAL); 1992 1992 1993 1993 free(address_list); 1994 1994 async_answer_1(callid, rc, address_count); … … 1999 1999 { 2000 2000 nic_iface_t *nic_iface = (nic_iface_t *) iface; 2001 2001 2002 2002 size_t length; 2003 2003 size_t address_count = IPC_GET_ARG2(*call); 2004 2004 nic_address_t *address_list = NULL; 2005 2005 2006 2006 if (address_count) { 2007 2007 ipc_callid_t data_callid; … … 2011 2011 return; 2012 2012 } 2013 2013 2014 2014 if (length != address_count * sizeof(nic_address_t)) { 2015 2015 async_answer_0(data_callid, ELIMIT); … … 2017 2017 return; 2018 2018 } 2019 2019 2020 2020 address_list = malloc(length); 2021 2021 if (address_list == NULL) { … … 2024 2024 return; 2025 2025 } 2026 2026 2027 2027 if (async_data_write_finalize(data_callid, address_list, 2028 2028 length) != EOK) { … … 2032 2032 } 2033 2033 } 2034 2034 2035 2035 if (nic_iface->blocked_sources_set != NULL) { 2036 2036 errno_t rc = nic_iface->blocked_sources_set(dev, address_list, … … 2039 2039 } else 2040 2040 async_answer_0(callid, ENOTSUP); 2041 2041 2042 2042 free(address_list); 2043 2043 } … … 2051 2051 return; 2052 2052 } 2053 2053 2054 2054 nic_vlan_mask_t vlan_mask; 2055 2055 memset(&vlan_mask, 0, sizeof(nic_vlan_mask_t)); 2056 2056 2057 2057 errno_t rc = nic_iface->vlan_get_mask(dev, &vlan_mask); 2058 2058 if (rc == EOK) { … … 2064 2064 return; 2065 2065 } 2066 2066 2067 2067 if (max_len != sizeof(nic_vlan_mask_t)) { 2068 2068 async_answer_0(data_callid, EINVAL); … … 2070 2070 return; 2071 2071 } 2072 2072 2073 2073 async_data_read_finalize(data_callid, &vlan_mask, max_len); 2074 2074 } 2075 2075 2076 2076 async_answer_0(callid, rc); 2077 2077 } … … 2081 2081 { 2082 2082 nic_iface_t *nic_iface = (nic_iface_t *) iface; 2083 2083 2084 2084 nic_vlan_mask_t vlan_mask; 2085 2085 nic_vlan_mask_t *vlan_mask_pointer = NULL; 2086 2086 bool vlan_mask_set = (bool) IPC_GET_ARG2(*call); 2087 2087 2088 2088 if (vlan_mask_set) { 2089 2089 ipc_callid_t data_callid; … … 2094 2094 return; 2095 2095 } 2096 2096 2097 2097 if (length != sizeof(nic_vlan_mask_t)) { 2098 2098 async_answer_0(data_callid, ELIMIT); … … 2100 2100 return; 2101 2101 } 2102 2102 2103 2103 if (async_data_write_finalize(data_callid, &vlan_mask, 2104 2104 length) != EOK) { … … 2106 2106 return; 2107 2107 } 2108 2108 2109 2109 vlan_mask_pointer = &vlan_mask; 2110 2110 } 2111 2111 2112 2112 if (nic_iface->vlan_set_mask != NULL) { 2113 2113 errno_t rc = nic_iface->vlan_set_mask(dev, vlan_mask_pointer); … … 2121 2121 { 2122 2122 nic_iface_t *nic_iface = (nic_iface_t *) iface; 2123 2123 2124 2124 if (nic_iface->vlan_set_tag == NULL) { 2125 2125 async_answer_0(callid, ENOTSUP); 2126 2126 return; 2127 2127 } 2128 2128 2129 2129 uint16_t tag = (uint16_t) IPC_GET_ARG2(*call); 2130 2130 bool add = (int) IPC_GET_ARG3(*call); 2131 2131 bool strip = (int) IPC_GET_ARG4(*call); 2132 2132 2133 2133 errno_t rc = nic_iface->vlan_set_tag(dev, tag, add, strip); 2134 2134 async_answer_0(callid, rc); … … 2139 2139 { 2140 2140 nic_iface_t *nic_iface = (nic_iface_t *) iface; 2141 2141 2142 2142 int send_data = (int) IPC_GET_ARG3(*call); 2143 2143 ipc_callid_t data_callid; 2144 2144 2145 2145 if (nic_iface->wol_virtue_add == NULL) { 2146 2146 if (send_data) { … … 2148 2148 async_answer_0(data_callid, ENOTSUP); 2149 2149 } 2150 2151 async_answer_0(callid, ENOTSUP); 2152 } 2153 2150 2151 async_answer_0(callid, ENOTSUP); 2152 } 2153 2154 2154 size_t length = 0; 2155 2155 void *data = NULL; 2156 2156 2157 2157 if (send_data) { 2158 2158 if (!async_data_write_receive(&data_callid, &length)) { … … 2161 2161 return; 2162 2162 } 2163 2163 2164 2164 data = malloc(length); 2165 2165 if (data == NULL) { … … 2168 2168 return; 2169 2169 } 2170 2170 2171 2171 if (async_data_write_finalize(data_callid, data, 2172 2172 length) != EOK) { … … 2176 2176 } 2177 2177 } 2178 2178 2179 2179 nic_wv_id_t id = 0; 2180 2180 nic_wv_type_t type = (nic_wv_type_t) IPC_GET_ARG2(*call); 2181 2181 2182 2182 errno_t rc = nic_iface->wol_virtue_add(dev, type, data, length, &id); 2183 2183 async_answer_1(callid, rc, (sysarg_t) id); … … 2189 2189 { 2190 2190 nic_iface_t *nic_iface = (nic_iface_t *) iface; 2191 2191 2192 2192 if (nic_iface->wol_virtue_remove == NULL) { 2193 2193 async_answer_0(callid, ENOTSUP); 2194 2194 return; 2195 2195 } 2196 2196 2197 2197 nic_wv_id_t id = (nic_wv_id_t) IPC_GET_ARG2(*call); 2198 2198 2199 2199 errno_t rc = nic_iface->wol_virtue_remove(dev, id); 2200 2200 async_answer_0(callid, rc); … … 2205 2205 { 2206 2206 nic_iface_t *nic_iface = (nic_iface_t *) iface; 2207 2207 2208 2208 if (nic_iface->wol_virtue_probe == NULL) { 2209 2209 async_answer_0(callid, ENOTSUP); 2210 2210 return; 2211 2211 } 2212 2212 2213 2213 nic_wv_id_t id = (nic_wv_id_t) IPC_GET_ARG2(*call); 2214 2214 size_t max_length = IPC_GET_ARG3(*call); … … 2217 2217 ipc_callid_t data_callid; 2218 2218 void *data = NULL; 2219 2219 2220 2220 if (max_length != 0) { 2221 2221 data = malloc(max_length); … … 2225 2225 } 2226 2226 } 2227 2227 2228 2228 memset(data, 0, max_length); 2229 2229 2230 2230 errno_t rc = nic_iface->wol_virtue_probe(dev, id, &type, max_length, 2231 2231 data, &length); 2232 2232 2233 2233 if ((max_length != 0) && (length != 0)) { 2234 2234 size_t req_length; … … 2239 2239 return; 2240 2240 } 2241 2241 2242 2242 if (req_length > length) 2243 2243 req_length = length; 2244 2244 2245 2245 if (req_length > max_length) 2246 2246 req_length = max_length; 2247 2247 2248 2248 async_data_read_finalize(data_callid, data, req_length); 2249 2249 } 2250 2250 2251 2251 async_answer_2(callid, rc, (sysarg_t) type, (sysarg_t) length); 2252 2252 free(data); … … 2261 2261 return; 2262 2262 } 2263 2263 2264 2264 nic_wv_type_t type = (nic_wv_type_t) IPC_GET_ARG2(*call); 2265 2265 size_t max_count = IPC_GET_ARG3(*call); … … 2267 2267 nic_wv_id_t *id_list = NULL; 2268 2268 ipc_callid_t data_callid; 2269 2269 2270 2270 if (max_count != 0) { 2271 2271 id_list = malloc(max_count * sizeof(nic_wv_id_t)); … … 2275 2275 } 2276 2276 } 2277 2277 2278 2278 memset(id_list, 0, max_count * sizeof (nic_wv_id_t)); 2279 2279 2280 2280 errno_t rc = nic_iface->wol_virtue_list(dev, type, max_count, id_list, 2281 2281 &count); 2282 2282 2283 2283 if ((max_count != 0) && (count != 0)) { 2284 2284 size_t req_length; … … 2289 2289 return; 2290 2290 } 2291 2291 2292 2292 if (req_length > count * sizeof(nic_wv_id_t)) 2293 2293 req_length = count * sizeof(nic_wv_id_t); 2294 2294 2295 2295 if (req_length > max_count * sizeof(nic_wv_id_t)) 2296 2296 req_length = max_count * sizeof(nic_wv_id_t); 2297 2297 2298 2298 rc = async_data_read_finalize(data_callid, id_list, req_length); 2299 2299 } 2300 2300 2301 2301 async_answer_1(callid, rc, (sysarg_t) count); 2302 2302 free(id_list); … … 2311 2311 return; 2312 2312 } 2313 2313 2314 2314 int count = -1; 2315 2315 nic_wv_type_t type = (nic_wv_type_t) IPC_GET_ARG2(*call); 2316 2316 2317 2317 errno_t rc = nic_iface->wol_virtue_get_caps(dev, type, &count); 2318 2318 async_answer_1(callid, rc, (sysarg_t) count); … … 2327 2327 return; 2328 2328 } 2329 2329 2330 2330 size_t max_length = (size_t) IPC_GET_ARG2(*call); 2331 2331 size_t frame_length = 0; 2332 2332 nic_wv_type_t type = NIC_WV_NONE; 2333 2333 uint8_t *data = NULL; 2334 2334 2335 2335 if (max_length != 0) { 2336 2336 data = malloc(max_length); … … 2340 2340 } 2341 2341 } 2342 2342 2343 2343 memset(data, 0, max_length); 2344 2344 2345 2345 errno_t rc = nic_iface->wol_load_info(dev, &type, max_length, data, 2346 2346 &frame_length); … … 2354 2354 return; 2355 2355 } 2356 2356 2357 2357 req_length = req_length > max_length ? max_length : req_length; 2358 2358 req_length = req_length > frame_length ? frame_length : req_length; 2359 2359 async_data_read_finalize(data_callid, data, req_length); 2360 2360 } 2361 2361 2362 2362 async_answer_2(callid, rc, (sysarg_t) type, (sysarg_t) frame_length); 2363 2363 free(data); … … 2372 2372 return; 2373 2373 } 2374 2374 2375 2375 uint32_t supported = 0; 2376 2376 uint32_t active = 0; 2377 2377 2378 2378 errno_t rc = nic_iface->offload_probe(dev, &supported, &active); 2379 2379 async_answer_2(callid, rc, supported, active); … … 2388 2388 return; 2389 2389 } 2390 2390 2391 2391 uint32_t mask = (uint32_t) IPC_GET_ARG2(*call); 2392 2392 uint32_t active = (uint32_t) IPC_GET_ARG3(*call); 2393 2393 2394 2394 errno_t rc = nic_iface->offload_set(dev, mask, active); 2395 2395 async_answer_0(callid, rc); … … 2404 2404 return; 2405 2405 } 2406 2406 2407 2407 nic_poll_mode_t mode = NIC_POLL_IMMEDIATE; 2408 2408 int request_data = IPC_GET_ARG2(*call); … … 2411 2411 .tv_usec = 0 2412 2412 }; 2413 2413 2414 2414 errno_t rc = nic_iface->poll_get_mode(dev, &mode, &period); 2415 2415 if ((rc == EOK) && (request_data)) { 2416 2416 size_t max_len; 2417 2417 ipc_callid_t data_callid; 2418 2418 2419 2419 if (!async_data_read_receive(&data_callid, &max_len)) { 2420 2420 async_answer_0(data_callid, EINVAL); … … 2422 2422 return; 2423 2423 } 2424 2424 2425 2425 if (max_len != sizeof(struct timeval)) { 2426 2426 async_answer_0(data_callid, ELIMIT); … … 2428 2428 return; 2429 2429 } 2430 2430 2431 2431 async_data_read_finalize(data_callid, &period, 2432 2432 sizeof(struct timeval)); 2433 2433 } 2434 2434 2435 2435 async_answer_1(callid, rc, (sysarg_t) mode); 2436 2436 } … … 2440 2440 { 2441 2441 nic_iface_t *nic_iface = (nic_iface_t *) iface; 2442 2442 2443 2443 nic_poll_mode_t mode = IPC_GET_ARG2(*call); 2444 2444 int has_period = IPC_GET_ARG3(*call); … … 2446 2446 struct timeval *period = NULL; 2447 2447 size_t length; 2448 2448 2449 2449 if (has_period) { 2450 2450 ipc_callid_t data_callid; … … 2454 2454 return; 2455 2455 } 2456 2456 2457 2457 if (length != sizeof(struct timeval)) { 2458 2458 async_answer_0(data_callid, ELIMIT); … … 2460 2460 return; 2461 2461 } 2462 2462 2463 2463 period = &period_buf; 2464 2464 if (async_data_write_finalize(data_callid, period, … … 2468 2468 } 2469 2469 } 2470 2470 2471 2471 if (nic_iface->poll_set_mode != NULL) { 2472 2472 errno_t rc = nic_iface->poll_set_mode(dev, mode, period); … … 2484 2484 return; 2485 2485 } 2486 2486 2487 2487 errno_t rc = nic_iface->poll_now(dev); 2488 2488 async_answer_0(callid, rc);
Note:
See TracChangeset
for help on using the changeset viewer.