Przeglądaj źródła

dataipa: ipa_eth, ipa_uc: Refactor before EMAC over GSI feature

* Changed channel tear down command to match standard naming
* Pretty code formatting

Change-Id: I523b86dd76483f40a686dd3027f2b1febea7c0dc
Signed-off-by: Eliad Ben Yishay <[email protected]>
Eliad Ben Yishay 2 lat temu
rodzic
commit
898eb15748

+ 20 - 34
drivers/platform/msm/ipa/ipa_v3/ipa_eth_i.c

@@ -189,29 +189,23 @@ static int ipa3_eth_config_uc(bool init,
 		cmd.base = dma_alloc_coherent(ipa3_ctx->uc_pdev, cmd.size,
 			&cmd.phys_base, GFP_KERNEL);
 		if (cmd.base == NULL) {
-			IPAERR("fail to get DMA memory.\n");
+			IPAERR("dma_alloc_coherent failed\n");
 			return -ENOMEM;
 		}
-		cmd_data =
-			(struct IpaHwOffloadSetUpCmdData_t_v4_0 *)cmd.base;
+		cmd_data = (struct IpaHwOffloadSetUpCmdData_t_v4_0 *)cmd.base;
 		cmd_data->protocol = protocol;
 		switch (protocol) {
 		case IPA_HW_PROTOCOL_AQC:
-			cmd_data->SetupCh_params.AqcSetupCh_params.dir =
-				dir;
-			cmd_data->SetupCh_params.AqcSetupCh_params.gsi_ch =
-				gsi_ch;
-			cmd_data->SetupCh_params.AqcSetupCh_params.aqc_ch =
-				peripheral_ch;
+			cmd_data->SetupCh_params.aqc_params.dir = dir;
+			cmd_data->SetupCh_params.aqc_params.gsi_ch = gsi_ch;
+			cmd_data->SetupCh_params.aqc_params.aqc_ch = peripheral_ch;
 			break;
 		case IPA_HW_PROTOCOL_RTK:
-			cmd_data->SetupCh_params.RtkSetupCh_params.dir =
-				dir;
-			cmd_data->SetupCh_params.RtkSetupCh_params.gsi_ch =
-				gsi_ch;
+			cmd_data->SetupCh_params.rtk_params.dir = dir;
+			cmd_data->SetupCh_params.rtk_params.gsi_ch = gsi_ch;
 			break;
 		default:
-			IPAERR("invalid protocol%d\n", protocol);
+			IPAERR("Unsupported protocol%d\n", protocol);
 		}
 		command = IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_SET_UP;
 
@@ -222,44 +216,36 @@ static int ipa3_eth_config_uc(bool init,
 		cmd.base = dma_alloc_coherent(ipa3_ctx->uc_pdev, cmd.size,
 			&cmd.phys_base, GFP_KERNEL);
 		if (cmd.base == NULL) {
-			IPAERR("fail to get DMA memory.\n");
+			IPAERR("dma_alloc_coherent failed\n");
 			return -ENOMEM;
 		}
 
-		cmd_data =
-			(struct IpaHwOffloadCommonChCmdData_t_v4_0 *)cmd.base;
+		cmd_data = (struct IpaHwOffloadCommonChCmdData_t_v4_0 *)cmd.base;
 
 		cmd_data->protocol = protocol;
 		switch (protocol) {
 		case IPA_HW_PROTOCOL_AQC:
-			cmd_data->CommonCh_params.AqcCommonCh_params.gsi_ch =
-				gsi_ch;
+			cmd_data->CommonCh_params.aqc_params.gsi_ch = gsi_ch;
 			break;
 		case IPA_HW_PROTOCOL_RTK:
-			cmd_data->CommonCh_params.RtkCommonCh_params.gsi_ch =
-				gsi_ch;
+			cmd_data->CommonCh_params.rtk_params.gsi_ch = gsi_ch;
 			break;
 		default:
-			IPAERR("invalid protocol%d\n", protocol);
+			IPAERR("Unsupported protocol%d\n", protocol);
 		}
-		cmd_data->CommonCh_params.RtkCommonCh_params.gsi_ch = gsi_ch;
-		command = IPA_CPU_2_HW_CMD_OFFLOAD_TEAR_DOWN;
+		cmd_data->CommonCh_params.rtk_params.gsi_ch = gsi_ch;
+		command = IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_TEAR_DOWN;
 	}
 
 	IPA_ACTIVE_CLIENTS_INC_SIMPLE();
 
-	result = ipa3_uc_send_cmd((u32)(cmd.phys_base),
-		command,
-		IPA_HW_2_CPU_OFFLOAD_CMD_STATUS_SUCCESS,
-		false, 10 * HZ);
-	if (result) {
+	result = ipa3_uc_send_cmd((u32)(cmd.phys_base), command,
+		IPA_HW_2_CPU_OFFLOAD_CMD_STATUS_SUCCESS, false, 10 * HZ);
+	if (result)
 		IPAERR("fail to %s uc for %s gsi channel %d\n",
-			init ? "init" : "deinit",
-			dir == IPA_ETH_RX ? "Rx" : "Tx", gsi_ch);
-	}
+			init ? "init" : "deinit", dir == IPA_ETH_RX ? "Rx" : "Tx", gsi_ch);
 
