• Jason Wang's avatar
    macvtap: eliminate linear search · 376b1aab
    Jason Wang authored
    Linear search were used in both get_slot() and macvtap_get_queue(), this is
    because:
    
    - macvtap didn't reshuffle the array of taps when create or destroy a queue, so
      when adding a new queue, macvtap must do linear search to find a location for
      the new queue. This will also complicate the TUNSETQUEUE implementation for
      multiqueue API.
    - the queue itself didn't track the queue index, so the we must do a linear
      search in the array to find the location of a existed queue.
    
    The solution is straightforward: reshuffle the array and introduce a queue_index
    to macvtap_queue.
    Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
    Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    376b1aab
macvtap.c 27.3 KB