qcacmn: Implement qdf support for skb shared info

Implement qdf support for skb shared info and frag list append.
qdf macros will be used to handle skb shared info and list append.

Change-Id: I3e91bfb7a09f2e4547b3210a10919d6c84ec6567
CRs-Fixed: 3243932
This commit is contained in:
Azmath Mohammed
2022-07-14 11:53:47 +05:30
committed by Madan Koyyalamudi
parent 95865c5502
commit 6f54fca3a9
4 changed files with 276 additions and 0 deletions

View File

@@ -55,6 +55,13 @@ typedef struct sk_buff *__qdf_nbuf_t;
*/
typedef struct sk_buff_head __qdf_nbuf_queue_head_t;
/**
* typedef __qdf_nbuf_get_shinfo for skb_shinfo linux struct
*
* This is used for skb shared info via linux skb shinfo APIs
*/
typedef struct skb_shared_info *__qdf_nbuf_shared_info_t;
#define QDF_NBUF_CB_TX_MAX_OS_FRAGS 1
#define QDF_SHINFO_SIZE SKB_DATA_ALIGN(sizeof(struct skb_shared_info))
@@ -1453,6 +1460,18 @@ __qdf_nbuf_append_ext_list(struct sk_buff *skb_head,
skb_head->len += ext_len;
}
/**
* __qdf_nbuf_get_shinfo() - return the shared info of the skb
* @skb: Pointer to network buffer
*
* Return: skb shared info from head buf
*/
static inline
struct skb_shared_info *__qdf_nbuf_get_shinfo(struct sk_buff *head_buf)
{
return skb_shinfo(head_buf);
}
/**
* __qdf_nbuf_get_ext_list() - Get the link to extended nbuf list.
* @head_buf: Network buf holding head segment (single)
@@ -2722,6 +2741,77 @@ static inline qdf_size_t __qdf_nbuf_get_data_len(__qdf_nbuf_t nbuf)
return (skb_end_pointer(nbuf) - nbuf->data);
}
/**
* __qdf_nbuf_set_data_len() - Return the data_len of the nbuf
* @nbuf: qdf_nbuf_t
*
* Return: value of data_len
*/
static inline
qdf_size_t __qdf_nbuf_set_data_len(__qdf_nbuf_t nbuf, uint32_t len)
{
return nbuf->data_len = len;
}
/**
* __qdf_nbuf_get_only_data_len() - Return the data_len of the nbuf
* @nbuf: qdf_nbuf_t
*
* Return: value of data_len
*/
static inline qdf_size_t __qdf_nbuf_get_only_data_len(__qdf_nbuf_t nbuf)
{
return nbuf->data_len;
}
/**
* __qdf_nbuf_set_hash() - set the hash of the buf
* @buf: Network buf instance
* @len: len to be set
*
* Return: None
*/
static inline void __qdf_nbuf_set_hash(__qdf_nbuf_t buf, uint32_t len)
{
buf->hash = len;
}
/**
* __qdf_nbuf_set_sw_hash() - set the sw hash of the buf
* @buf: Network buf instance
* @len: len to be set
*
* Return: None
*/
static inline void __qdf_nbuf_set_sw_hash(__qdf_nbuf_t buf, uint32_t len)
{
buf->sw_hash = len;
}
/**
* __qdf_nbuf_set_csum_start() - set the csum start of the buf
* @buf: Network buf instance
* @len: len to be set
*
* Return: None
*/
static inline void __qdf_nbuf_set_csum_start(__qdf_nbuf_t buf, uint16_t len)
{
buf->csum_start = len;
}
/**
* __qdf_nbuf_set_csum_offset() - set the csum offset of the buf
* @buf: Network buf instance
* @len: len to be set
*
* Return: None
*/
static inline void __qdf_nbuf_set_csum_offset(__qdf_nbuf_t buf, uint16_t len)
{
buf->csum_offset = len;
}
/**
* __qdf_nbuf_get_gso_segs() - Return the number of gso segments
* @skb: Pointer to network buffer
@@ -2733,6 +2823,40 @@ static inline uint16_t __qdf_nbuf_get_gso_segs(struct sk_buff *skb)
return skb_shinfo(skb)->gso_segs;
}
/**
* __qdf_nbuf_set_gso_segs() - set the number of gso segments
* @skb: Pointer to network buffer
* @val: val to be set
*
* Return: None
*/
static inline void __qdf_nbuf_set_gso_segs(struct sk_buff *skb, uint16_t val)
{
skb_shinfo(skb)->gso_segs = val;
}
/**
* __qdf_nbuf_set_gso_type_udp_l4() - set the gso type to GSO UDP L4
* @skb: Pointer to network buffer
*
* Return: None
*/
static inline void __qdf_nbuf_set_gso_type_udp_l4(struct sk_buff *skb)
{
skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
}
/**
* __qdf_nbuf_set_ip_summed_partial() - set the ip summed to CHECKSUM_PARTIAL
* @skb: Pointer to network buffer
*
* Return: None
*/
static inline void __qdf_nbuf_set_ip_summed_partial(struct sk_buff *skb)
{
skb->ip_summed = CHECKSUM_PARTIAL;
}
/**
* __qdf_nbuf_get_gso_size() - Return the number of gso size
* @skb: Pointer to network buffer

View File

@@ -47,6 +47,21 @@ static inline char *__qdf_netdev_get_devname(qdf_netdev_t dev)
return dev->name;
}
static inline
__sum16 __qdf_csum_tcpudp_magic(uint32_t ip_saddr, uint32_t ip_daddr,
uint16_t adj_ip_len, uint8_t ip_proto,
uint32_t sum)
{
return csum_tcpudp_magic(ip_saddr, ip_daddr,
adj_ip_len, ip_proto, sum);
}
static inline
uint16_t __qdf_ip_fast_csum(void *ip_hdr, uint8_t ip_hl)
{
return ip_fast_csum((struct iphdr *)ip_hdr, ip_hl);
}
#define __QDF_TCPHDR_FIN TCPHDR_FIN
#define __QDF_TCPHDR_SYN TCPHDR_SYN
#define __QDF_TCPHDR_RST TCPHDR_RST