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

Changeset b085bbaa in mainline


Ignore:
Timestamp:
2018-05-24T18:43:24Z (3 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
211b17a1
Parents:
cede6f8
git-author:
Jakub Jermar <jakub@…> (2018-05-24 18:43:19)
git-committer:
Jakub Jermar <jakub@…> (2018-05-24 18:43:24)
Message:

Organize the TX and CT buffers in free lists

Location:
uspace/drv/nic/virtio-net
Files:
2 edited

Legend:

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

    rcede6f8 rb085bbaa  
    9090}
    9191
     92static void virtio_net_create_buf_free_list(virtio_dev_t *vdev, uint16_t num,
     93    uint16_t size, uint16_t *head)
     94{
     95        for (unsigned i = 0; i < size; i++) {
     96                virtio_virtq_set_desc(vdev, num, i, 0, 0,
     97                    VIRTQ_DESC_F_NEXT, (i + 1 == size) ? -1U : i + 1);
     98        }
     99        *head = 0;
     100}
     101
    92102static errno_t virtio_net_initialize(ddf_dev_t *dev)
    93103{
     
    181191
    182192        /*
     193         * Put all TX and CT buffers on a free list
     194         */
     195        virtio_net_create_buf_free_list(vdev, TX_QUEUE_1, TX_BUFFERS,
     196            &virtio_net->tx_free_head);
     197        virtio_net_create_buf_free_list(vdev, CT_QUEUE_1, CT_BUFFERS,
     198            &virtio_net->ct_free_head);
     199
     200        /*
    183201         * Read the MAC address
    184202         */
  • uspace/drv/nic/virtio-net/virtio-net.h

    rcede6f8 rb085bbaa  
    5757        void *ct_buf[CT_BUFFERS];
    5858        uintptr_t ct_buf_p[CT_BUFFERS];
     59
     60        uint16_t tx_free_head;
     61        uint16_t ct_free_head;
    5962} virtio_net_t;
    6063
Note: See TracChangeset for help on using the changeset viewer.