Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 0a087ae in mainline


Ignore:
Timestamp:
2018-05-30T20:42:58Z (3 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
0d3bfb9e
Parents:
211b17a1
Message:

Add basic nic_iface_t ops for virtio-net

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/virtio-net/virtio-net.c

    r211b17a1 r0a087ae  
    295295}
    296296
    297 static nic_iface_t virtio_net_nic_iface;
     297static errno_t virtio_net_get_device_info(ddf_fun_t *fun,
     298    nic_device_info_t *info)
     299{
     300        nic_t *nic_data = nic_get_from_ddf_fun(fun);
     301        if (!nic_data)
     302                return ENOENT;
     303
     304        str_cpy(info->vendor_name, sizeof(info->vendor_name), "Red Hat, Inc.");
     305        str_cpy(info->model_name, sizeof(info->model_name),
     306            "Virtio network device");
     307
     308        return EOK;
     309}
     310
     311static errno_t virtio_net_get_cable_state(ddf_fun_t *fun,
     312    nic_cable_state_t *state)
     313{
     314        *state = NIC_CS_PLUGGED;
     315        return EOK;
     316}
     317
     318static errno_t virtio_net_get_operation_mode(ddf_fun_t *fun, int *speed,
     319    nic_channel_mode_t *duplex, nic_role_t *role)
     320{
     321        *speed = 1000;
     322        *duplex = NIC_CM_FULL_DUPLEX;
     323        *role = NIC_ROLE_UNKNOWN;
     324        return EOK;
     325}
     326
     327static nic_iface_t virtio_net_nic_iface = {
     328        .get_device_info = virtio_net_get_device_info,
     329        .get_cable_state = virtio_net_get_cable_state,
     330        .get_operation_mode = virtio_net_get_operation_mode,
     331};
    298332
    299333int main(void)
Note: See TracChangeset for help on using the changeset viewer.