clip_tbl.h 1.3 KB

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