From 3595311ff9cd3d3f97a384cf5615eb19e09b4bc8 Mon Sep 17 00:00:00 2001 From: Skylar Chang Date: Fri, 26 Jun 2020 17:09:19 -0700 Subject: [PATCH] msm: ipa3: add eth ep_pair info Add ep details corresponding to RMNET_CV2X tethering over eth. Change-Id: I0285887470c950a73e61dd51bf673bbc650d40bb Signed-off-by: Skylar Chang --- drivers/platform/msm/ipa/ipa_v3/ipa.c | 72 +++++++++++++++++++++++++++ include/uapi/linux/msm_ipa.h | 6 ++- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index a1191427c30c..c7841049da57 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -862,6 +862,74 @@ static void ipa3_get_pcie_ep_info( } } +static void ipa3_get_eth_ep_info( + struct ipa_ioc_get_ep_info *ep_info, + struct ipa_ep_pair_info *pair_info + ) +{ + int ep_index = -1, i; + + ep_info->num_ep_pairs = 0; + for (i = 0; i < ep_info->max_ep_pairs; i++) { + pair_info[i].consumer_pipe_num = -1; + pair_info[i].producer_pipe_num = -1; + pair_info[i].ep_id = -1; + } + + ep_index = ipa3_get_ep_mapping(IPA_CLIENT_ETHERNET2_PROD); + + if ((ep_index != -1) && ipa3_ctx->ep[ep_index].valid) { + pair_info[ep_info->num_ep_pairs].consumer_pipe_num = ep_index; + ep_index = ipa3_get_ep_mapping(IPA_CLIENT_ETHERNET2_CONS); + if ((ep_index != -1) && (ipa3_ctx->ep[ep_index].valid)) { + pair_info[ep_info->num_ep_pairs].producer_pipe_num = + ep_index; + pair_info[ep_info->num_ep_pairs].ep_id = + IPA_ETH1_EP_ID; + + IPADBG("ep_pair_info consumer_pipe_num %d", + pair_info[ep_info->num_ep_pairs].consumer_pipe_num); + IPADBG(" producer_pipe_num %d ep_id %d\n", + pair_info[ep_info->num_ep_pairs].producer_pipe_num, + pair_info[ep_info->num_ep_pairs].ep_id); + ep_info->num_ep_pairs++; + } else { + pair_info[ep_info->num_ep_pairs].consumer_pipe_num = -1; + IPADBG("ep_pair_info consumer_pipe_num %d", + pair_info[ep_info->num_ep_pairs].consumer_pipe_num); + IPADBG(" producer_pipe_num %d ep_id %d\n", + pair_info[ep_info->num_ep_pairs].producer_pipe_num, + pair_info[ep_info->num_ep_pairs].ep_id); + } + } + + ep_index = ipa3_get_ep_mapping(IPA_CLIENT_ETHERNET_PROD); + + if ((ep_index != -1) && ipa3_ctx->ep[ep_index].valid) { + pair_info[ep_info->num_ep_pairs].consumer_pipe_num = ep_index; + ep_index = ipa3_get_ep_mapping(IPA_CLIENT_ETHERNET_CONS); + if ((ep_index != -1) && (ipa3_ctx->ep[ep_index].valid)) { + pair_info[ep_info->num_ep_pairs].producer_pipe_num = + ep_index; + pair_info[ep_info->num_ep_pairs].ep_id = + IPA_ETH0_EP_ID; + + IPADBG("ep_pair_info consumer_pipe_num %d", + pair_info[ep_info->num_ep_pairs].consumer_pipe_num); + IPADBG(" producer_pipe_num %d ep_id %d\n", + pair_info[ep_info->num_ep_pairs].producer_pipe_num, + pair_info[ep_info->num_ep_pairs].ep_id); + ep_info->num_ep_pairs++; + } else { + pair_info[ep_info->num_ep_pairs].consumer_pipe_num = -1; + IPADBG("ep_pair_info consumer_pipe_num %d", + pair_info[ep_info->num_ep_pairs].consumer_pipe_num); + IPADBG(" producer_pipe_num %d ep_id %d\n", + pair_info[ep_info->num_ep_pairs].producer_pipe_num, + pair_info[ep_info->num_ep_pairs].ep_id); + } + } +} static int ipa3_get_ep_info(struct ipa_ioc_get_ep_info *ep_info, u8 *param) @@ -878,6 +946,10 @@ static int ipa3_get_ep_info(struct ipa_ioc_get_ep_info *ep_info, ipa3_get_pcie_ep_info(ep_info, pair_info); break; + case IPA_DATA_EP_TYP_ETH: + ipa3_get_eth_ep_info(ep_info, pair_info); + break; + default: IPAERR_RL("Undefined ep_type %d\n", ep_info->ep_type); ret = -EFAULT; diff --git a/include/uapi/linux/msm_ipa.h b/include/uapi/linux/msm_ipa.h index 9df94210f549..790effd175da 100644 --- a/include/uapi/linux/msm_ipa.h +++ b/include/uapi/linux/msm_ipa.h @@ -2342,13 +2342,17 @@ struct ipa_ioc_gsb_info { #define IPA_PCIE0_EP_ID 21 #define IPA_PCIE1_EP_ID 22 +#define IPA_ETH0_EP_ID 31 +#define IPA_ETH1_EP_ID 32 + enum ipa_peripheral_ep_type { IPA_DATA_EP_TYP_RESERVED = 0, IPA_DATA_EP_TYP_HSIC = 1, IPA_DATA_EP_TYP_HSUSB = 2, IPA_DATA_EP_TYP_PCIE = 3, IPA_DATA_EP_TYP_EMBEDDED = 4, - IPA_DATA_EP_TYP_BAM_DMUX, + IPA_DATA_EP_TYP_BAM_DMUX = 5, + IPA_DATA_EP_TYP_ETH, }; enum ipa_data_ep_prot_type {