Browse Source

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
Azmath Mohammed 3 years ago
parent
commit
6f54fca3a9
4 changed files with 276 additions and 0 deletions
  1. 122 0
      qdf/inc/qdf_nbuf.h
  2. 15 0
      qdf/inc/qdf_net_types.h
  3. 124 0
      qdf/linux/src/i_qdf_nbuf.h
  4. 15 0
      qdf/linux/src/i_qdf_net_types.h

+ 122 - 0
qdf/inc/qdf_nbuf.h

@@ -1054,6 +1054,11 @@ enum cb_ftype {
  */
 typedef __qdf_nbuf_t qdf_nbuf_t;
 
+/**
+ * @qdf_nbuf_shared_info_t- Platform indepedent shared info
+ */
+typedef __qdf_nbuf_shared_info_t qdf_nbuf_shared_info_t;
+
 /**
  * struct qdf_nbuf_track_t - Network buffer track structure
  *
@@ -3000,6 +3005,17 @@ static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf)
 	return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf);
 }
 
+/**
+ * qdf_nbuf_get_shinfo() - gets the shared info of head buf
+ * @head_buf: Network buffer
+ *
+ * Return: shared info of head buf
+ */
+static inline qdf_nbuf_shared_info_t qdf_nbuf_get_shinfo(qdf_nbuf_t head_buf)
+{
+	return (qdf_nbuf_shared_info_t)__qdf_nbuf_get_shinfo(head_buf);
+}
+
 /**
  * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand
  * @buf: Network buffer
@@ -4247,6 +4263,41 @@ static inline uint16_t qdf_nbuf_get_gso_segs(qdf_nbuf_t nbuf)
 	return __qdf_nbuf_get_gso_segs(nbuf);
 }
 
+/**
+ * qdf_nbuf_set_gso_segs() - set the number of gso segments in
+ * nbuf
+ * @nbuf: Network buffer
+ * @val: val to be set
+ *
+ * Return: None
+ */
+static inline void qdf_nbuf_set_gso_segs(qdf_nbuf_t nbuf, uint16_t val)
+{
+	__qdf_nbuf_set_gso_segs(nbuf, val);
+}
+
+/**
+ * qdf_nbuf_set_gso_type_udp_l4() - set the gso type to GSO UDP L4
+ * @nbuf: Network buffer
+ *
+ * Return: None
+ */
+static inline void qdf_nbuf_set_gso_type_udp_l4(qdf_nbuf_t nbuf)
+{
+	__qdf_nbuf_set_gso_type_udp_l4(nbuf);
+}
+
+/**
+ * qdf_nbuf_set_ip_summed_partial() - set the ip summed to CHECKSUM_PARTIAL
+ * @nbuf: Network buffer
+ *
+ * Return: None
+ */
+static inline void qdf_nbuf_set_ip_summed_partial(qdf_nbuf_t nbuf)
+{
+	__qdf_nbuf_set_ip_summed_partial(nbuf);
+}
+
 /**
  * qdf_nbuf_get_gso_size() - Return the number of gso size in
  * nbuf
@@ -4685,6 +4736,77 @@ static inline qdf_size_t qdf_nbuf_get_data_len(qdf_nbuf_t nbuf)
 	return __qdf_nbuf_get_data_len(nbuf);
 }
 
+/**
+ * qdf_nbuf_set_data_len() - Return the data_len of the nbuf
+ * @nbuf: qdf_nbuf_t
+ * @len: data_len to be set
+ *
+ * Return: set data_len value
+ */
+static inline qdf_size_t qdf_nbuf_set_data_len(qdf_nbuf_t nbuf, uint32_t len)
+{
+	return __qdf_nbuf_set_data_len(nbuf, len);
+}
+
+/**
+ * qdf_nbuf_get_only_data_len() - Return the data_len of the nbuf
+ * @nbuf: qdf_nbuf_t
+ *
+ * Return: data_len value
+ */
+static inline qdf_size_t qdf_nbuf_get_only_data_len(qdf_nbuf_t nbuf)
+{
+	return __qdf_nbuf_get_only_data_len(nbuf);
+}
+
+/**
+ * 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)
+{
+	__qdf_nbuf_set_hash(buf, 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)
+{
+	__qdf_nbuf_set_sw_hash(buf, 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)
+{
+	__qdf_nbuf_set_csum_start(buf, 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)
+{
+	__qdf_nbuf_set_csum_offset(buf, len);
+}
+
 /**
  * qdf_nbuf_get_end_offset() - Return the size of the nbuf from
  * head pointer to end pointer

+ 15 - 0
qdf/inc/qdf_net_types.h

@@ -529,6 +529,21 @@ typedef struct {
 } qdf_net_nd_msg_t;
 
 
+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 __qdf_csum_tcpudp_magic(ip_saddr, ip_daddr,
+				       adj_ip_len, ip_proto, sum);
+}
+
+static inline
+uint16_t qdf_ip_fast_csum(qdf_net_iphdr_t *iph_head, uint8_t ip_hl)
+{
+	return __qdf_ip_fast_csum(iph_head, ip_hl);
+}
+
 static inline int32_t qdf_csum_ipv6(const in6_addr_t *saddr,
 				    const in6_addr_t *daddr,
 				    __u32 len, unsigned short proto,

+ 124 - 0
qdf/linux/src/i_qdf_nbuf.h

@@ -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

+ 15 - 0
qdf/linux/src/i_qdf_net_types.h

@@ -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