Changeset a35b458 in mainline for uspace/lib/drv/generic/remote_nic.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_nic.c

    r3061bc1 ra35b458  
    101101{
    102102        async_exch_t *exch = async_exchange_begin(dev_sess);
    103        
     103
    104104        ipc_call_t answer;
    105105        aid_t req = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    106106            NIC_SEND_MESSAGE, &answer);
    107107        errno_t retval = async_data_write_start(exch, data, size);
    108        
    109         async_exchange_end(exch);
    110        
     108
     109        async_exchange_end(exch);
     110
    111111        if (retval != EOK) {
    112112                async_forget(req);
     
    132132        errno_t rc;
    133133        errno_t retval;
    134        
     134
    135135        async_exch_t *exch = async_exchange_begin(dev_sess);
    136136        aid_t req = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    137137            NIC_CALLBACK_CREATE, &answer);
    138        
     138
    139139        port_id_t port;
    140140        rc = async_create_callback_port(exch, INTERFACE_NIC_CB, 0, 0,
     
    145145        }
    146146        async_exchange_end(exch);
    147        
     147
    148148        async_wait_for(req, &retval);
    149149        return retval;
     
    161161{
    162162        assert(state);
    163        
     163
    164164        sysarg_t _state;
    165        
     165
    166166        async_exch_t *exch = async_exchange_begin(dev_sess);
    167167        errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    168168            NIC_GET_STATE, &_state);
    169169        async_exchange_end(exch);
    170        
     170
    171171        *state = (nic_device_state_t) _state;
    172        
     172
    173173        return rc;
    174174}
     
    188188            NIC_SET_STATE, state);
    189189        async_exchange_end(exch);
    190        
     190
    191191        return rc;
    192192}
     
    203203{
    204204        assert(address);
    205        
     205
    206206        async_exch_t *exch = async_exchange_begin(dev_sess);
    207207        aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
     
    209209        errno_t rc = async_data_read_start(exch, address, sizeof(nic_address_t));
    210210        async_exchange_end(exch);
    211        
     211
    212212        errno_t res;
    213213        async_wait_for(aid, &res);
    214        
     214
    215215        if (rc != EOK)
    216216                return rc;
    217        
     217
    218218        return res;
    219219}
     
    230230{
    231231        assert(address);
    232        
     232
    233233        async_exch_t *exch = async_exchange_begin(dev_sess);
    234234        aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
     
    236236        errno_t rc = async_data_write_start(exch, address, sizeof(nic_address_t));
    237237        async_exchange_end(exch);
    238        
     238
    239239        errno_t res;
    240240        async_wait_for(aid, &res);
    241        
     241
    242242        if (rc != EOK)
    243243                return rc;
    244        
     244
    245245        return res;
    246246}
     
    257257{
    258258        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
    262262        errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    263263            NIC_GET_STATS);
     
    266266                return rc;
    267267        }
    268        
     268
    269269        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
    273273        return rc;
    274274}
     
    287287{
    288288        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
    292292        aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    293293            NIC_GET_DEVICE_INFO, NULL);
     
    297297        errno_t res;
    298298        async_wait_for(aid, &res);
    299        
     299
    300300        if (rc != EOK)
    301301                return rc;
    302        
     302
    303303        return res;
    304304}
     
    315315{
    316316        assert(cable_state);
    317        
     317
    318318        sysarg_t _cable_state;
    319        
     319
    320320        async_exch_t *exch = async_exchange_begin(dev_sess);
    321321        errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    322322            NIC_GET_CABLE_STATE, &_cable_state);
    323323        async_exchange_end(exch);
    324        
     324
    325325        *cable_state = (nic_cable_state_t) _cable_state;
    326        
     326
    327327        return rc;
    328328}
     
    344344        sysarg_t _duplex;
    345345        sysarg_t _role;
    346        
     346
    347347        async_exch_t *exch = async_exchange_begin(dev_sess);
    348348        errno_t rc = async_req_1_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    349349            NIC_GET_OPERATION_MODE, &_speed, &_duplex, &_role);
    350350        async_exchange_end(exch);
    351        
     351
    352352        if (speed)
    353353                *speed = (int) _speed;
    354        
     354
    355355        if (duplex)
    356356                *duplex = (nic_channel_mode_t) _duplex;
    357        
     357
    358358        if (role)
    359359                *role = (nic_role_t) _role;
    360        
     360
    361361        return rc;
    362362}
     
    383383            (sysarg_t) role);
    384384        async_exchange_end(exch);
    385        
     385
    386386        return rc;
    387387}
     
    406406            NIC_AUTONEG_ENABLE, (sysarg_t) advertisement);
    407407        async_exchange_end(exch);
    408        
     408
    409409        return rc;
    410410}
     
    423423            NIC_AUTONEG_DISABLE);
    424424        async_exchange_end(exch);
    425        
     425
    426426        return rc;
    427427}
     
    452452        sysarg_t _result;
    453453        sysarg_t _their_result;
    454        
     454
    455455        async_exch_t *exch = async_exchange_begin(dev_sess);
    456456        errno_t rc = async_req_1_4(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
     
    458458            &_result, &_their_result);
    459459        async_exchange_end(exch);
    460        
     460
    461461        if (our_advertisement)
    462462                *our_advertisement = (uint32_t) _our_advertisement;
    463        
     463
    464464        if (*their_advertisement)
    465465                *their_advertisement = (uint32_t) _their_advertisement;
    466        
     466
    467467        if (result)
    468468                *result = (nic_result_t) _result;
    469        
     469
    470470        if (their_result)
    471471                *their_result = (nic_result_t) _their_result;
    472        
     472
    473473        return rc;
    474474}
     
    487487            NIC_AUTONEG_RESTART);
    488488        async_exchange_end(exch);
    489        
     489
    490490        return rc;
    491491}
     
    507507        sysarg_t _we_receive;
    508508        sysarg_t _pause;
    509        
     509
    510510        async_exch_t *exch = async_exchange_begin(dev_sess);
    511511        errno_t rc = async_req_1_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    512512            NIC_GET_PAUSE, &_we_send, &_we_receive, &_pause);
    513513        async_exchange_end(exch);
    514        
     514
    515515        if (we_send)
    516516                *we_send = _we_send;
    517        
     517
    518518        if (we_receive)
    519519                *we_receive = _we_receive;
    520        
     520
    521521        if (pause)
    522522                *pause = _pause;
    523        
     523
    524524        return rc;
    525525}
     
    546546            NIC_SET_PAUSE, allow_send, allow_receive, pause);
    547547        async_exchange_end(exch);
    548        
     548
    549549        return rc;
    550550}
     
    570570{
    571571        assert(mode);
    572        
     572
    573573        sysarg_t _mode;
    574574        sysarg_t _address_count;
    575        
     575
    576576        if (!address_list)
    577577                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
    581581        errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    582582            NIC_UNICAST_GET_MODE, max_count, &_mode, &_address_count);
     
    585585                return rc;
    586586        }
    587        
     587
    588588        *mode = (nic_unicast_mode_t) _mode;
    589589        if (address_count)
    590590                *address_count = (size_t) _address_count;
    591        
     591
    592592        if ((max_count) && (_address_count))
    593593                rc = async_data_read_start(exch, address_list,
    594594                    max_count * sizeof(nic_address_t));
    595        
    596         async_exchange_end(exch);
    597        
     595
     596        async_exchange_end(exch);
     597
    598598        return rc;
    599599}
     
    614614        if (address_list == NULL)
    615615                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
    619619        aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    620620            NIC_UNICAST_SET_MODE, (sysarg_t) mode, address_count, NULL);
    621        
     621
    622622        errno_t rc;
    623623        if (address_count)
     
    626626        else
    627627                rc = EOK;
    628        
    629         async_exchange_end(exch);
    630        
     628
     629        async_exchange_end(exch);
     630
    631631        errno_t res;
    632632        async_wait_for(message_id, &res);
    633        
     633
    634634        if (rc != EOK)
    635635                return rc;
    636        
     636
    637637        return res;
    638638}
     
    659659{
    660660        assert(mode);
    661        
     661
    662662        sysarg_t _mode;
    663        
     663
    664664        if (!address_list)
    665665                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
    669669        sysarg_t ac;
    670670        errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
     
    674674                return rc;
    675675        }
    676        
     676
    677677        *mode = (nic_multicast_mode_t) _mode;
    678678        if (address_count)
    679679                *address_count = (size_t) ac;
    680        
     680
    681681        if ((max_count) && (ac))
    682682                rc = async_data_read_start(exch, address_list,
    683683                    max_count * sizeof(nic_address_t));
    684        
     684
    685685        async_exchange_end(exch);
    686686        return rc;
     
    702702        if (address_list == NULL)
    703703                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
    707707        aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    708708            NIC_MULTICAST_SET_MODE, (sysarg_t) mode, address_count, NULL);
    709        
     709
    710710        errno_t rc;
    711711        if (address_count)
     
    714714        else
    715715                rc = EOK;
    716        
    717         async_exchange_end(exch);
    718        
     716
     717        async_exchange_end(exch);
     718
    719719        errno_t res;
    720720        async_wait_for(message_id, &res);
    721        
     721
    722722        if (rc != EOK)
    723723                return rc;
    724        
     724
    725725        return res;
    726726}
     
    737737{
    738738        assert(mode);
    739        
     739
    740740        sysarg_t _mode;
    741        
     741
    742742        async_exch_t *exch = async_exchange_begin(dev_sess);
    743743        errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    744744            NIC_BROADCAST_GET_MODE, &_mode);
    745745        async_exchange_end(exch);
    746        
     746
    747747        *mode = (nic_broadcast_mode_t) _mode;
    748        
     748
    749749        return rc;
    750750}
     
    764764            NIC_BROADCAST_SET_MODE, mode);
    765765        async_exchange_end(exch);
    766        
     766
    767767        return rc;
    768768}
     
    779779{
    780780        assert(mode);
    781        
     781
    782782        sysarg_t _mode;
    783        
     783
    784784        async_exch_t *exch = async_exchange_begin(dev_sess);
    785785        errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    786786            NIC_DEFECTIVE_GET_MODE, &_mode);
    787787        async_exchange_end(exch);
    788        
     788
    789789        *mode = (uint32_t) _mode;
    790        
     790
    791791        return rc;
    792792}
     
    806806            NIC_DEFECTIVE_SET_MODE, mode);
    807807        async_exchange_end(exch);
    808        
     808
    809809        return rc;
    810810}
     
    827827        if (!address_list)
    828828                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
    832832        sysarg_t ac;
    833833        errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
     
    837837                return rc;
    838838        }
    839        
     839
    840840        if (address_count)
    841841                *address_count = (size_t) ac;
    842        
     842
    843843        if ((max_count) && (ac))
    844844                rc = async_data_read_start(exch, address_list,
    845845                    max_count * sizeof(nic_address_t));
    846        
     846
    847847        async_exchange_end(exch);
    848848        return rc;
     
    863863        if (address_list == NULL)
    864864                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
    868868        aid_t message_id = async_send_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    869869            NIC_BLOCKED_SOURCES_SET, address_count, NULL);
    870        
     870
    871871        errno_t rc;
    872872        if (address_count)
     
    875875        else
    876876                rc = EOK;
    877        
    878         async_exchange_end(exch);
    879        
     877
     878        async_exchange_end(exch);
     879
    880880        errno_t res;
    881881        async_wait_for(message_id, &res);
    882        
     882
    883883        if (rc != EOK)
    884884                return rc;
    885        
     885
    886886        return res;
    887887}
     
    898898{
    899899        assert(mask);
    900        
     900
    901901        async_exch_t *exch = async_exchange_begin(dev_sess);
    902902        errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
     
    906906                return rc;
    907907        }
    908        
     908
    909909        rc = async_data_read_start(exch, mask, sizeof(nic_vlan_mask_t));
    910910        async_exchange_end(exch);
    911        
     911
    912912        return rc;
    913913}
     
    926926{
    927927        async_exch_t *exch = async_exchange_begin(dev_sess);
    928        
     928
    929929        aid_t message_id = async_send_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    930930            NIC_VLAN_SET_MASK, mask != NULL, NULL);
    931        
     931
    932932        errno_t rc;
    933933        if (mask != NULL)
     
    935935        else
    936936                rc = EOK;
    937        
    938         async_exchange_end(exch);
    939        
     937
     938        async_exchange_end(exch);
     939
    940940        errno_t res;
    941941        async_wait_for(message_id, &res);
    942        
     942
    943943        if (rc != EOK)
    944944                return rc;
    945        
     945
    946946        return res;
    947947}
     
    969969            NIC_VLAN_SET_TAG, (sysarg_t) tag, (sysarg_t) add, (sysarg_t) strip);
    970970        async_exchange_end(exch);
    971        
     971
    972972        return rc;
    973973}
     
    989989{
    990990        assert(id);
    991        
     991
    992992        bool send_data = ((data != NULL) && (length != 0));
    993993        async_exch_t *exch = async_exchange_begin(dev_sess);
    994        
     994
    995995        ipc_call_t result;
    996996        aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    997997            NIC_WOL_VIRTUE_ADD, (sysarg_t) type, send_data, &result);
    998        
     998
    999999        errno_t res;
    10001000        if (send_data) {
     
    10061006                }
    10071007        }
    1008        
     1008
    10091009        async_exchange_end(exch);
    10101010        async_wait_for(message_id, &res);
    1011        
     1011
    10121012        *id = IPC_GET_ARG1(result);
    10131013        return res;
     
    10281028            NIC_WOL_VIRTUE_REMOVE, (sysarg_t) id);
    10291029        async_exchange_end(exch);
    1030        
     1030
    10311031        return rc;
    10321032}
     
    10501050        sysarg_t _type;
    10511051        sysarg_t _length;
    1052        
     1052
    10531053        if (data == NULL)
    10541054                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
    10581058        errno_t rc = async_req_3_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    10591059            NIC_WOL_VIRTUE_PROBE, (sysarg_t) id, max_length,
     
    10631063                return rc;
    10641064        }
    1065        
     1065
    10661066        if (type)
    10671067                *type = _type;
    1068        
     1068
    10691069        if (length)
    10701070                *length = _length;
    1071        
     1071
    10721072        if ((max_length) && (_length != 0))
    10731073                rc = async_data_read_start(exch, data, max_length);
    1074        
     1074
    10751075        async_exchange_end(exch);
    10761076        return rc;
     
    11001100        if (id_list == NULL)
    11011101                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
    11051105        sysarg_t count;
    11061106        errno_t rc = async_req_3_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    11071107            NIC_WOL_VIRTUE_LIST, (sysarg_t) type, max_count, &count);
    1108        
     1108
    11091109        if (id_count)
    11101110                *id_count = (size_t) count;
    1111        
     1111
    11121112        if ((rc != EOK) || (!max_count)) {
    11131113                async_exchange_end(exch);
    11141114                return rc;
    11151115        }
    1116        
     1116
    11171117        rc = async_data_read_start(exch, id_list,
    11181118            max_count * sizeof(nic_wv_id_t));
    1119        
     1119
    11201120        async_exchange_end(exch);
    11211121        return rc;
     
    11391139{
    11401140        assert(count);
    1141        
     1141
    11421142        sysarg_t _count;
    1143        
     1143
    11441144        async_exch_t *exch = async_exchange_begin(dev_sess);
    11451145        errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    11461146            NIC_WOL_VIRTUE_GET_CAPS, (sysarg_t) type, &_count);
    11471147        async_exchange_end(exch);
    1148        
     1148
    11491149        *count = (int) _count;
    11501150        return rc;
     
    11771177{
    11781178        assert(matched_type);
    1179        
     1179
    11801180        sysarg_t _matched_type;
    11811181        sysarg_t _frame_length;
    1182        
     1182
    11831183        if (frame == NULL)
    11841184                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
    11881188        errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    11891189            NIC_WOL_LOAD_INFO, max_length, &_matched_type, &_frame_length);
     
    11921192                return rc;
    11931193        }
    1194        
     1194
    11951195        *matched_type = (nic_wv_type_t) _matched_type;
    11961196        if (frame_length)
    11971197                *frame_length = (size_t) _frame_length;
    1198        
     1198
    11991199        if ((max_length != 0) && (_frame_length != 0))
    12001200                rc = async_data_read_start(exch, frame, max_length);
    1201        
     1201
    12021202        async_exchange_end(exch);
    12031203        return rc;
     
    12181218        assert(supported);
    12191219        assert(active);
    1220        
     1220
    12211221        sysarg_t _supported;
    12221222        sysarg_t _active;
    1223        
     1223
    12241224        async_exch_t *exch = async_exchange_begin(dev_sess);
    12251225        errno_t rc = async_req_1_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    12261226            NIC_OFFLOAD_PROBE, &_supported, &_active);
    12271227        async_exchange_end(exch);
    1228        
     1228
    12291229        *supported = (uint32_t) _supported;
    12301230        *active = (uint32_t) _active;
     
    12471247            NIC_AUTONEG_RESTART, (sysarg_t) mask, (sysarg_t) active);
    12481248        async_exchange_end(exch);
    1249        
     1249
    12501250        return rc;
    12511251}
     
    12651265{
    12661266        assert(mode);
    1267        
     1267
    12681268        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
    12721272        errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    12731273            NIC_POLL_GET_MODE, period != NULL, &_mode);
     
    12761276                return rc;
    12771277        }
    1278        
     1278
    12791279        *mode = (nic_poll_mode_t) _mode;
    1280        
     1280
    12811281        if (period != NULL)
    12821282                rc = async_data_read_start(exch, period, sizeof(struct timeval));
    1283        
     1283
    12841284        async_exchange_end(exch);
    12851285        return rc;
     
    12991299{
    13001300        async_exch_t *exch = async_exchange_begin(dev_sess);
    1301        
     1301
    13021302        aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    13031303            NIC_POLL_SET_MODE, (sysarg_t) mode, period != NULL, NULL);
    1304        
     1304
    13051305        errno_t rc;
    13061306        if (period)
     
    13081308        else
    13091309                rc = EOK;
    1310        
    1311         async_exchange_end(exch);
    1312        
     1310
     1311        async_exchange_end(exch);
     1312
    13131313        errno_t res;
    13141314        async_wait_for(message_id, &res);
    1315        
     1315
    13161316        if (rc != EOK)
    13171317                return rc;
    1318        
     1318
    13191319        return res;
    13201320}
     
    13321332        errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), NIC_POLL_NOW);
    13331333        async_exchange_end(exch);
    1334        
     1334
    13351335        return rc;
    13361336}
     
    13411341        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    13421342        assert(nic_iface->send_frame);
    1343        
     1343
    13441344        void *data;
    13451345        size_t size;
    13461346        errno_t rc;
    1347        
     1347
    13481348        rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
    13491349        if (rc != EOK) {
     
    13511351                return;
    13521352        }
    1353        
     1353
    13541354        rc = nic_iface->send_frame(dev, data, size);
    13551355        async_answer_0(callid, rc);
     
    13621362        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    13631363        assert(nic_iface->callback_create);
    1364        
     1364
    13651365        errno_t rc = nic_iface->callback_create(dev);
    13661366        async_answer_0(callid, rc);
     
    13721372        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    13731373        assert(nic_iface->get_state);
    1374        
     1374
    13751375        nic_device_state_t state = NIC_STATE_MAX;
    1376        
     1376
    13771377        errno_t rc = nic_iface->get_state(dev, &state);
    13781378        async_answer_1(callid, rc, state);
     
    13841384        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    13851385        assert(nic_iface->set_state);
    1386        
     1386
    13871387        nic_device_state_t state = (nic_device_state_t) IPC_GET_ARG2(*call);
    1388        
     1388
    13891389        errno_t rc = nic_iface->set_state(dev, state);
    13901390        async_answer_0(callid, rc);
     
    13961396        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    13971397        assert(nic_iface->get_address);
    1398        
     1398
    13991399        nic_address_t address;
    14001400        memset(&address, 0, sizeof(nic_address_t));
    1401        
     1401
    14021402        errno_t rc = nic_iface->get_address(dev, &address);
    14031403        if (rc == EOK) {
    14041404                size_t max_len;
    14051405                ipc_callid_t data_callid;
    1406                
     1406
    14071407                /* All errors will be translated into EPARTY anyway */
    14081408                if (!async_data_read_receive(&data_callid, &max_len)) {
     
    14111411                        return;
    14121412                }
    1413                
     1413
    14141414                if (max_len != sizeof(nic_address_t)) {
    14151415                        async_answer_0(data_callid, ELIMIT);
     
    14171417                        return;
    14181418                }
    1419                
     1419
    14201420                async_data_read_finalize(data_callid, &address,
    14211421                    sizeof(nic_address_t));
    14221422        }
    1423        
     1423
    14241424        async_answer_0(callid, rc);
    14251425}
     
    14291429{
    14301430        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    1431        
     1431
    14321432        size_t length;
    14331433        ipc_callid_t data_callid;
     
    14371437                return;
    14381438        }
    1439        
     1439
    14401440        if (length > sizeof(nic_address_t)) {
    14411441                async_answer_0(data_callid, ELIMIT);
     
    14431443                return;
    14441444        }
    1445        
     1445
    14461446        nic_address_t address;
    14471447        if (async_data_write_finalize(data_callid, &address, length) != EOK) {
     
    14491449                return;
    14501450        }
    1451        
     1451
    14521452        if (nic_iface->set_address != NULL) {
    14531453                errno_t rc = nic_iface->set_address(dev, &address);
     
    14651465                return;
    14661466        }
    1467        
     1467
    14681468        nic_device_stats_t stats;
    14691469        memset(&stats, 0, sizeof(nic_device_stats_t));
    1470        
     1470
    14711471        errno_t rc = nic_iface->get_stats(dev, &stats);
    14721472        if (rc == EOK) {
     
    14781478                        return;
    14791479                }
    1480                
     1480
    14811481                if (max_len < sizeof(nic_device_stats_t)) {
    14821482                        async_answer_0(data_callid, ELIMIT);
     
    14841484                        return;
    14851485                }
    1486                
     1486
    14871487                async_data_read_finalize(data_callid, &stats,
    14881488                    sizeof(nic_device_stats_t));
    14891489        }
    1490        
     1490
    14911491        async_answer_0(callid, rc);
    14921492}
     
    15001500                return;
    15011501        }
    1502        
     1502
    15031503        nic_device_info_t info;
    15041504        memset(&info, 0, sizeof(nic_device_info_t));
    1505        
     1505
    15061506        errno_t rc = nic_iface->get_device_info(dev, &info);
    15071507        if (rc == EOK) {
     
    15131513                        return;
    15141514                }
    1515                
     1515
    15161516                if (max_len < sizeof (nic_device_info_t)) {
    15171517                        async_answer_0(data_callid, ELIMIT);
     
    15191519                        return;
    15201520                }
    1521                
     1521
    15221522                async_data_read_finalize(data_callid, &info,
    15231523                    sizeof(nic_device_info_t));
    15241524        }
    1525        
     1525
    15261526        async_answer_0(callid, rc);
    15271527}
     
    15351535                return;
    15361536        }
    1537        
     1537
    15381538        nic_cable_state_t cs = NIC_CS_UNKNOWN;
    1539        
     1539
    15401540        errno_t rc = nic_iface->get_cable_state(dev, &cs);
    15411541        async_answer_1(callid, rc, (sysarg_t) cs);
     
    15501550                return;
    15511551        }
    1552        
     1552
    15531553        int speed = 0;
    15541554        nic_channel_mode_t duplex = NIC_CM_UNKNOWN;
    15551555        nic_role_t role = NIC_ROLE_UNKNOWN;
    1556        
     1556
    15571557        errno_t rc = nic_iface->get_operation_mode(dev, &speed, &duplex, &role);
    15581558        async_answer_3(callid, rc, (sysarg_t) speed, (sysarg_t) duplex,
     
    15681568                return;
    15691569        }
    1570        
     1570
    15711571        int speed = (int) IPC_GET_ARG2(*call);
    15721572        nic_channel_mode_t duplex = (nic_channel_mode_t) IPC_GET_ARG3(*call);
    15731573        nic_role_t role = (nic_role_t) IPC_GET_ARG4(*call);
    1574        
     1574
    15751575        errno_t rc = nic_iface->set_operation_mode(dev, speed, duplex, role);
    15761576        async_answer_0(callid, rc);
     
    15851585                return;
    15861586        }
    1587        
     1587
    15881588        uint32_t advertisement = (uint32_t) IPC_GET_ARG2(*call);
    1589        
     1589
    15901590        errno_t rc = nic_iface->autoneg_enable(dev, advertisement);
    15911591        async_answer_0(callid, rc);
     
    16001600                return;
    16011601        }
    1602        
     1602
    16031603        errno_t rc = nic_iface->autoneg_disable(dev);
    16041604        async_answer_0(callid, rc);
     
    16131613                return;
    16141614        }
    1615        
     1615
    16161616        uint32_t our_adv = 0;
    16171617        uint32_t their_adv = 0;
    16181618        nic_result_t result = NIC_RESULT_NOT_AVAILABLE;
    16191619        nic_result_t their_result = NIC_RESULT_NOT_AVAILABLE;
    1620        
     1620
    16211621        errno_t rc = nic_iface->autoneg_probe(dev, &our_adv, &their_adv, &result,
    16221622            &their_result);
     
    16331633                return;
    16341634        }
    1635        
     1635
    16361636        errno_t rc = nic_iface->autoneg_restart(dev);
    16371637        async_answer_0(callid, rc);
     
    16461646                return;
    16471647        }
    1648        
     1648
    16491649        nic_result_t we_send;
    16501650        nic_result_t we_receive;
    16511651        uint16_t pause;
    1652        
     1652
    16531653        errno_t rc = nic_iface->get_pause(dev, &we_send, &we_receive, &pause);
    16541654        async_answer_3(callid, rc, we_send, we_receive, pause);
     
    16631663                return;
    16641664        }
    1665        
     1665
    16661666        int allow_send = (int) IPC_GET_ARG2(*call);
    16671667        int allow_receive = (int) IPC_GET_ARG3(*call);
    16681668        uint16_t pause = (uint16_t) IPC_GET_ARG4(*call);
    1669        
     1669
    16701670        errno_t rc = nic_iface->set_pause(dev, allow_send, allow_receive,
    16711671            pause);
     
    16811681                return;
    16821682        }
    1683        
     1683
    16841684        size_t max_count = IPC_GET_ARG2(*call);
    16851685        nic_address_t *address_list = NULL;
    1686        
     1686
    16871687        if (max_count != 0) {
    16881688                address_list = malloc(max_count * sizeof (nic_address_t));
     
    16921692                }
    16931693        }
    1694        
     1694
    16951695        memset(address_list, 0, max_count * sizeof(nic_address_t));
    16961696        nic_unicast_mode_t mode = NIC_UNICAST_DEFAULT;
    16971697        size_t address_count = 0;
    1698        
     1698
    16991699        errno_t rc = nic_iface->unicast_get_mode(dev, &mode, max_count, address_list,
    17001700            &address_count);
    1701        
     1701
    17021702        if ((rc != EOK) || (max_count == 0) || (address_count == 0)) {
    17031703                free(address_list);
     
    17051705                return;
    17061706        }
    1707        
     1707
    17081708        ipc_callid_t data_callid;
    17091709        size_t max_len;
     
    17141714                return;
    17151715        }
    1716        
     1716
    17171717        if (max_len > address_count * sizeof(nic_address_t))
    17181718                max_len = address_count * sizeof(nic_address_t);
    1719        
     1719
    17201720        if (max_len > max_count * sizeof(nic_address_t))
    17211721                max_len = max_count * sizeof(nic_address_t);
    1722        
     1722
    17231723        async_data_read_finalize(data_callid, address_list, max_len);
    17241724        async_answer_0(data_callid, EINVAL);
    1725        
     1725
    17261726        free(address_list);
    17271727        async_answer_2(callid, rc, mode, address_count);
     
    17321732{
    17331733        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    1734        
     1734
    17351735        size_t length;
    17361736        nic_unicast_mode_t mode = IPC_GET_ARG2(*call);
    17371737        size_t address_count = IPC_GET_ARG3(*call);
    17381738        nic_address_t *address_list = NULL;
    1739        
     1739
    17401740        if (address_count) {
    17411741                ipc_callid_t data_callid;
     
    17451745                        return;
    17461746                }
    1747                
     1747
    17481748                if (length != address_count * sizeof(nic_address_t)) {
    17491749                        async_answer_0(data_callid, ELIMIT);
     
    17511751                        return;
    17521752                }
    1753                
     1753
    17541754                address_list = malloc(length);
    17551755                if (address_list == NULL) {
     
    17581758                        return;
    17591759                }
    1760                
     1760
    17611761                if (async_data_write_finalize(data_callid, address_list,
    17621762                    length) != EOK) {
     
    17661766                }
    17671767        }
    1768        
     1768
    17691769        if (nic_iface->unicast_set_mode != NULL) {
    17701770                errno_t rc = nic_iface->unicast_set_mode(dev, mode, address_list,
     
    17731773        } else
    17741774                async_answer_0(callid, ENOTSUP);
    1775        
     1775
    17761776        free(address_list);
    17771777}
     
    17851785                return;
    17861786        }
    1787        
     1787
    17881788        size_t max_count = IPC_GET_ARG2(*call);
    17891789        nic_address_t *address_list = NULL;
    1790        
     1790
    17911791        if (max_count != 0) {
    17921792                address_list = malloc(max_count * sizeof(nic_address_t));
     
    17961796                }
    17971797        }
    1798        
     1798
    17991799        memset(address_list, 0, max_count * sizeof(nic_address_t));
    18001800        nic_multicast_mode_t mode = NIC_MULTICAST_BLOCKED;
    18011801        size_t address_count = 0;
    1802        
     1802
    18031803        errno_t rc = nic_iface->multicast_get_mode(dev, &mode, max_count, address_list,
    18041804            &address_count);
    1805        
    1806        
     1805
     1806
    18071807        if ((rc != EOK) || (max_count == 0) || (address_count == 0)) {
    18081808                free(address_list);
     
    18101810                return;
    18111811        }
    1812        
     1812
    18131813        ipc_callid_t data_callid;
    18141814        size_t max_len;
     
    18191819                return;
    18201820        }
    1821        
     1821
    18221822        if (max_len > address_count * sizeof(nic_address_t))
    18231823                max_len = address_count * sizeof(nic_address_t);
    1824        
     1824
    18251825        if (max_len > max_count * sizeof(nic_address_t))
    18261826                max_len = max_count * sizeof(nic_address_t);
    1827        
     1827
    18281828        async_data_read_finalize(data_callid, address_list, max_len);
    1829        
     1829
    18301830        free(address_list);
    18311831        async_answer_2(callid, rc, mode, address_count);
     
    18361836{
    18371837        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    1838        
     1838
    18391839        nic_multicast_mode_t mode = IPC_GET_ARG2(*call);
    18401840        size_t address_count = IPC_GET_ARG3(*call);
    18411841        nic_address_t *address_list = NULL;
    1842        
     1842
    18431843        if (address_count) {
    18441844                ipc_callid_t data_callid;
     
    18491849                        return;
    18501850                }
    1851                
     1851
    18521852                if (length != address_count * sizeof (nic_address_t)) {
    18531853                        async_answer_0(data_callid, ELIMIT);
     
    18551855                        return;
    18561856                }
    1857                
     1857
    18581858                address_list = malloc(length);
    18591859                if (address_list == NULL) {
     
    18621862                        return;
    18631863                }
    1864                
     1864
    18651865                if (async_data_write_finalize(data_callid, address_list,
    18661866                    length) != EOK) {
     
    18701870                }
    18711871        }
    1872        
     1872
    18731873        if (nic_iface->multicast_set_mode != NULL) {
    18741874                errno_t rc = nic_iface->multicast_set_mode(dev, mode, address_list,
     
    18771877        } else
    18781878                async_answer_0(callid, ENOTSUP);
    1879        
     1879
    18801880        free(address_list);
    18811881}
     
    18891889                return;
    18901890        }
    1891        
     1891
    18921892        nic_broadcast_mode_t mode = NIC_BROADCAST_ACCEPTED;
    1893        
     1893
    18941894        errno_t rc = nic_iface->broadcast_get_mode(dev, &mode);
    18951895        async_answer_1(callid, rc, mode);
     
    19041904                return;
    19051905        }
    1906        
     1906
    19071907        nic_broadcast_mode_t mode = IPC_GET_ARG2(*call);
    1908        
     1908
    19091909        errno_t rc = nic_iface->broadcast_set_mode(dev, mode);
    19101910        async_answer_0(callid, rc);
     
    19191919                return;
    19201920        }
    1921        
     1921
    19221922        uint32_t mode = 0;
    1923        
     1923
    19241924        errno_t rc = nic_iface->defective_get_mode(dev, &mode);
    19251925        async_answer_1(callid, rc, mode);
     
    19341934                return;
    19351935        }
    1936        
     1936
    19371937        uint32_t mode = IPC_GET_ARG2(*call);
    1938        
     1938
    19391939        errno_t rc = nic_iface->defective_set_mode(dev, mode);
    19401940        async_answer_0(callid, rc);
     
    19491949                return;
    19501950        }
    1951        
     1951
    19521952        size_t max_count = IPC_GET_ARG2(*call);
    19531953        nic_address_t *address_list = NULL;
    1954        
     1954
    19551955        if (max_count != 0) {
    19561956                address_list = malloc(max_count * sizeof(nic_address_t));
     
    19601960                }
    19611961        }
    1962        
     1962
    19631963        memset(address_list, 0, max_count * sizeof(nic_address_t));
    19641964        size_t address_count = 0;
    1965        
     1965
    19661966        errno_t rc = nic_iface->blocked_sources_get(dev, max_count, address_list,
    19671967            &address_count);
    1968        
     1968
    19691969        if ((rc != EOK) || (max_count == 0) || (address_count == 0)) {
    19701970                async_answer_1(callid, rc, address_count);
     
    19721972                return;
    19731973        }
    1974        
     1974
    19751975        ipc_callid_t data_callid;
    19761976        size_t max_len;
     
    19811981                return;
    19821982        }
    1983        
     1983
    19841984        if (max_len > address_count * sizeof(nic_address_t))
    19851985                max_len = address_count * sizeof(nic_address_t);
    1986        
     1986
    19871987        if (max_len > max_count * sizeof(nic_address_t))
    19881988                max_len = max_count * sizeof(nic_address_t);
    1989        
     1989
    19901990        async_data_read_finalize(data_callid, address_list, max_len);
    19911991        async_answer_0(data_callid, EINVAL);
    1992        
     1992
    19931993        free(address_list);
    19941994        async_answer_1(callid, rc, address_count);
     
    19991999{
    20002000        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    2001        
     2001
    20022002        size_t length;
    20032003        size_t address_count = IPC_GET_ARG2(*call);
    20042004        nic_address_t *address_list = NULL;
    2005        
     2005
    20062006        if (address_count) {
    20072007                ipc_callid_t data_callid;
     
    20112011                        return;
    20122012                }
    2013                
     2013
    20142014                if (length != address_count * sizeof(nic_address_t)) {
    20152015                        async_answer_0(data_callid, ELIMIT);
     
    20172017                        return;
    20182018                }
    2019                
     2019
    20202020                address_list = malloc(length);
    20212021                if (address_list == NULL) {
     
    20242024                        return;
    20252025                }
    2026                
     2026
    20272027                if (async_data_write_finalize(data_callid, address_list,
    20282028                    length) != EOK) {
     
    20322032                }
    20332033        }
    2034        
     2034
    20352035        if (nic_iface->blocked_sources_set != NULL) {
    20362036                errno_t rc = nic_iface->blocked_sources_set(dev, address_list,
     
    20392039        } else
    20402040                async_answer_0(callid, ENOTSUP);
    2041        
     2041
    20422042        free(address_list);
    20432043}
     
    20512051                return;
    20522052        }
    2053        
     2053
    20542054        nic_vlan_mask_t vlan_mask;
    20552055        memset(&vlan_mask, 0, sizeof(nic_vlan_mask_t));
    2056        
     2056
    20572057        errno_t rc = nic_iface->vlan_get_mask(dev, &vlan_mask);
    20582058        if (rc == EOK) {
     
    20642064                        return;
    20652065                }
    2066                
     2066
    20672067                if (max_len != sizeof(nic_vlan_mask_t)) {
    20682068                        async_answer_0(data_callid, EINVAL);
     
    20702070                        return;
    20712071                }
    2072                
     2072
    20732073                async_data_read_finalize(data_callid, &vlan_mask, max_len);
    20742074        }
    2075        
     2075
    20762076        async_answer_0(callid, rc);
    20772077}
     
    20812081{
    20822082        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    2083        
     2083
    20842084        nic_vlan_mask_t vlan_mask;
    20852085        nic_vlan_mask_t *vlan_mask_pointer = NULL;
    20862086        bool vlan_mask_set = (bool) IPC_GET_ARG2(*call);
    2087        
     2087
    20882088        if (vlan_mask_set) {
    20892089                ipc_callid_t data_callid;
     
    20942094                        return;
    20952095                }
    2096                
     2096
    20972097                if (length != sizeof(nic_vlan_mask_t)) {
    20982098                        async_answer_0(data_callid, ELIMIT);
     
    21002100                        return;
    21012101                }
    2102                
     2102
    21032103                if (async_data_write_finalize(data_callid, &vlan_mask,
    21042104                    length) != EOK) {
     
    21062106                        return;
    21072107                }
    2108                
     2108
    21092109                vlan_mask_pointer = &vlan_mask;
    21102110        }
    2111        
     2111
    21122112        if (nic_iface->vlan_set_mask != NULL) {
    21132113                errno_t rc = nic_iface->vlan_set_mask(dev, vlan_mask_pointer);
     
    21212121{
    21222122        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    2123        
     2123
    21242124        if (nic_iface->vlan_set_tag == NULL) {
    21252125                async_answer_0(callid, ENOTSUP);
    21262126                return;
    21272127        }
    2128        
     2128
    21292129        uint16_t tag = (uint16_t) IPC_GET_ARG2(*call);
    21302130        bool add = (int) IPC_GET_ARG3(*call);
    21312131        bool strip = (int) IPC_GET_ARG4(*call);
    2132        
     2132
    21332133        errno_t rc = nic_iface->vlan_set_tag(dev, tag, add, strip);
    21342134        async_answer_0(callid, rc);
     
    21392139{
    21402140        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    2141        
     2141
    21422142        int send_data = (int) IPC_GET_ARG3(*call);
    21432143        ipc_callid_t data_callid;
    2144        
     2144
    21452145        if (nic_iface->wol_virtue_add == NULL) {
    21462146                if (send_data) {
     
    21482148                        async_answer_0(data_callid, ENOTSUP);
    21492149                }
    2150                
    2151                 async_answer_0(callid, ENOTSUP);
    2152         }
    2153        
     2150
     2151                async_answer_0(callid, ENOTSUP);
     2152        }
     2153
    21542154        size_t length = 0;
    21552155        void *data = NULL;
    2156        
     2156
    21572157        if (send_data) {
    21582158                if (!async_data_write_receive(&data_callid, &length)) {
     
    21612161                        return;
    21622162                }
    2163                
     2163
    21642164                data = malloc(length);
    21652165                if (data == NULL) {
     
    21682168                        return;
    21692169                }
    2170                
     2170
    21712171                if (async_data_write_finalize(data_callid, data,
    21722172                    length) != EOK) {
     
    21762176                }
    21772177        }
    2178        
     2178
    21792179        nic_wv_id_t id = 0;
    21802180        nic_wv_type_t type = (nic_wv_type_t) IPC_GET_ARG2(*call);
    2181        
     2181
    21822182        errno_t rc = nic_iface->wol_virtue_add(dev, type, data, length, &id);
    21832183        async_answer_1(callid, rc, (sysarg_t) id);
     
    21892189{
    21902190        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    2191        
     2191
    21922192        if (nic_iface->wol_virtue_remove == NULL) {
    21932193                async_answer_0(callid, ENOTSUP);
    21942194                return;
    21952195        }
    2196        
     2196
    21972197        nic_wv_id_t id = (nic_wv_id_t) IPC_GET_ARG2(*call);
    2198        
     2198
    21992199        errno_t rc = nic_iface->wol_virtue_remove(dev, id);
    22002200        async_answer_0(callid, rc);
     
    22052205{
    22062206        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    2207        
     2207
    22082208        if (nic_iface->wol_virtue_probe == NULL) {
    22092209                async_answer_0(callid, ENOTSUP);
    22102210                return;
    22112211        }
    2212        
     2212
    22132213        nic_wv_id_t id = (nic_wv_id_t) IPC_GET_ARG2(*call);
    22142214        size_t max_length = IPC_GET_ARG3(*call);
     
    22172217        ipc_callid_t data_callid;
    22182218        void *data = NULL;
    2219        
     2219
    22202220        if (max_length != 0) {
    22212221                data = malloc(max_length);
     
    22252225                }
    22262226        }
    2227        
     2227
    22282228        memset(data, 0, max_length);
    2229        
     2229
    22302230        errno_t rc = nic_iface->wol_virtue_probe(dev, id, &type, max_length,
    22312231            data, &length);
    2232        
     2232
    22332233        if ((max_length != 0) && (length != 0)) {
    22342234                size_t req_length;
     
    22392239                        return;
    22402240                }
    2241                
     2241
    22422242                if (req_length > length)
    22432243                        req_length = length;
    2244                
     2244
    22452245                if (req_length > max_length)
    22462246                        req_length = max_length;
    2247                
     2247
    22482248                async_data_read_finalize(data_callid, data, req_length);
    22492249        }
    2250        
     2250
    22512251        async_answer_2(callid, rc, (sysarg_t) type, (sysarg_t) length);
    22522252        free(data);
     
    22612261                return;
    22622262        }
    2263        
     2263
    22642264        nic_wv_type_t type = (nic_wv_type_t) IPC_GET_ARG2(*call);
    22652265        size_t max_count = IPC_GET_ARG3(*call);
     
    22672267        nic_wv_id_t *id_list = NULL;
    22682268        ipc_callid_t data_callid;
    2269        
     2269
    22702270        if (max_count != 0) {
    22712271                id_list = malloc(max_count * sizeof(nic_wv_id_t));
     
    22752275                }
    22762276        }
    2277        
     2277
    22782278        memset(id_list, 0, max_count * sizeof (nic_wv_id_t));
    2279        
     2279
    22802280        errno_t rc = nic_iface->wol_virtue_list(dev, type, max_count, id_list,
    22812281            &count);
    2282        
     2282
    22832283        if ((max_count != 0) && (count != 0)) {
    22842284                size_t req_length;
     
    22892289                        return;
    22902290                }
    2291                
     2291
    22922292                if (req_length > count * sizeof(nic_wv_id_t))
    22932293                        req_length = count * sizeof(nic_wv_id_t);
    2294                
     2294
    22952295                if (req_length > max_count * sizeof(nic_wv_id_t))
    22962296                        req_length = max_count * sizeof(nic_wv_id_t);
    2297                
     2297
    22982298                rc = async_data_read_finalize(data_callid, id_list, req_length);
    22992299        }
    2300        
     2300
    23012301        async_answer_1(callid, rc, (sysarg_t) count);
    23022302        free(id_list);
     
    23112311                return;
    23122312        }
    2313        
     2313
    23142314        int count = -1;
    23152315        nic_wv_type_t type = (nic_wv_type_t) IPC_GET_ARG2(*call);
    2316        
     2316
    23172317        errno_t rc = nic_iface->wol_virtue_get_caps(dev, type, &count);
    23182318        async_answer_1(callid, rc, (sysarg_t) count);
     
    23272327                return;
    23282328        }
    2329        
     2329
    23302330        size_t max_length = (size_t) IPC_GET_ARG2(*call);
    23312331        size_t frame_length = 0;
    23322332        nic_wv_type_t type = NIC_WV_NONE;
    23332333        uint8_t *data = NULL;
    2334        
     2334
    23352335        if (max_length != 0) {
    23362336                data = malloc(max_length);
     
    23402340                }
    23412341        }
    2342        
     2342
    23432343        memset(data, 0, max_length);
    2344        
     2344
    23452345        errno_t rc = nic_iface->wol_load_info(dev, &type, max_length, data,
    23462346            &frame_length);
     
    23542354                        return;
    23552355                }
    2356                
     2356
    23572357                req_length = req_length > max_length ? max_length : req_length;
    23582358                req_length = req_length > frame_length ? frame_length : req_length;
    23592359                async_data_read_finalize(data_callid, data, req_length);
    23602360        }
    2361        
     2361
    23622362        async_answer_2(callid, rc, (sysarg_t) type, (sysarg_t) frame_length);
    23632363        free(data);
     
    23722372                return;
    23732373        }
    2374        
     2374
    23752375        uint32_t supported = 0;
    23762376        uint32_t active = 0;
    2377        
     2377
    23782378        errno_t rc = nic_iface->offload_probe(dev, &supported, &active);
    23792379        async_answer_2(callid, rc, supported, active);
     
    23882388                return;
    23892389        }
    2390        
     2390
    23912391        uint32_t mask = (uint32_t) IPC_GET_ARG2(*call);
    23922392        uint32_t active = (uint32_t) IPC_GET_ARG3(*call);
    2393        
     2393
    23942394        errno_t rc = nic_iface->offload_set(dev, mask, active);
    23952395        async_answer_0(callid, rc);
     
    24042404                return;
    24052405        }
    2406        
     2406
    24072407        nic_poll_mode_t mode = NIC_POLL_IMMEDIATE;
    24082408        int request_data = IPC_GET_ARG2(*call);
     
    24112411                .tv_usec = 0
    24122412        };
    2413        
     2413
    24142414        errno_t rc = nic_iface->poll_get_mode(dev, &mode, &period);
    24152415        if ((rc == EOK) && (request_data)) {
    24162416                size_t max_len;
    24172417                ipc_callid_t data_callid;
    2418                
     2418
    24192419                if (!async_data_read_receive(&data_callid, &max_len)) {
    24202420                        async_answer_0(data_callid, EINVAL);
     
    24222422                        return;
    24232423                }
    2424                
     2424
    24252425                if (max_len != sizeof(struct timeval)) {
    24262426                        async_answer_0(data_callid, ELIMIT);
     
    24282428                        return;
    24292429                }
    2430                
     2430
    24312431                async_data_read_finalize(data_callid, &period,
    24322432                    sizeof(struct timeval));
    24332433        }
    2434        
     2434
    24352435        async_answer_1(callid, rc, (sysarg_t) mode);
    24362436}
     
    24402440{
    24412441        nic_iface_t *nic_iface = (nic_iface_t *) iface;
    2442        
     2442
    24432443        nic_poll_mode_t mode = IPC_GET_ARG2(*call);
    24442444        int has_period = IPC_GET_ARG3(*call);
     
    24462446        struct timeval *period = NULL;
    24472447        size_t length;
    2448        
     2448
    24492449        if (has_period) {
    24502450                ipc_callid_t data_callid;
     
    24542454                        return;
    24552455                }
    2456                
     2456
    24572457                if (length != sizeof(struct timeval)) {
    24582458                        async_answer_0(data_callid, ELIMIT);
     
    24602460                        return;
    24612461                }
    2462                
     2462
    24632463                period = &period_buf;
    24642464                if (async_data_write_finalize(data_callid, period,
     
    24682468                }
    24692469        }
    2470        
     2470
    24712471        if (nic_iface->poll_set_mode != NULL) {
    24722472                errno_t rc = nic_iface->poll_set_mode(dev, mode, period);
     
    24842484                return;
    24852485        }
    2486        
     2486
    24872487        errno_t rc = nic_iface->poll_now(dev);
    24882488        async_answer_0(callid, rc);
Note: See TracChangeset for help on using the changeset viewer.