Lines Matching full:vif
35 static void xenvif_add_hash(struct xenvif *vif, const u8 *tag, in xenvif_add_hash() argument
50 spin_lock_irqsave(&vif->hash.cache.lock, flags); in xenvif_add_hash()
54 list_for_each_entry_rcu(entry, &vif->hash.cache.list, link, in xenvif_add_hash()
55 lockdep_is_held(&vif->hash.cache.lock)) { in xenvif_add_hash()
65 new->seq = atomic_inc_return(&vif->hash.cache.seq); in xenvif_add_hash()
66 list_add_rcu(&new->link, &vif->hash.cache.list); in xenvif_add_hash()
68 if (++vif->hash.cache.count > xenvif_hash_cache_size) { in xenvif_add_hash()
70 vif->hash.cache.count--; in xenvif_add_hash()
75 spin_unlock_irqrestore(&vif->hash.cache.lock, flags); in xenvif_add_hash()
81 static u32 xenvif_new_hash(struct xenvif *vif, const u8 *data, in xenvif_new_hash() argument
86 val = xen_netif_toeplitz_hash(vif->hash.key, in xenvif_new_hash()
87 sizeof(vif->hash.key), in xenvif_new_hash()
91 xenvif_add_hash(vif, data, len, val); in xenvif_new_hash()
96 static void xenvif_flush_hash(struct xenvif *vif) in xenvif_flush_hash() argument
104 spin_lock_irqsave(&vif->hash.cache.lock, flags); in xenvif_flush_hash()
106 list_for_each_entry_safe(entry, n, &vif->hash.cache.list, link) { in xenvif_flush_hash()
108 vif->hash.cache.count--; in xenvif_flush_hash()
112 spin_unlock_irqrestore(&vif->hash.cache.lock, flags); in xenvif_flush_hash()
115 static u32 xenvif_find_hash(struct xenvif *vif, const u8 *data, in xenvif_find_hash() argument
126 return xenvif_new_hash(vif, data, len); in xenvif_find_hash()
132 list_for_each_entry_rcu(entry, &vif->hash.cache.list, link) { in xenvif_find_hash()
136 entry->seq = atomic_inc_return(&vif->hash.cache.seq); in xenvif_find_hash()
145 val = xenvif_new_hash(vif, data, len); in xenvif_find_hash()
150 void xenvif_set_skb_hash(struct xenvif *vif, struct sk_buff *skb) in xenvif_set_skb_hash() argument
155 u32 flags = vif->hash.flags; in xenvif_set_skb_hash()
199 hash = xenvif_find_hash(vif, data, sizeof(data)); in xenvif_set_skb_hash()
207 hash = xenvif_find_hash(vif, data, sizeof(data)); in xenvif_set_skb_hash()
223 hash = xenvif_find_hash(vif, data, sizeof(data)); in xenvif_set_skb_hash()
231 hash = xenvif_find_hash(vif, data, sizeof(data)); in xenvif_set_skb_hash()
245 u32 xenvif_set_hash_alg(struct xenvif *vif, u32 alg) in xenvif_set_hash_alg() argument
256 vif->hash.alg = alg; in xenvif_set_hash_alg()
261 u32 xenvif_get_hash_flags(struct xenvif *vif, u32 *flags) in xenvif_get_hash_flags() argument
263 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) in xenvif_get_hash_flags()
274 u32 xenvif_set_hash_flags(struct xenvif *vif, u32 flags) in xenvif_set_hash_flags() argument
282 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) in xenvif_set_hash_flags()
285 vif->hash.flags = flags; in xenvif_set_hash_flags()
290 u32 xenvif_set_hash_key(struct xenvif *vif, u32 gref, u32 len) in xenvif_set_hash_key() argument
292 u8 *key = vif->hash.key; in xenvif_set_hash_key()
295 .source.domid = vif->domid, in xenvif_set_hash_key()
317 xenvif_flush_hash(vif); in xenvif_set_hash_key()
322 u32 xenvif_set_hash_mapping_size(struct xenvif *vif, u32 size) in xenvif_set_hash_mapping_size() argument
327 vif->hash.size = size; in xenvif_set_hash_mapping_size()
328 memset(vif->hash.mapping[vif->hash.mapping_sel], 0, in xenvif_set_hash_mapping_size()
334 u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 gref, u32 len, in xenvif_set_hash_mapping() argument
337 u32 *mapping = vif->hash.mapping[!vif->hash.mapping_sel]; in xenvif_set_hash_mapping()
341 .source.domid = vif->domid, in xenvif_set_hash_mapping()
347 if ((off + len < off) || (off + len > vif->hash.size) || in xenvif_set_hash_mapping()
363 memcpy(mapping, vif->hash.mapping[vif->hash.mapping_sel], in xenvif_set_hash_mapping()
364 vif->hash.size * sizeof(*mapping)); in xenvif_set_hash_mapping()
375 if (mapping[off++] >= vif->num_queues) in xenvif_set_hash_mapping()
378 vif->hash.mapping_sel = !vif->hash.mapping_sel; in xenvif_set_hash_mapping()
384 void xenvif_dump_hash_info(struct xenvif *vif, struct seq_file *m) in xenvif_dump_hash_info() argument
388 switch (vif->hash.alg) { in xenvif_dump_hash_info()
400 if (vif->hash.flags) { in xenvif_dump_hash_info()
403 if (vif->hash.flags & XEN_NETIF_CTRL_HASH_TYPE_IPV4) in xenvif_dump_hash_info()
405 if (vif->hash.flags & XEN_NETIF_CTRL_HASH_TYPE_IPV4_TCP) in xenvif_dump_hash_info()
407 if (vif->hash.flags & XEN_NETIF_CTRL_HASH_TYPE_IPV6) in xenvif_dump_hash_info()
409 if (vif->hash.flags & XEN_NETIF_CTRL_HASH_TYPE_IPV6_TCP) in xenvif_dump_hash_info()
425 seq_printf(m, "%02x ", vif->hash.key[i]); in xenvif_dump_hash_info()
430 if (vif->hash.size != 0) { in xenvif_dump_hash_info()
431 const u32 *mapping = vif->hash.mapping[vif->hash.mapping_sel]; in xenvif_dump_hash_info()
435 for (i = 0; i < vif->hash.size; ) { in xenvif_dump_hash_info()
439 if (i + n >= vif->hash.size) in xenvif_dump_hash_info()
440 n = vif->hash.size - i; in xenvif_dump_hash_info()
453 void xenvif_init_hash(struct xenvif *vif) in xenvif_init_hash() argument
458 BUG_ON(vif->hash.cache.count); in xenvif_init_hash()
460 spin_lock_init(&vif->hash.cache.lock); in xenvif_init_hash()
461 INIT_LIST_HEAD(&vif->hash.cache.list); in xenvif_init_hash()
464 void xenvif_deinit_hash(struct xenvif *vif) in xenvif_deinit_hash() argument
466 xenvif_flush_hash(vif); in xenvif_deinit_hash()