瀏覽代碼

core: Add mapv5 command changes

Add support for the new mapv5 command format which has to be
used for commands on default channel on uplink. mapv1 commands need
to be sent on the command channel only on uplink.

Additionally, update the dfc trace print format.

CRs-Fixed: 3214110
Change-Id: Ifed7d90d79b6f17d4104a26907667801f04040ce
Signed-off-by: Subash Abhinov Kasiviswanathan <[email protected]>
Subash Abhinov Kasiviswanathan 3 年之前
父節點
當前提交
b175518950
共有 3 個文件被更改,包括 47 次插入19 次删除
  1. 8 4
      core/dfc.h
  2. 35 13
      core/dfc_qmap.c
  3. 4 2
      core/rmnet_qmap.c

+ 8 - 4
core/dfc.h

@@ -1,4 +1,5 @@
 /* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -248,25 +249,28 @@ TRACE_EVENT(dfc_tx_link_status_ind,
 
 TRACE_EVENT(dfc_qmap,
 
-	TP_PROTO(const void *data, size_t len, bool in),
+	TP_PROTO(const void *data, size_t len, bool in, u8 chn),
 
-	TP_ARGS(data, len, in),
+	TP_ARGS(data, len, in, chn),
 
 	TP_STRUCT__entry(
 		__field(bool, in)
 		__field(size_t, len)
 		__dynamic_array(u8, data, len)
+		__field(u8, chn)
 	),
 
 	TP_fast_assign(
 		__entry->in = in;
 		__entry->len = len;
 		memcpy(__get_dynamic_array(data), data, len);
+		__entry->chn = chn;
 	),
 
-	TP_printk("%s [%s]",
+	TP_printk("[0x%02x] %s %s", __entry->chn,
 		__entry->in ? "<--" : "-->",
-		__print_hex(__get_dynamic_array(data), __entry->len))
+		__print_array(__get_dynamic_array(data), __entry->len,
+			      sizeof(u8)))
 );
 
 TRACE_EVENT(dfc_adjust_grant,

+ 35 - 13
core/dfc_qmap.c

@@ -11,6 +11,7 @@
 #include "rmnet_qmi.h"
 #include "qmi_rmnet.h"
 #include "dfc.h"
+#include "rmnet_map.h"
 
 #define QMAP_DFC_VER		1
 
@@ -91,6 +92,31 @@ struct qmap_dfc_end_marker_cnf {
 	u32			reserved4;
 } __aligned(1);
 
+struct qmapv5_cmd_hdr {
+	u8	pad_len:6;
+	u8	next_hdr:1;
+	u8	cd_bit:1;
+	u8	mux_id;
+	__be16	pkt_len;
+	struct rmnet_map_v5_csum_header csum_hdr;
+	u8	cmd_name;
+	u8	cmd_type:2;
+	u8	reserved:6;
+	u16	reserved2;
+	__be32	tx_id;
+} __aligned(1);
+
+struct qmapv5_dfc_end_marker_cnf {
+	struct qmapv5_cmd_hdr	hdr;
+	u8			cmd_ver;
+	u8			reserved;
+	u8			bearer_id;
+	u8			reserved2;
+	u16			reserved3;
+	__be16			seq_num;
+	u32			reserved4;
+} __aligned(1);
+
 struct qmap_dfc_powersave_req {
 	struct qmap_cmd_hdr	hdr;
 	u8			cmd_ver;
@@ -254,7 +280,6 @@ static int dfc_qmap_handle_end_marker_req(struct dfc_qmi_data *dfc,
 		return QMAP_CMD_INVALID;
 
 	cmd = (struct qmap_dfc_end_marker_req *)skb->data;
-
 	return dfc_qmap_set_end_marker(dfc, cmd->hdr.mux_id, cmd->bearer_id,
 				       ntohs(cmd->seq_num),
 				       ntohl(cmd->hdr.tx_id));
@@ -372,19 +397,23 @@ static void dfc_qmap_send_end_marker_cnf(struct qos_info *qos,
 					 u16 seq, u32 tx_id)
 {
 	struct sk_buff *skb;
-	struct qmap_dfc_end_marker_cnf *em_cnf;
-	unsigned int len = sizeof(struct qmap_dfc_end_marker_cnf);
+	struct qmapv5_dfc_end_marker_cnf *em_cnf;
+	unsigned int len = sizeof(struct qmapv5_dfc_end_marker_cnf);
 
 	skb = alloc_skb(len, GFP_ATOMIC);
 	if (!skb)
 		return;
 
-	em_cnf = (struct qmap_dfc_end_marker_cnf *)skb_put(skb, len);
+	em_cnf = (struct qmapv5_dfc_end_marker_cnf *)skb_put(skb, len);
 	memset(em_cnf, 0, len);
 
 	em_cnf->hdr.cd_bit = 1;
+	em_cnf->hdr.next_hdr = 1;
 	em_cnf->hdr.mux_id = qos->mux_id;
-	em_cnf->hdr.pkt_len = htons(len - QMAP_HDR_LEN);
+	em_cnf->hdr.pkt_len = htons(len -
+				    (QMAP_HDR_LEN +
+				     sizeof(struct rmnet_map_v5_csum_header)));
+	em_cnf->hdr.csum_hdr.header_type = RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD;
 	em_cnf->hdr.cmd_name = QMAP_DFC_END_MARKER;
 	em_cnf->hdr.cmd_type = QMAP_CMD_ACK;
 	em_cnf->hdr.tx_id = htonl(tx_id);
@@ -393,14 +422,7 @@ static void dfc_qmap_send_end_marker_cnf(struct qos_info *qos,
 	em_cnf->bearer_id = bearer->bearer_id;
 	em_cnf->seq_num = htons(seq);
 
-	/* This cmd needs to be sent in-band after data on the currnet
-	 * channel. But due to IPA bug, it cannot be sent over LLC so send
-	 * it over QMAP channel if current channel is LLC.
-	 */
-	if (bearer->ch_switch.current_ch == RMNET_CH_DEFAULT)
-		rmnet_qmap_send(skb, bearer->ch_switch.current_ch, true);
-	else
-		rmnet_qmap_send(skb, RMNET_CH_CTL, false);
+	rmnet_qmap_send(skb, bearer->ch_switch.current_ch, true);
 }
 
 static int dfc_qmap_send_powersave(u8 enable, u8 num_bearers, u8 *bearer_id)

+ 4 - 2
core/rmnet_qmap.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -24,7 +25,7 @@ static struct rmnet_ctl_client_if *rmnet_ctl;
 
 int rmnet_qmap_send(struct sk_buff *skb, u8 ch, bool flush)
 {
-	trace_dfc_qmap(skb->data, skb->len, false);
+	trace_dfc_qmap(skb->data, skb->len, false, ch);
 
 	if (ch != RMNET_CH_CTL && real_data_dev) {
 		skb->protocol = htons(ETH_P_MAP);
@@ -43,6 +44,7 @@ int rmnet_qmap_send(struct sk_buff *skb, u8 ch, bool flush)
 
 	return 0;
 }
+EXPORT_SYMBOL(rmnet_qmap_send);
 
 static void rmnet_qmap_cmd_handler(struct sk_buff *skb)
 {
@@ -52,7 +54,7 @@ static void rmnet_qmap_cmd_handler(struct sk_buff *skb)
 	if (!skb)
 		return;
 
-	trace_dfc_qmap(skb->data, skb->len, true);
+	trace_dfc_qmap(skb->data, skb->len, true, RMNET_CH_CTL);
 
 	if (skb->len < sizeof(struct qmap_cmd_hdr))
 		goto free_skb;