git: 89c32dafa560 - main - LinuxKPI: skbuff: sort list header and add new (dummy) functions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 29 Jul 2022 16:17:06 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=89c32dafa560fe0e0259f14185ceefbcee3dcec6 commit 89c32dafa560fe0e0259f14185ceefbcee3dcec6 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2022-07-29 15:21:48 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2022-07-29 15:21:48 +0000 LinuxKPI: skbuff: sort list header and add new (dummy) functions While working on new and updates to drivers more skbuff changes came up. Sort out the list/prev/next header problem and add more (so far dummy) functions needed. MFC after: 1 week --- sys/compat/linuxkpi/common/include/linux/skbuff.h | 86 +++++++++++++++++++++-- sys/compat/linuxkpi/common/src/linux_skbuff.c | 2 +- 2 files changed, 80 insertions(+), 8 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h index 3caf7059dd15..d3a795344f86 100644 --- a/sys/compat/linuxkpi/common/include/linux/skbuff.h +++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h @@ -124,11 +124,15 @@ struct skb_shared_info { }; struct sk_buff { - /* XXX TODO */ - /* struct sk_buff_head */ - struct sk_buff *next; - struct sk_buff *prev; - int list; /* XXX TYPE */ + /* XXX TODO */ + union { + /* struct sk_buff_head */ + struct { + struct sk_buff *next; + struct sk_buff *prev; + }; + struct list_head list; + }; uint32_t _alloc_len; /* Length of alloc data-buf. XXX-BZ give up for truesize? */ uint32_t len; /* ? */ uint32_t data_len; /* ? If we have frags? */ @@ -266,7 +270,7 @@ skb_reserve(struct sk_buff *skb, size_t len) * front to copy data in (manually). */ static inline void * -skb_push(struct sk_buff *skb, size_t len) +__skb_push(struct sk_buff *skb, size_t len) { SKB_TRACE(skb); KASSERT(((skb->data - len) >= skb->head), ("%s: skb %p (data %p - " @@ -276,6 +280,14 @@ skb_push(struct sk_buff *skb, size_t len) return (skb->data); } +static inline void * +skb_push(struct sk_buff *skb, size_t len) +{ + + SKB_TRACE(skb); + return (__skb_push(skb, len)); +} + /* * Length of the data on the skb (without any frags)??? */ @@ -324,7 +336,7 @@ skb_headroom(struct sk_buff *skb) * the end to copy data in (manually). See also skb_put_data() below. */ static inline void * -skb_put(struct sk_buff *skb, size_t len) +__skb_put(struct sk_buff *skb, size_t len) { void *s; @@ -347,6 +359,14 @@ skb_put(struct sk_buff *skb, size_t len) return (s); } +static inline void * +skb_put(struct sk_buff *skb, size_t len) +{ + + SKB_TRACE(skb); + return (__skb_put(skb, len)); +} + /* skb_put() + copying data in. */ static inline void * skb_put_data(struct sk_buff *skb, const void *buf, size_t len) @@ -749,6 +769,13 @@ skb_frag_address(const skb_frag_t *frag) return (NULL); } +static inline void +skb_free_frag(void *frag) +{ + + SKB_TODO(); +} + static inline struct sk_buff * skb_gso_segment(struct sk_buff *skb, netdev_features_t netdev_flags) { @@ -938,4 +965,49 @@ skb_copy_from_linear_data(const struct sk_buff *skb, void *dst, size_t len) memcpy(dst, skb->data, len); } +static inline struct sk_buff * +build_skb(void *data, unsigned int fragsz) +{ + + SKB_TODO(); + return (NULL); +} + +static inline int +skb_pad(struct sk_buff *skb, int pad) +{ + + SKB_TRACE(skb); + SKB_TODO(); + return (-1); +} + +static inline void +skb_list_del_init(struct sk_buff *skb) +{ + + SKB_TRACE(skb); + SKB_TODO(); +} + +static inline void +napi_consume_skb(struct sk_buff *skb, int budget) +{ + + SKB_TRACE(skb); + SKB_TODO(); +} + +static inline bool +skb_linearize(struct sk_buff *skb) +{ + + SKB_TRACE(skb); + SKB_TODO(); + return (false); +} + +#define SKB_WITH_OVERHEAD(_s) \ + (_s) - ALIGN(sizeof(struct skb_shared_info), CACHE_LINE_SIZE) + #endif /* _LINUXKPI_LINUX_SKBUFF_H */ diff --git a/sys/compat/linuxkpi/common/src/linux_skbuff.c b/sys/compat/linuxkpi/common/src/linux_skbuff.c index fb0fcaf99239..df8e3fda8d56 100644 --- a/sys/compat/linuxkpi/common/src/linux_skbuff.c +++ b/sys/compat/linuxkpi/common/src/linux_skbuff.c @@ -258,7 +258,7 @@ DB_SHOW_COMMAND(skb, db_show_skb) db_printf("skb %p\n", skb); db_printf("\tnext %p prev %p\n", skb->next, skb->prev); - db_printf("\tlist %d\n", skb->list); + db_printf("\tlist %p\n", &skb->list); db_printf("\t_alloc_len %u len %u data_len %u truesize %u mac_len %u\n", skb->_alloc_len, skb->len, skb->data_len, skb->truesize, skb->mac_len);