Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/nil/nil_remote.c

    r8d7ec69d r77a69ea  
    4444#include <ipc/nil.h>
    4545
     46/** Notify the network interface layer about the device state change.
     47 *
     48 * @param[in] sess      Network interface layer session.
     49 * @param[in] device_id Device identifier.
     50 * @param[in] state     New device state.
     51 *
     52 * @return EOK on success.
     53 * @return Other error codes as defined for each specific module
     54 *         device state function.
     55 *
     56 */
     57int nil_device_state_msg(async_sess_t *sess, nic_device_id_t device_id,
     58    sysarg_t state)
     59{
     60        return generic_device_state_msg_remote(sess, NET_NIL_DEVICE_STATE,
     61            device_id, state, 0);
     62}
     63
     64/** Pass the packet queue to the network interface layer.
     65 *
     66 * Process and redistribute the received packet queue to the registered
     67 * upper layers.
     68 *
     69 * @param[in] sess      Network interface layer session.
     70 * @param[in] device_id Source device identifier.
     71 * @param[in] packet    Received packet or the received packet queue.
     72 * @param[in] target    Target service. Ignored parameter.
     73 *
     74 * @return EOK on success.
     75 * @return Other error codes as defined for each specific module
     76 *         received function.
     77 *
     78 */
     79int nil_received_msg(async_sess_t *sess, nic_device_id_t device_id,
     80    void *data, size_t size)
     81{
     82        async_exch_t *exch = async_exchange_begin(sess);
     83
     84        ipc_call_t answer;
     85        aid_t req = async_send_1(exch, NET_NIL_RECEIVED, (sysarg_t) device_id,
     86            &answer);
     87        sysarg_t retval = async_data_write_start(exch, data, size);
     88
     89        async_exchange_end(exch);
     90
     91        if (retval != EOK) {
     92                async_wait_for(req, NULL);
     93                return retval;
     94        }
     95
     96        async_wait_for(req, &retval);
     97        return retval;
     98}
     99
     100/** Notify upper layers that device address has changed
     101 *
     102 */
     103int nil_addr_changed_msg(async_sess_t *sess, nic_device_id_t device_id,
     104    const nic_address_t *address)
     105{
     106        assert(sess);
     107       
     108        async_exch_t *exch = async_exchange_begin(sess);
     109       
     110        aid_t message_id = async_send_1(exch, NET_NIL_ADDR_CHANGED,
     111            (sysarg_t) device_id, NULL);
     112        int rc = async_data_write_start(exch, address, sizeof (nic_address_t));
     113       
     114        async_exchange_end(exch);
     115       
     116        sysarg_t res;
     117    async_wait_for(message_id, &res);
     118       
     119    if (rc != EOK)
     120                return rc;
     121       
     122    return (int) res;
     123}
     124
    46125int nil_device_req(async_sess_t *sess, nic_device_id_t device_id,
    47126    service_id_t sid, size_t mtu)
Note: See TracChangeset for help on using the changeset viewer.