18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is part of the Chelsio T4 Ethernet driver for Linux. 38c2ecf20Sopenharmony_ci * Copyright (C) 2003-2014 Chelsio Communications. All rights reserved. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Written by Deepak (deepak.s@chelsio.com) 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but WITHOUT 88c2ecf20Sopenharmony_ci * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 98c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file included in this 108c2ecf20Sopenharmony_ci * release for licensing terms and conditions. 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/refcount.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cistruct clip_entry { 168c2ecf20Sopenharmony_ci spinlock_t lock; /* Hold while modifying clip reference */ 178c2ecf20Sopenharmony_ci refcount_t refcnt; 188c2ecf20Sopenharmony_ci struct list_head list; 198c2ecf20Sopenharmony_ci union { 208c2ecf20Sopenharmony_ci struct sockaddr_in addr; 218c2ecf20Sopenharmony_ci struct sockaddr_in6 addr6; 228c2ecf20Sopenharmony_ci }; 238c2ecf20Sopenharmony_ci}; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistruct clip_tbl { 268c2ecf20Sopenharmony_ci unsigned int clipt_start; 278c2ecf20Sopenharmony_ci unsigned int clipt_size; 288c2ecf20Sopenharmony_ci rwlock_t lock; 298c2ecf20Sopenharmony_ci atomic_t nfree; 308c2ecf20Sopenharmony_ci struct list_head ce_free_head; 318c2ecf20Sopenharmony_ci void *cl_list; 328c2ecf20Sopenharmony_ci struct list_head hash_list[]; 338c2ecf20Sopenharmony_ci}; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cienum { 368c2ecf20Sopenharmony_ci CLIPT_MIN_HASH_BUCKETS = 2, 378c2ecf20Sopenharmony_ci}; 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_cistruct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start, 408c2ecf20Sopenharmony_ci unsigned int clipt_end); 418c2ecf20Sopenharmony_ciint cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6); 428c2ecf20Sopenharmony_civoid cxgb4_clip_release(const struct net_device *dev, const u32 *lip, u8 v6); 438c2ecf20Sopenharmony_ciint clip_tbl_show(struct seq_file *seq, void *v); 448c2ecf20Sopenharmony_ciint cxgb4_update_root_dev_clip(struct net_device *dev); 458c2ecf20Sopenharmony_civoid t4_cleanup_clip_tbl(struct adapter *adap); 46