From owner-svn-src-all@freebsd.org Mon Oct 19 11:57:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93D6EA19815; Mon, 19 Oct 2015 11:57:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E7CDB5B; Mon, 19 Oct 2015 11:57:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9JBvYWj070164; Mon, 19 Oct 2015 11:57:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9JBvYc5070159; Mon, 19 Oct 2015 11:57:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201510191157.t9JBvYc5070159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Oct 2015 11:57:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289574 - in head/sys/ofed: drivers/infiniband/core drivers/net/mlx4 include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2015 11:57:35 -0000 Author: hselasky Date: Mon Oct 19 11:57:33 2015 New Revision: 289574 URL: https://svnweb.freebsd.org/changeset/base/289574 Log: Merge LinuxKPI changes from DragonflyBSD: - Add more list related functions and macros. - Update the hlist_for_each_entry() macro to take one less argument. Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/cma.c head/sys/ofed/drivers/infiniband/core/fmr_pool.c head/sys/ofed/drivers/net/mlx4/en_netdev.c head/sys/ofed/include/linux/list.h Modified: head/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/cma.c Mon Oct 19 11:51:10 2015 (r289573) +++ head/sys/ofed/drivers/infiniband/core/cma.c Mon Oct 19 11:57:33 2015 (r289574) @@ -2400,10 +2400,9 @@ static int cma_check_port(struct rdma_bi { struct rdma_id_private *cur_id; struct sockaddr *addr, *cur_addr; - struct hlist_node *node; addr = (struct sockaddr *) &id_priv->id.route.addr.src_addr; - hlist_for_each_entry(cur_id, node, &bind_list->owners, node) { + hlist_for_each_entry(cur_id, &bind_list->owners, node) { if (id_priv == cur_id) continue; Modified: head/sys/ofed/drivers/infiniband/core/fmr_pool.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/fmr_pool.c Mon Oct 19 11:51:10 2015 (r289573) +++ head/sys/ofed/drivers/infiniband/core/fmr_pool.c Mon Oct 19 11:57:33 2015 (r289574) @@ -118,14 +118,13 @@ static inline struct ib_pool_fmr *ib_fmr { struct hlist_head *bucket; struct ib_pool_fmr *fmr; - struct hlist_node *pos; if (!pool->cache_bucket) return NULL; bucket = pool->cache_bucket + ib_fmr_hash(*page_list); - hlist_for_each_entry(fmr, pos, bucket, cache_node) + hlist_for_each_entry(fmr, bucket, cache_node) if (io_virtual_address == fmr->io_virtual_address && page_list_len == fmr->page_list_len && !memcmp(page_list, fmr->page_list, Modified: head/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Oct 19 11:51:10 2015 (r289573) +++ head/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Oct 19 11:57:33 2015 (r289574) @@ -264,11 +264,10 @@ static inline struct mlx4_en_filter * mlx4_en_filter_find(struct mlx4_en_priv *priv, __be32 src_ip, __be32 dst_ip, u8 ip_proto, __be16 src_port, __be16 dst_port) { - struct hlist_node *elem; struct mlx4_en_filter *filter; struct mlx4_en_filter *ret = NULL; - hlist_for_each_entry(filter, elem, + hlist_for_each_entry(filter, filter_hash_bucket(priv, src_ip, dst_ip, src_port, dst_port), filter_chain) { Modified: head/sys/ofed/include/linux/list.h ============================================================================== --- head/sys/ofed/include/linux/list.h Mon Oct 19 11:51:10 2015 (r289573) +++ head/sys/ofed/include/linux/list.h Mon Oct 19 11:57:33 2015 (r289574) @@ -96,6 +96,15 @@ list_del(struct list_head *entry) } static inline void +list_replace(struct list_head *old, struct list_head *new) +{ + new->next = old->next; + new->next->prev = new; + new->prev = old->prev; + new->prev->next = new; +} + +static inline void _list_add(struct list_head *new, struct list_head *prev, struct list_head *next) { @@ -119,6 +128,9 @@ list_del_init(struct list_head *entry) #define list_first_entry(ptr, type, member) \ list_entry((ptr)->next, type, member) +#define list_next_entry(ptr, member) \ + list_entry(((ptr)->member.next), typeof(*(ptr)), member) + #define list_for_each(p, head) \ for (p = (head)->next; p != (head); p = p->next) @@ -134,6 +146,15 @@ list_del_init(struct list_head *entry) n = list_entry(p->field.next, typeof(*p), field); &p->field != (h);\ p = n, n = list_entry(n->field.next, typeof(*n), field)) +#define list_for_each_entry_continue(p, h, field) \ + for (p = list_next_entry((p), field); &p->field != (h); \ + p = list_next_entry((p), field)) + +#define list_for_each_entry_safe_from(pos, n, head, member) \ + for (n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + #define list_for_each_entry_reverse(p, h, field) \ for (p = list_entry((h)->prev, typeof(*p), field); &p->field != (h); \ p = list_entry(p->field.prev, typeof(*p), field)) @@ -381,10 +402,14 @@ static inline int list_is_last(const str #define hlist_for_each_safe(p, n, head) \ for (p = (head)->first; p && ({ n = p->next; 1; }); p = n) -#define hlist_for_each_entry(tp, p, head, field) \ - for (p = (head)->first; \ - p ? (tp = hlist_entry(p, typeof(*tp), field)): NULL; p = p->next) - +#define hlist_entry_safe(ptr, type, member) \ + ((ptr) ? hlist_entry(ptr, type, member) : NULL) + +#define hlist_for_each_entry(pos, head, member) \ + for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\ + pos; \ + pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) + #define hlist_for_each_entry_continue(tp, p, field) \ for (p = (p)->next; \ p ? (tp = hlist_entry(p, typeof(*tp), field)): NULL; p = p->next) @@ -398,4 +423,8 @@ static inline int list_is_last(const str tpos = hlist_entry((pos), typeof(*(tpos)), member); 1;}); \ pos = (n)) +#define hlist_add_head_rcu(n, h) hlist_add_head(n, h) + +#define hlist_del_init_rcu(n) hlist_del_init(n) + #endif /* _LINUX_LIST_H_ */