162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci *  This file is part of the Chelsio T4 Ethernet driver for Linux.
362306a36Sopenharmony_ci *  Copyright (C) 2003-2014 Chelsio Communications.  All rights reserved.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Written by Deepak (deepak.s@chelsio.com)
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci *  This program is distributed in the hope that it will be useful, but WITHOUT
862306a36Sopenharmony_ci *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
962306a36Sopenharmony_ci *  FITNESS FOR A PARTICULAR PURPOSE.  See the LICENSE file included in this
1062306a36Sopenharmony_ci *  release for licensing terms and conditions.
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/refcount.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct clip_entry {
1662306a36Sopenharmony_ci	spinlock_t lock;	/* Hold while modifying clip reference */
1762306a36Sopenharmony_ci	refcount_t refcnt;
1862306a36Sopenharmony_ci	struct list_head list;
1962306a36Sopenharmony_ci	union {
2062306a36Sopenharmony_ci		struct sockaddr_in addr;
2162306a36Sopenharmony_ci		struct sockaddr_in6 addr6;
2262306a36Sopenharmony_ci	};
2362306a36Sopenharmony_ci};
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_cistruct clip_tbl {
2662306a36Sopenharmony_ci	unsigned int clipt_start;
2762306a36Sopenharmony_ci	unsigned int clipt_size;
2862306a36Sopenharmony_ci	rwlock_t lock;
2962306a36Sopenharmony_ci	atomic_t nfree;
3062306a36Sopenharmony_ci	struct list_head ce_free_head;
3162306a36Sopenharmony_ci	void *cl_list;
3262306a36Sopenharmony_ci	struct list_head hash_list[];
3362306a36Sopenharmony_ci};
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_cienum {
3662306a36Sopenharmony_ci	CLIPT_MIN_HASH_BUCKETS = 2,
3762306a36Sopenharmony_ci};
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_cistruct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start,
4062306a36Sopenharmony_ci				  unsigned int clipt_end);
4162306a36Sopenharmony_ciint cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6);
4262306a36Sopenharmony_civoid cxgb4_clip_release(const struct net_device *dev, const u32 *lip, u8 v6);
4362306a36Sopenharmony_ciint clip_tbl_show(struct seq_file *seq, void *v);
4462306a36Sopenharmony_ciint cxgb4_update_root_dev_clip(struct net_device *dev);
4562306a36Sopenharmony_civoid t4_cleanup_clip_tbl(struct adapter *adap);
46