summaryrefslogtreecommitdiffstats
path: root/sys/net/if_llatbl.h
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2015-08-11 09:26:11 +0000
committermelifaro <melifaro@FreeBSD.org>2015-08-11 09:26:11 +0000
commitd8f92ce2cfe8b9c73a429016a0fa82c19a19230a (patch)
tree6aacce2cd02cc4b0168ccde30e8ce8827ae45bc1 /sys/net/if_llatbl.h
parent84344d1daa9b49c850b25076f2c93ed3210b0d2e (diff)
downloadFreeBSD-src-d8f92ce2cfe8b9c73a429016a0fa82c19a19230a.zip
FreeBSD-src-d8f92ce2cfe8b9c73a429016a0fa82c19a19230a.tar.gz
Store addresses instead of sockaddrs inside llentry.
This permits us having all (not fully true yet) all the info needed in lookup process in first 64 bytes of 'struct llentry'. struct llentry layout: BEFORE: [rwlock .. state .. state .. MAC ] (lle+1) [sockaddr_in[6]] AFTER [ in[6]_addr MAC .. state .. rwlock ] Currently, address part of struct llentry has only 16 bytes for the key. However, lltable does not restrict any custom lltable consumers with long keys use the previous approach (store key at (lle+1)). Sponsored by: Yandex LLC
Diffstat (limited to 'sys/net/if_llatbl.h')
-rw-r--r--sys/net/if_llatbl.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h
index 084f61c..3f2a08d 100644
--- a/sys/net/if_llatbl.h
+++ b/sys/net/if_llatbl.h
@@ -54,7 +54,18 @@ extern struct rwlock lltable_rwlock;
*/
struct llentry {
LIST_ENTRY(llentry) lle_next;
- struct rwlock lle_lock;
+ union {
+ struct in_addr addr4;
+ struct in6_addr addr6;
+ } r_l3addr;
+ union {
+ uint64_t mac_aligned;
+ uint16_t mac16[3];
+ uint8_t mac8[20]; /* IB needs 20 bytes. */
+ } ll_addr;
+ uint32_t spare0;
+ uint64_t spare1;
+
struct lltable *lle_tbl;
struct llentries *lle_head;
void (*lle_free)(struct llentry *);
@@ -70,19 +81,13 @@ struct llentry {
time_t ln_ntick;
int lle_refcnt;
- union {
- uint64_t mac_aligned;
- uint16_t mac16[3];
- uint8_t mac8[20]; /* IB needs 20 bytes. */
- } ll_addr;
-
LIST_ENTRY(llentry) lle_chain; /* chain of deleted items */
/* XXX af-private? */
union {
struct callout ln_timer_ch;
struct callout la_timer;
} lle_timer;
- /* NB: struct sockaddr must immediately follow */
+ struct rwlock lle_lock;
};
#define LLE_WLOCK(lle) rw_wlock(&(lle)->lle_lock)
@@ -133,11 +138,6 @@ struct llentry {
#define ln_timer_ch lle_timer.ln_timer_ch
#define la_timer lle_timer.la_timer
-/* XXX bad name */
-#define L3_CADDR(lle) ((const struct sockaddr *)(&lle[1]))
-#define L3_ADDR(lle) ((struct sockaddr *)(&lle[1]))
-#define L3_ADDR_LEN(lle) (((struct sockaddr *)(&lle[1]))->sa_len)
-
typedef struct llentry *(llt_lookup_t)(struct lltable *, u_int flags,
const struct sockaddr *l3addr);
typedef struct llentry *(llt_create_t)(struct lltable *, u_int flags,
OpenPOWER on IntegriCloud