1b5a02f50SAnish Bhatt /* 2b5a02f50SAnish Bhatt * This file is part of the Chelsio T4 Ethernet driver for Linux. 3b5a02f50SAnish Bhatt * Copyright (C) 2003-2014 Chelsio Communications. All rights reserved. 4b5a02f50SAnish Bhatt * 5b5a02f50SAnish Bhatt * Written by Deepak (deepak.s@chelsio.com) 6b5a02f50SAnish Bhatt * 7b5a02f50SAnish Bhatt * This program is distributed in the hope that it will be useful, but WITHOUT 8b5a02f50SAnish Bhatt * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9b5a02f50SAnish Bhatt * FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file included in this 10b5a02f50SAnish Bhatt * release for licensing terms and conditions. 11b5a02f50SAnish Bhatt */ 12b5a02f50SAnish Bhatt 13eaf6ab76SElena Reshetova #include <linux/refcount.h> 14eaf6ab76SElena Reshetova 15b5a02f50SAnish Bhatt struct clip_entry { 16b5a02f50SAnish Bhatt spinlock_t lock; /* Hold while modifying clip reference */ 17eaf6ab76SElena Reshetova refcount_t refcnt; 18b5a02f50SAnish Bhatt struct list_head list; 195a8eeec4SAnish Bhatt union { 205a8eeec4SAnish Bhatt struct sockaddr_in addr; 215a8eeec4SAnish Bhatt struct sockaddr_in6 addr6; 225a8eeec4SAnish Bhatt }; 23b5a02f50SAnish Bhatt }; 24b5a02f50SAnish Bhatt 25b5a02f50SAnish Bhatt struct clip_tbl { 26b5a02f50SAnish Bhatt unsigned int clipt_start; 27b5a02f50SAnish Bhatt unsigned int clipt_size; 28b5a02f50SAnish Bhatt rwlock_t lock; 29b5a02f50SAnish Bhatt atomic_t nfree; 30b5a02f50SAnish Bhatt struct list_head ce_free_head; 31b5a02f50SAnish Bhatt void *cl_list; 32*65dc2f1aSGustavo A. R. Silva struct list_head hash_list[]; 33b5a02f50SAnish Bhatt }; 34b5a02f50SAnish Bhatt 35b5a02f50SAnish Bhatt enum { 36b5a02f50SAnish Bhatt CLIPT_MIN_HASH_BUCKETS = 2, 37b5a02f50SAnish Bhatt }; 38b5a02f50SAnish Bhatt 39b5a02f50SAnish Bhatt struct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start, 40b5a02f50SAnish Bhatt unsigned int clipt_end); 41b5a02f50SAnish Bhatt int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6); 42b5a02f50SAnish Bhatt void cxgb4_clip_release(const struct net_device *dev, const u32 *lip, u8 v6); 43b5a02f50SAnish Bhatt int clip_tbl_show(struct seq_file *seq, void *v); 44b5a02f50SAnish Bhatt int cxgb4_update_root_dev_clip(struct net_device *dev); 45b5a02f50SAnish Bhatt void t4_cleanup_clip_tbl(struct adapter *adap); 46