-	dma_free_coherent(ipa3_ctx->uc_pdev,
-		cmd.size, cmd.base, cmd.phys_base);
+	dma_free_coherent(ipa3_ctx->uc_pdev, cmd.size, cmd.base, cmd.phys_base);
 	IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
 
 	IPADBG("exit\n");

+ 8 - 8
drivers/platform/msm/ipa/ipa_v3/ipa_uc_ntn.c

@@ -194,7 +194,7 @@ static int ipa3_uc_send_ntn_setup_pipe_cmd(
 	int ipa_ep_idx;
 	int result = 0;
 	struct ipa_mem_buffer cmd;
-	struct Ipa3HwNtnSetUpCmdData_t *Ntn_params;
+	struct uc_channel_setup_cmd_hw_ntn *Ntn_params;
 	struct IpaHwOffloadSetUpCmdData_t *cmd_data;
 	struct IpaHwOffloadSetUpCmdData_t_v4_0 *cmd_data_v4_0;
 
@@ -237,11 +237,11 @@ static int ipa3_uc_send_ntn_setup_pipe_cmd(
 		cmd_data_v4_0 = (struct IpaHwOffloadSetUpCmdData_t_v4_0 *)
 			cmd.base;
 		cmd_data_v4_0->protocol = IPA_HW_PROTOCOL_ETH;
-		Ntn_params = &cmd_data_v4_0->SetupCh_params.NtnSetupCh_params;
+		Ntn_params = &cmd_data_v4_0->SetupCh_params.ntn_params;
 	} else {
 		cmd_data = (struct IpaHwOffloadSetUpCmdData_t *)cmd.base;
 		cmd_data->protocol = IPA_HW_PROTOCOL_ETH;
-		Ntn_params = &cmd_data->SetupCh_params.NtnSetupCh_params;
+		Ntn_params = &cmd_data->SetupCh_params.ntn_params;
 	}
 
 	if (ntn_info->smmu_enabled) {
@@ -601,7 +601,7 @@ int ipa3_tear_down_uc_offload_pipes(int ipa_ep_idx_ul,
 	struct ipa3_ep_context *ep_ul, *ep_dl;
 	struct IpaHwOffloadCommonChCmdData_t *cmd_data;
 	struct IpaHwOffloadCommonChCmdData_t_v4_0 *cmd_data_v4_0;
-	union Ipa3HwNtnCommonChCmdData_t *tear;
+	union uc_channel_teardown_cmd_hw_ntn *tear;
 	int result = 0;
 
 	IPADBG("ep_ul = %d\n", ipa_ep_idx_ul);
@@ -650,11 +650,11 @@ int ipa3_tear_down_uc_offload_pipes(int ipa_ep_idx_ul,
 		cmd_data_v4_0 = (struct IpaHwOffloadCommonChCmdData_t_v4_0 *)
 			cmd.base;
 		cmd_data_v4_0->protocol = IPA_HW_PROTOCOL_ETH;
-		tear = &cmd_data_v4_0->CommonCh_params.NtnCommonCh_params;
+		tear = &cmd_data_v4_0->CommonCh_params.ntn_params;
 	} else {
 		cmd_data = (struct IpaHwOffloadCommonChCmdData_t *)cmd.base;
 		cmd_data->protocol = IPA_HW_PROTOCOL_ETH;
-		tear = &cmd_data->CommonCh_params.NtnCommonCh_params;
+		tear = &cmd_data->CommonCh_params.ntn_params;
 	}
 
 	/* teardown the DL pipe */
@@ -668,7 +668,7 @@ int ipa3_tear_down_uc_offload_pipes(int ipa_ep_idx_ul,
 	IPADBG("dl client (ep: %d) disconnected\n", ipa_ep_idx_dl);
 	tear->params.ipa_pipe_number = ipa_ep_idx_dl;
 	result = ipa3_uc_send_cmd((u32)(cmd.phys_base),
-				IPA_CPU_2_HW_CMD_OFFLOAD_TEAR_DOWN,
+				IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_TEAR_DOWN,
 				IPA_HW_2_CPU_OFFLOAD_CMD_STATUS_SUCCESS,
 				false, 10*HZ);
 	if (result) {
@@ -689,7 +689,7 @@ int ipa3_tear_down_uc_offload_pipes(int ipa_ep_idx_ul,
 
 	tear->params.ipa_pipe_number = ipa_ep_idx_ul;
 	result = ipa3_uc_send_cmd((u32)(cmd.phys_base),
-				IPA_CPU_2_HW_CMD_OFFLOAD_TEAR_DOWN,
+				IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_TEAR_DOWN,
 				IPA_HW_2_CPU_OFFLOAD_CMD_STATUS_SUCCESS,
 				false, 10*HZ);
 	if (result) {

+ 43 - 37
drivers/platform/msm/ipa/ipa_v3/ipa_uc_offload_i.h

@@ -343,7 +343,7 @@ enum ipa3_hw_ntn_channel_errors {
 
 
 /**
- * struct Ipa3HwNtnSetUpCmdData_t  - Ntn setup command data
+ * struct uc_channel_setup_cmd_hw_ntn  - Ntn setup command data
  * @ring_base_pa: physical address of the base of the Tx/Rx NTN
  *  ring
  * @buff_pool_base_pa: physical address of the base of the Tx/Rx
@@ -358,7 +358,7 @@ enum ipa3_hw_ntn_channel_errors {
  * @data_buff_size: size of the each data buffer allocated in
  *  DDR
  */
-struct Ipa3HwNtnSetUpCmdData_t {
+struct uc_channel_setup_cmd_hw_ntn {
 	u32 ring_base_pa;
 	u32 buff_pool_base_pa;
 	u16 ntn_ring_size;
@@ -374,12 +374,12 @@ struct Ipa3HwNtnSetUpCmdData_t {
 } __packed;
 
 /**
- * struct Ipa3HwNtnCommonChCmdData_t - Structure holding the
+ * struct uc_channel_teardown_cmd_hw_ntn - Structure holding the
  * parameters for Ntn Tear down command data params
  *
  *@ipa_pipe_number: IPA pipe number. This could be Tx or an Rx pipe
  */
-union Ipa3HwNtnCommonChCmdData_t {
+union uc_channel_teardown_cmd_hw_ntn {
 	struct IpaHwNtnCommonChCmdParams_t {
 		u32  ipa_pipe_number :8;
 		u32  reserved        :24;
@@ -455,8 +455,8 @@ struct Ipa3HwStatsNTNInfoData_t {
  * the offload commands from CPU
  * @IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_SET_UP : Command to set up
  * Offload protocol's Tx/Rx Path
- * @IPA_CPU_2_HW_CMD_OFFLOAD_TEAR_DOWN : Command to tear down
- * Offload protocol's Tx/ Rx Path
+ * @IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_TEAR_DOWN : Command to tear
+ * down Offload protocol's Tx/ Rx Path
  * @IPA_CPU_2_HW_CMD_PERIPHERAL_INIT :Command to initialize peripheral
  * @IPA_CPU_2_HW_CMD_PERIPHERAL_DEINIT : Command to deinitialize peripheral
  * @IPA_CPU_2_HW_CMD_OFFLOAD_STATS_ALLOC: Command to start the
@@ -469,7 +469,7 @@ struct Ipa3HwStatsNTNInfoData_t {
 enum ipa_cpu_2_hw_offload_commands {
 	IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_SET_UP  =
 		FEATURE_ENUM_VAL(IPA_HW_FEATURE_OFFLOAD, 1),
-	IPA_CPU_2_HW_CMD_OFFLOAD_TEAR_DOWN =
+	IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_TEAR_DOWN =
 		FEATURE_ENUM_VAL(IPA_HW_FEATURE_OFFLOAD, 2),
 	IPA_CPU_2_HW_CMD_PERIPHERAL_INIT =
 		FEATURE_ENUM_VAL(IPA_HW_FEATURE_OFFLOAD, 3),
@@ -554,7 +554,8 @@ enum ipa3_hw_2_cpu_offload_cmd_resp_status {
 };
 
 /**
- * struct IpaHw11adSetupCmdData_t  - 11ad setup channel command data
+ * struct uc_channel_setup_cmd_hw_11ad  - 11ad setup channel
+ * command data
  * @dir: Direction RX/TX
  * @wifi_ch: 11ad peripheral pipe number
  * @gsi_ch: GSI Channel number
@@ -562,7 +563,7 @@ enum ipa3_hw_2_cpu_offload_cmd_resp_status {
  * @wifi_hp_addr_lsb: Head/Tail pointer absolute address
  * @wifi_hp_addr_msb: Head/Tail pointer absolute address
  */
-struct IpaHw11adSetupCmdData_t {
+struct uc_channel_setup_cmd_hw_11ad {
 	u8 dir;
 	u8 wifi_ch;
 	u8 gsi_ch;
@@ -573,12 +574,13 @@ struct IpaHw11adSetupCmdData_t {
 
 
 /**
- * struct IpaHw11adCommonChCmdData_t - 11ad tear down channel command data
+ * struct uc_channel_teardown_cmd_hw_11ad - 11ad tear down
+ * channel command data
  * @gsi_ch: GSI Channel number
  * @reserved_0: padding
  * @reserved_1: padding
  */
-struct IpaHw11adCommonChCmdData_t {
+struct uc_channel_teardown_cmd_hw_11ad {
 	u8 gsi_ch;
 	u8 reserved_0;
 	u16 reserved_1;
@@ -603,24 +605,26 @@ struct IpaHw11adDeinitCmdData_t {
 } __packed;
 
 /**
- * struct IpaHwRtkSetupCmdData_t  - rlk setup channel command data
+ * struct uc_channel_setup_cmd_hw_rtk  - rtk setup channel
+ * command data
  * @dir: Direction RX/TX
  * @gsi_ch: GSI Channel number
  * @reserved: 16 bytes padding
  */
-struct IpaHwRtkSetupCmdData_t {
+struct uc_channel_setup_cmd_hw_rtk {
 	uint8_t dir;
 	uint8_t gsi_ch;
 	uint16_t reserved;
 } __packed;
 
 /**
- * struct IpaHwRtkCommonChCmdData - rtk tear down channel command data
+ * struct uc_channel_teardown_cmd_hw_rtk - rtk tear down channel
+ * command data
  * @gsi_ch: GSI Channel number
  * @reserved_0: padding
  * @reserved_1: padding
  */
-struct IpaHwRtkCommonChCmdData_t {
+struct uc_channel_teardown_cmd_hw_rtk {
 	uint8_t gsi_ch;
 	uint8_t reserved_0;
 	uint16_t reserved_1;
@@ -645,13 +649,14 @@ struct IpaHwAQCDeinitCmdData_t {
 } __packed;
 
 /**
- * struct IpaHwAQCSetupCmdData_t - AQC setup channel command data
+ * struct uc_channel_setup_cmd_hw_aqc - AQC setup channel
+ * command data
  * @dir: Direction RX/TX
  * @aqc_ch: aqc channel number
  * @gsi_ch: GSI Channel number
  * @reserved: 8 bytes padding
  */
-struct IpaHwAQCSetupCmdData_t {
+struct uc_channel_setup_cmd_hw_aqc {
 	u8 dir;
 	u8 aqc_ch;
 	u8 gsi_ch;
@@ -659,33 +664,34 @@ struct IpaHwAQCSetupCmdData_t {
 } __packed;
 
 /**
- * struct IpaHwAQCCommonChCmdData_t - AQC tear down channel command data
+ * struct uc_channel_teardown_cmd_hw_aqc - AQC tear down channel
+ * command data
  * @gsi_ch: GSI Channel number
  * @reserved_0: padding
  * @reserved_1: padding
  */
-struct IpaHwAQCCommonChCmdData_t {
+struct uc_channel_teardown_cmd_hw_aqc {
 	u8 gsi_ch;
 	u8 reserved_0;
 	u16 reserved_1;
 } __packed;
 
 /**
- * struct IpaHwSetUpCmd  - Structure holding the parameters
- * for IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_SET_UP
+ * struct uc_channel_setup_cmd_hw  - Structure holding the
+ * parameters for IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_SET_UP
  *
  *
  */
-union IpaHwSetUpCmd {
-	struct Ipa3HwNtnSetUpCmdData_t NtnSetupCh_params;
-	struct IpaHwAQCSetupCmdData_t AqcSetupCh_params;
-	struct IpaHw11adSetupCmdData_t W11AdSetupCh_params;
-	struct IpaHwRtkSetupCmdData_t RtkSetupCh_params;
+union uc_channel_setup_cmd_hw {
+	struct uc_channel_setup_cmd_hw_ntn ntn_params;
+	struct uc_channel_setup_cmd_hw_aqc aqc_params;
+	struct uc_channel_setup_cmd_hw_11ad w11ad_params;
+	struct uc_channel_setup_cmd_hw_rtk rtk_params;
 } __packed;
 
 struct IpaHwOffloadSetUpCmdData_t {
 	u8 protocol;
-	union IpaHwSetUpCmd SetupCh_params;
+	union uc_channel_setup_cmd_hw SetupCh_params;
 } __packed;
 
 struct IpaCommonMonitoringParams_t {
@@ -732,25 +738,25 @@ struct IpaBwMonitoring_t {
 
 struct IpaHwOffloadSetUpCmdData_t_v4_0 {
 	u32 protocol;
-	union IpaHwSetUpCmd SetupCh_params;
+	union uc_channel_setup_cmd_hw SetupCh_params;
 } __packed;
 
 /**
- * struct IpaHwCommonChCmd  - Structure holding the parameters
- * for IPA_CPU_2_HW_CMD_OFFLOAD_TEAR_DOWN
+ * struct uc_channel_teardown_cmd_hw  - Structure holding the
+ * parameters for IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_TEAR_DOWN
  *
  *
  */
-union IpaHwCommonChCmd {
-	union Ipa3HwNtnCommonChCmdData_t NtnCommonCh_params;
-	struct IpaHwAQCCommonChCmdData_t AqcCommonCh_params;
-	struct IpaHwRtkCommonChCmdData_t RtkCommonCh_params;
-	struct IpaHw11adCommonChCmdData_t W11AdCommonCh_params;
+union uc_channel_teardown_cmd_hw {
+	union uc_channel_teardown_cmd_hw_ntn ntn_params;
+	struct uc_channel_teardown_cmd_hw_aqc aqc_params;
+	struct uc_channel_teardown_cmd_hw_rtk rtk_params;
+	struct uc_channel_teardown_cmd_hw_11ad w11ad_params;
 } __packed;
 
 struct IpaHwOffloadCommonChCmdData_t {
 	u8 protocol;
-	union IpaHwCommonChCmd CommonCh_params;
+	union uc_channel_teardown_cmd_hw CommonCh_params;
 } __packed;
 
 enum EVENT_2_CPU_OPCODE {
@@ -815,7 +821,7 @@ struct eventElement_t {
 
 struct IpaHwOffloadCommonChCmdData_t_v4_0 {
 	u32 protocol;
-	union IpaHwCommonChCmd CommonCh_params;
+	union uc_channel_teardown_cmd_hw CommonCh_params;
 } __packed;
 
 

+ 7 - 7
drivers/platform/msm/ipa/ipa_v3/ipa_wigig_i.c

@@ -888,13 +888,13 @@ static int ipa3_wigig_config_uc(bool init,
 			(struct IpaHwOffloadSetUpCmdData_t_v4_0 *)cmd.base;
 
 		cmd_data->protocol = IPA_HW_PROTOCOL_11ad;
-		cmd_data->SetupCh_params.W11AdSetupCh_params.dir =
+		cmd_data->SetupCh_params.w11ad_params.dir =
 			Rx ? W11AD_RX : W11AD_TX;
-		cmd_data->SetupCh_params.W11AdSetupCh_params.gsi_ch = gsi_ch;
-		cmd_data->SetupCh_params.W11AdSetupCh_params.wifi_ch = wifi_ch;
-		cmd_data->SetupCh_params.W11AdSetupCh_params.wifi_hp_addr_msb =
+		cmd_data->SetupCh_params.w11ad_params.gsi_ch = gsi_ch;
+		cmd_data->SetupCh_params.w11ad_params.wifi_ch = wifi_ch;
+		cmd_data->SetupCh_params.w11ad_params.wifi_hp_addr_msb =
 			IPA_WIGIG_MSB(HWHEAD);
-		cmd_data->SetupCh_params.W11AdSetupCh_params.wifi_hp_addr_lsb =
+		cmd_data->SetupCh_params.w11ad_params.wifi_hp_addr_lsb =
 			IPA_WIGIG_LSB(HWHEAD);
 		command = IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_SET_UP;
 
@@ -913,8 +913,8 @@ static int ipa3_wigig_config_uc(bool init,
 			(struct IpaHwOffloadCommonChCmdData_t_v4_0 *)cmd.base;
 
 		cmd_data->protocol = IPA_HW_PROTOCOL_11ad;
-		cmd_data->CommonCh_params.W11AdCommonCh_params.gsi_ch = gsi_ch;
-		command = IPA_CPU_2_HW_CMD_OFFLOAD_TEAR_DOWN;
+		cmd_data->CommonCh_params.w11ad_params.gsi_ch = gsi_ch;
+		command = IPA_CPU_2_HW_CMD_OFFLOAD_CHANNEL_TEAR_DOWN;
 	}
 
 	IPA_ACTIVE_CLIENTS_INC_SIMPLE();