Exemplo n.º 1
0
/**
 * smp2p_ut_local_in_multiple - Verify Multiple Inbound Registration.
 *
 * @s: pointer to output file
 *
 * This test verifies multiple clients registering for same inbound entries
 * using the remote mock processor.
 */
static void smp2p_ut_local_in_multiple(struct seq_file *s)
{
	int failed = 0;
	struct msm_smp2p_remote_mock *rmp = NULL;
	int ret;
	static struct mock_cb_data cb_in_1;
	static struct mock_cb_data cb_in_2;
	static struct mock_cb_data cb_out;

	seq_printf(s, "Running %s\n", __func__);

	mock_cb_data_init(&cb_in_1);
	mock_cb_data_init(&cb_in_2);
	mock_cb_data_init(&cb_out);

	do {
		/* Initialize mock edge */
		ret = smp2p_reset_mock_edge();
		UT_ASSERT_INT(ret, ==, 0);

		rmp = msm_smp2p_get_remote_mock();
		UT_ASSERT_PTR(rmp, !=, NULL);

		rmp->rx_interrupt_count = 0;
		memset(&rmp->remote_item, 0,
			sizeof(struct smp2p_smem_item));
		rmp->remote_item.header.magic = SMP2P_MAGIC;
		SMP2P_SET_LOCAL_PID(
		rmp->remote_item.header.rem_loc_proc_id,
						SMP2P_REMOTE_MOCK_PROC);
		SMP2P_SET_REMOTE_PID(
		rmp->remote_item.header.rem_loc_proc_id,
						SMP2P_APPS_PROC);
		SMP2P_SET_VERSION(
		rmp->remote_item.header.feature_version, 1);
		SMP2P_SET_FEATURES(
		rmp->remote_item.header.feature_version, 0);
		SMP2P_SET_ENT_TOTAL(
		rmp->remote_item.header.valid_total_ent, 1);
		SMP2P_SET_ENT_VALID(
		rmp->remote_item.header.valid_total_ent, 0);
		rmp->remote_item.header.reserved = 0x0;
		msm_smp2p_set_remote_mock_exists(true);

		/* Create an Entry in the remote mock object */
		scnprintf(rmp->remote_item.entries[0].name,
				SMP2P_MAX_ENTRY_NAME, "smp2p%d", 1);
		rmp->remote_item.entries[0].entry = 0;
		rmp->tx_interrupt();

		/* Register multiple clients for the inbound entry */
		ret = msm_smp2p_in_register(SMP2P_REMOTE_MOCK_PROC,
				rmp->remote_item.entries[0].name,
				&cb_in_1.nb);
		UT_ASSERT_INT(ret, ==, 0);
		UT_ASSERT_INT(
				(int)wait_for_completion_timeout(
				&(cb_in_1.cb_completion), HZ / 2),
				>, 0);
		UT_ASSERT_INT(cb_in_1.cb_count, ==, 1);
		UT_ASSERT_INT(cb_in_1.event_entry_update, ==, 0);

		ret = msm_smp2p_in_register(SMP2P_REMOTE_MOCK_PROC,
				rmp->remote_item.entries[0].name,
				&cb_in_2.nb);
		UT_ASSERT_INT(ret, ==, 0);
		UT_ASSERT_INT(
				(int)wait_for_completion_timeout(
				&(cb_in_2.cb_completion), HZ / 2),
				>, 0);
		UT_ASSERT_INT(cb_in_2.cb_count, ==, 1);
		UT_ASSERT_INT(cb_in_2.event_entry_update, ==, 0);


		/* Unregister the clients */
		ret = msm_smp2p_in_unregister(SMP2P_REMOTE_MOCK_PROC,
				rmp->remote_item.entries[0].name,
				&(cb_in_1.nb));
		UT_ASSERT_INT(ret, ==, 0);

		ret = msm_smp2p_in_unregister(SMP2P_REMOTE_MOCK_PROC,
				rmp->remote_item.entries[0].name,
				&(cb_in_2.nb));
		UT_ASSERT_INT(ret, ==, 0);

		seq_printf(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");

		ret = msm_smp2p_in_unregister(SMP2P_REMOTE_MOCK_PROC,
				rmp->remote_item.entries[0].name,
				&(cb_in_1.nb));

		ret = msm_smp2p_in_unregister(SMP2P_REMOTE_MOCK_PROC,
				rmp->remote_item.entries[0].name,
				&(cb_in_2.nb));
	}
}
Exemplo n.º 2
0
/**
 * smp2p_ut_mock_loopback - Exercise the remote loopback using remote mock.
 *
 * @s: pointer to output file
 *
 * This test exercises the remote loopback code using
 * remote mock object. The remote mock object simulates the remote
 * processor sending remote loopback commands to the local processor.
 */
static void smp2p_ut_mock_loopback(struct seq_file *s)
{
	int failed = 0;
	struct msm_smp2p_remote_mock *rmp = NULL;
	int ret;
	uint32_t test_request = 0;
	uint32_t test_response = 0;
	struct msm_smp2p_out  *local;

	seq_printf(s, "Running %s\n", __func__);
	do {
		/* Initialize the mock edge */
		ret = smp2p_reset_mock_edge();
		UT_ASSERT_INT(ret, ==, 0);

		rmp = msm_smp2p_get_remote_mock();
		UT_ASSERT_PTR(rmp, !=, NULL);

		memset(&rmp->remote_item, 0,
			sizeof(struct smp2p_smem_item));
		rmp->remote_item.header.magic = SMP2P_MAGIC;
		SMP2P_SET_LOCAL_PID(
		rmp->remote_item.header.rem_loc_proc_id,
						SMP2P_REMOTE_MOCK_PROC);
		SMP2P_SET_REMOTE_PID(
		rmp->remote_item.header.rem_loc_proc_id,
						SMP2P_APPS_PROC);
		SMP2P_SET_VERSION(
		rmp->remote_item.header.feature_version, 1);
		SMP2P_SET_FEATURES(
		rmp->remote_item.header.feature_version, 0);
		SMP2P_SET_ENT_TOTAL(
		rmp->remote_item.header.valid_total_ent, SMP2P_MAX_ENTRY);
		SMP2P_SET_ENT_VALID(
		rmp->remote_item.header.valid_total_ent, 1);
		rmp->remote_item.header.reserved = 0x0;
		msm_smp2p_set_remote_mock_exists(true);

		/* Create test entry and attach loopback server */
		rmp->rx_interrupt_count = 0;
		INIT_COMPLETION(rmp->cb_completion);
		strlcpy(rmp->remote_item.entries[0].name, "smp2p",
							SMP2P_MAX_ENTRY_NAME);
		rmp->remote_item.entries[0].entry = 0;
		rmp->tx_interrupt();

		local = msm_smp2p_init_rmt_lpb_proc(SMP2P_REMOTE_MOCK_PROC);
		UT_ASSERT_INT(
			(int)wait_for_completion_timeout(
					&rmp->cb_completion, HZ / 2),
			>, 0);
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 2);

		/* Send Echo Command */
		rmp->rx_interrupt_count = 0;
		INIT_COMPLETION(rmp->cb_completion);
		SMP2P_SET_RMT_CMD_TYPE(test_request, 1);
		SMP2P_SET_RMT_CMD(test_request, SMP2P_LB_CMD_ECHO);
		SMP2P_SET_RMT_DATA(test_request, 10);
		rmp->remote_item.entries[0].entry = test_request;
		rmp->tx_interrupt();
		UT_ASSERT_INT(
			(int)wait_for_completion_timeout(
					&rmp->cb_completion, HZ / 2),
			>, 0);

		/* Verify Echo Response */
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1);
		ret = msm_smp2p_out_read(local,
							&test_response);
		UT_ASSERT_INT(ret, ==, 0);
		test_response = SMP2P_GET_RMT_DATA(test_response);
		UT_ASSERT_INT(test_response, ==, 10);

		/* Send PINGPONG command */
		test_request = 0;
		test_response = 0;
		rmp->rx_interrupt_count = 0;
		INIT_COMPLETION(rmp->cb_completion);
		SMP2P_SET_RMT_CMD_TYPE(test_request, 1);
		SMP2P_SET_RMT_CMD(test_request, SMP2P_LB_CMD_PINGPONG);
		SMP2P_SET_RMT_DATA(test_request, 10);
		rmp->remote_item.entries[0].entry = test_request;
		rmp->tx_interrupt();
		UT_ASSERT_INT(
			(int)wait_for_completion_timeout(
					&rmp->cb_completion, HZ / 2),
			>, 0);

		/* Verify PINGPONG Response */
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1);
		ret = msm_smp2p_out_read(local, &test_response);
		UT_ASSERT_INT(ret, ==, 0);
		test_response = SMP2P_GET_RMT_DATA(test_response);
		UT_ASSERT_INT(test_response, ==, 9);

		/* Send CLEARALL command */
		test_request = 0;
		test_response = 0;
		rmp->rx_interrupt_count = 0;
		INIT_COMPLETION(rmp->cb_completion);
		SMP2P_SET_RMT_CMD_TYPE(test_request, 1);
		SMP2P_SET_RMT_CMD(test_request, SMP2P_LB_CMD_CLEARALL);
		SMP2P_SET_RMT_DATA(test_request, 10);
		rmp->remote_item.entries[0].entry = test_request;
		rmp->tx_interrupt();
		UT_ASSERT_INT(
			(int)wait_for_completion_timeout(
					&rmp->cb_completion, HZ / 2),
			>, 0);

		/* Verify CLEARALL response */
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1);
		ret = msm_smp2p_out_read(local, &test_response);
		UT_ASSERT_INT(ret, ==, 0);
		test_response = SMP2P_GET_RMT_DATA(test_response);
		UT_ASSERT_INT(test_response, ==, 0);

		ret = msm_smp2p_deinit_rmt_lpb_proc(SMP2P_REMOTE_MOCK_PROC);
		UT_ASSERT_INT(ret, ==, 0);
		seq_printf(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		msm_smp2p_deinit_rmt_lpb_proc(SMP2P_REMOTE_MOCK_PROC);
	}
}
Exemplo n.º 3
0
/**
 * smp2p_ut_local_basic - Basic sanity test using local loopback.
 *
 * @s: pointer to output file
 *
 * This test simulates a simple write and read
 * when remote processor does not exist.
 */
static void smp2p_ut_local_basic(struct seq_file *s)
{
	int failed = 0;
	struct msm_smp2p_out *smp2p_obj;
	struct msm_smp2p_remote_mock *rmp = NULL;
	int ret;
	uint32_t test_request;
	uint32_t test_response = 0;
	static struct mock_cb_data cb_data;

	seq_printf(s, "Running %s\n", __func__);
	mock_cb_data_init(&cb_data);
	do {
		/* initialize mock edge and start opening */
		ret = smp2p_reset_mock_edge();
		UT_ASSERT_INT(ret, ==, 0);

		rmp = msm_smp2p_get_remote_mock();
		UT_ASSERT_PTR(rmp, !=, NULL);

		rmp->rx_interrupt_count = 0;
		memset(&rmp->remote_item, 0,
			sizeof(struct smp2p_smem_item));

		msm_smp2p_set_remote_mock_exists(false);

		ret = msm_smp2p_out_open(SMP2P_REMOTE_MOCK_PROC, "smp2p",
			&cb_data.nb, &smp2p_obj);
		UT_ASSERT_INT(ret, ==, 0);

		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1);
		UT_ASSERT_INT(cb_data.cb_count, ==, 0);
		rmp->rx_interrupt_count = 0;

		/* simulate response from remote side */
		rmp->remote_item.header.magic = SMP2P_MAGIC;
		SMP2P_SET_LOCAL_PID(
		rmp->remote_item.header.rem_loc_proc_id,
					SMP2P_REMOTE_MOCK_PROC);
		SMP2P_SET_REMOTE_PID(
		rmp->remote_item.header.rem_loc_proc_id,
					SMP2P_APPS_PROC);
		SMP2P_SET_VERSION(
		rmp->remote_item.header.feature_version, 1);
		SMP2P_SET_FEATURES(
		rmp->remote_item.header.feature_version, 0);
		SMP2P_SET_ENT_TOTAL(
		rmp->remote_item.header.valid_total_ent, SMP2P_MAX_ENTRY);
		SMP2P_SET_ENT_VALID(
		rmp->remote_item.header.valid_total_ent, 0);
		rmp->remote_item.header.reserved = 0x0;
		msm_smp2p_set_remote_mock_exists(true);
		rmp->tx_interrupt();

		/* verify port was opened */
		UT_ASSERT_INT(
			(int)wait_for_completion_timeout(
					&cb_data.cb_completion, HZ / 2), >, 0);
		UT_ASSERT_INT(cb_data.cb_count, ==, 1);
		UT_ASSERT_INT(cb_data.event_open, ==, 1);
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 2);

		/* do write (test outbound entries) */
		rmp->rx_interrupt_count = 0;
		test_request = 0xC0DE;
		ret = msm_smp2p_out_write(smp2p_obj, test_request);
		UT_ASSERT_INT(ret, ==, 0);
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1);

		/* do read (test inbound entries) */
		ret = msm_smp2p_out_read(smp2p_obj, &test_response);
		UT_ASSERT_INT(ret, ==, 0);
		UT_ASSERT_INT(test_request, ==, test_response);

		ret = msm_smp2p_out_close(&smp2p_obj);
		UT_ASSERT_INT(ret, ==, 0);
		UT_ASSERT_PTR(smp2p_obj, ==, 0);

		seq_printf(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		(void)msm_smp2p_out_close(&smp2p_obj);
	}
}
Exemplo n.º 4
0
/**
 * smp2p_ut_local_early_open - Verify pre-negotiation opening.
 *
 * @s: pointer to output file
 *
 * Verify entry creation for opening entries before negotiation is complete.
 */
static void smp2p_ut_local_early_open(struct seq_file *s)
{
	int failed = 0;
	struct msm_smp2p_out *smp2p_obj;
	struct msm_smp2p_remote_mock *rmp = NULL;
	struct smp2p_smem *outbound_item;
	int negotiation_state;
	int ret;
	uint32_t test_request;
	uint32_t test_response = 0;
	static struct mock_cb_data cb_data;

	seq_printf(s, "Running %s\n", __func__);
	mock_cb_data_init(&cb_data);
	do {
		/* initialize mock edge, but don't enable, yet */
		ret = smp2p_reset_mock_edge();
		UT_ASSERT_INT(ret, ==, 0);

		rmp = msm_smp2p_get_remote_mock();
		UT_ASSERT_PTR(rmp, !=, NULL);

		rmp->rx_interrupt_count = 0;
		memset(&rmp->remote_item, 0,
			sizeof(struct smp2p_smem_item));
		rmp->remote_item.header.magic = SMP2P_MAGIC;
		SMP2P_SET_LOCAL_PID(
		rmp->remote_item.header.rem_loc_proc_id,
						SMP2P_REMOTE_MOCK_PROC);
		SMP2P_SET_REMOTE_PID(
		rmp->remote_item.header.rem_loc_proc_id,
						SMP2P_APPS_PROC);
		SMP2P_SET_VERSION(
		rmp->remote_item.header.feature_version, 1);
		SMP2P_SET_FEATURES(
		rmp->remote_item.header.feature_version, 0);
		SMP2P_SET_ENT_TOTAL(
		rmp->remote_item.header.valid_total_ent, SMP2P_MAX_ENTRY);
		SMP2P_SET_ENT_VALID(
		rmp->remote_item.header.valid_total_ent, 0);
		rmp->remote_item.header.reserved = 0x0;

		msm_smp2p_set_remote_mock_exists(false);
		UT_ASSERT_PTR(NULL, ==,
				smp2p_get_in_item(SMP2P_REMOTE_MOCK_PROC));

		/* initiate open, but verify it doesn't complete */
		ret = msm_smp2p_out_open(SMP2P_REMOTE_MOCK_PROC, "smp2p",
			&cb_data.nb, &smp2p_obj);
		UT_ASSERT_INT(ret, ==, 0);

		UT_ASSERT_INT(
			(int)wait_for_completion_timeout(
					&cb_data.cb_completion, HZ / 8),
			==, 0);
		UT_ASSERT_INT(cb_data.cb_count, ==, 0);
		UT_ASSERT_INT(cb_data.event_open, ==, 0);
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1);

		outbound_item = smp2p_get_out_item(SMP2P_REMOTE_MOCK_PROC,
				&negotiation_state);
		UT_ASSERT_PTR(outbound_item, !=, NULL);
		UT_ASSERT_INT(negotiation_state, ==, SMP2P_EDGE_STATE_OPENING);
		UT_ASSERT_INT(0, ==,
			SMP2P_GET_ENT_VALID(outbound_item->valid_total_ent));

		/* verify that read/write don't work yet */
		rmp->rx_interrupt_count = 0;
		test_request = 0x0;
		ret = msm_smp2p_out_write(smp2p_obj, test_request);
		UT_ASSERT_INT(ret, ==, -ENODEV);
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 0);

		ret = msm_smp2p_out_read(smp2p_obj, &test_response);
		UT_ASSERT_INT(ret, ==, -ENODEV);

		/* allocate remote entry and verify open */
		msm_smp2p_set_remote_mock_exists(true);
		rmp->tx_interrupt();

		UT_ASSERT_INT(
			(int)wait_for_completion_timeout(
					&cb_data.cb_completion, HZ / 2),
			>, 0);
		UT_ASSERT_INT(cb_data.cb_count, ==, 1);
		UT_ASSERT_INT(cb_data.event_open, ==, 1);
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 2);

		/* do write (test outbound entries) */
		rmp->rx_interrupt_count = 0;
		test_request = 0xC0DE;
		ret = msm_smp2p_out_write(smp2p_obj, test_request);
		UT_ASSERT_INT(ret, ==, 0);
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1);

		/* do read (test inbound entries) */
		ret = msm_smp2p_out_read(smp2p_obj, &test_response);
		UT_ASSERT_INT(ret, ==, 0);
		UT_ASSERT_INT(test_request, ==, test_response);

		ret = msm_smp2p_out_close(&smp2p_obj);
		UT_ASSERT_INT(ret, ==, 0);
		UT_ASSERT_PTR(smp2p_obj, ==, 0);

		seq_printf(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		(void)msm_smp2p_out_close(&smp2p_obj);
	}
}
Exemplo n.º 5
0
static void smp2p_ut_local_ssr_ack(struct seq_file *s)
{
	int failed = 0;
	struct msm_smp2p_remote_mock *rmp = NULL;
	int ret;

	seq_printf(s, "Running %s\n", __func__);
	do {
		struct smp2p_smem *rhdr;
		struct smp2p_smem *lhdr;
		int negotiation_state;

		/*                                                     */
		ret = smp2p_reset_mock_edge();
		UT_ASSERT_INT(ret, ==, 0);
		rmp = msm_smp2p_get_remote_mock();
		UT_ASSERT_PTR(rmp, !=, NULL);
		rhdr = &rmp->remote_item.header;

		rmp->rx_interrupt_count = 0;
		memset(&rmp->remote_item, 0, sizeof(struct smp2p_smem_item));
		rhdr->magic = SMP2P_MAGIC;
		SMP2P_SET_LOCAL_PID(rhdr->rem_loc_proc_id,
				SMP2P_REMOTE_MOCK_PROC);
		SMP2P_SET_REMOTE_PID(rhdr->rem_loc_proc_id, SMP2P_APPS_PROC);
		SMP2P_SET_VERSION(rhdr->feature_version, 1);
		SMP2P_SET_FEATURES(rhdr->feature_version, 0);
		SMP2P_SET_ENT_TOTAL(rhdr->valid_total_ent, SMP2P_MAX_ENTRY);
		SMP2P_SET_ENT_VALID(rhdr->valid_total_ent, 0);
		rhdr->flags = 0x0;
		msm_smp2p_set_remote_mock_exists(true);
		rmp->tx_interrupt();

		/*                     */
		lhdr = smp2p_get_out_item(SMP2P_REMOTE_MOCK_PROC,
					&negotiation_state);
		UT_ASSERT_PTR(NULL, !=, lhdr);
		UT_ASSERT_INT(negotiation_state, ==, SMP2P_EDGE_STATE_OPENED);
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1);

		/*                                   */
		rmp->rx_interrupt_count = 0;
		SMP2P_SET_RESTART_DONE(rhdr->flags, 1);
		rmp->tx_interrupt();
		UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_DONE(lhdr->flags));
		UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_ACK(lhdr->flags));
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 0);

		/*                                                  */
		ret = smp2p_reset_mock_edge();
		UT_ASSERT_INT(ret, ==, 0);
		rmp = msm_smp2p_get_remote_mock();
		UT_ASSERT_PTR(rmp, !=, NULL);
		rhdr = &rmp->remote_item.header;

		rmp->rx_interrupt_count = 0;
		memset(&rmp->remote_item, 0, sizeof(struct smp2p_smem_item));
		rhdr->magic = SMP2P_MAGIC;
		SMP2P_SET_LOCAL_PID(rhdr->rem_loc_proc_id,
				SMP2P_REMOTE_MOCK_PROC);
		SMP2P_SET_REMOTE_PID(rhdr->rem_loc_proc_id, SMP2P_APPS_PROC);
		SMP2P_SET_VERSION(rhdr->feature_version, 1);
		SMP2P_SET_FEATURES(rhdr->feature_version,
				SMP2P_FEATURE_SSR_ACK);
		SMP2P_SET_ENT_TOTAL(rhdr->valid_total_ent, SMP2P_MAX_ENTRY);
		SMP2P_SET_ENT_VALID(rhdr->valid_total_ent, 0);
		rmp->rx_interrupt_count = 0;
		rhdr->flags = 0x0;
		msm_smp2p_set_remote_mock_exists(true);
		rmp->tx_interrupt();

		/*                     */
		lhdr = smp2p_get_out_item(SMP2P_REMOTE_MOCK_PROC,
					&negotiation_state);
		UT_ASSERT_PTR(NULL, !=, lhdr);
		UT_ASSERT_INT(negotiation_state, ==, SMP2P_EDGE_STATE_OPENED);
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1);

		/*                                */
		rmp->rx_interrupt_count = 0;
		SMP2P_SET_RESTART_DONE(rhdr->flags, 1);
		rmp->tx_interrupt();
		UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_DONE(lhdr->flags));
		UT_ASSERT_INT(1, ==, SMP2P_GET_RESTART_ACK(lhdr->flags));
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1);

		rmp->rx_interrupt_count = 0;
		SMP2P_SET_RESTART_DONE(rhdr->flags, 0);
		rmp->tx_interrupt();
		UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_DONE(lhdr->flags));
		UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_ACK(lhdr->flags));
		UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1);

		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_puts(s, "\tFailed\n");
	}
}
Exemplo n.º 6
0
static void smp2p_ut_local_in_max_entries(struct seq_file *s)
{
	int j = 0;
	int failed = 0;
	struct msm_smp2p_remote_mock *rmp = NULL;
	int ret;
	static struct mock_cb_data cb_in[SMP2P_MAX_ENTRY];
	static struct mock_cb_data cb_out;

	seq_printf(s, "Running %s\n", __func__);

	for (j = 0; j < SMP2P_MAX_ENTRY; j++)
		mock_cb_data_init(&cb_in[j]);

	mock_cb_data_init(&cb_out);

	do {
		/*                      */
		ret = smp2p_reset_mock_edge();
		UT_ASSERT_INT(ret, ==, 0);

		rmp = msm_smp2p_get_remote_mock();
		UT_ASSERT_PTR(rmp, !=, NULL);

		rmp->rx_interrupt_count = 0;
		memset(&rmp->remote_item, 0,
			sizeof(struct smp2p_smem_item));
		rmp->remote_item.header.magic = SMP2P_MAGIC;
		SMP2P_SET_LOCAL_PID(
		rmp->remote_item.header.rem_loc_proc_id,
						SMP2P_REMOTE_MOCK_PROC);
		SMP2P_SET_REMOTE_PID(
		rmp->remote_item.header.rem_loc_proc_id,
						SMP2P_APPS_PROC);
		SMP2P_SET_VERSION(
		rmp->remote_item.header.feature_version, 1);
		SMP2P_SET_FEATURES(
		rmp->remote_item.header.feature_version, 0);
		SMP2P_SET_ENT_TOTAL(
		rmp->remote_item.header.valid_total_ent, SMP2P_MAX_ENTRY);
		SMP2P_SET_ENT_VALID(
		rmp->remote_item.header.valid_total_ent, 0);
		rmp->remote_item.header.flags = 0x0;
		msm_smp2p_set_remote_mock_exists(true);

		/*                                              */
		for (j = 0; j < SMP2P_MAX_ENTRY; j++) {
			scnprintf(rmp->remote_item.entries[j].name,
				SMP2P_MAX_ENTRY_NAME, "smp2p%d", j);
			rmp->remote_item.entries[j].entry = 0;
			rmp->tx_interrupt();
		}

		/*                         */
		for (j = 0; j < SMP2P_MAX_ENTRY; j++) {
			ret = msm_smp2p_in_register(SMP2P_REMOTE_MOCK_PROC,
				rmp->remote_item.entries[j].name,
				&(cb_in[j].nb));
			UT_ASSERT_INT(ret, ==, 0);
			UT_ASSERT_INT(
				(int)wait_for_completion_timeout(
					&(cb_in[j].cb_completion), HZ / 2),
				>, 0);
			UT_ASSERT_INT(cb_in[j].cb_count, ==, 1);
			UT_ASSERT_INT(cb_in[j].event_entry_update, ==, 0);
		}
		UT_ASSERT_INT(j, ==, SMP2P_MAX_ENTRY);

		/*            */
		for (j = 0; j < SMP2P_MAX_ENTRY; j++) {
			ret = msm_smp2p_in_unregister(SMP2P_REMOTE_MOCK_PROC,
				rmp->remote_item.entries[j].name,
				&(cb_in[j].nb));
		    UT_ASSERT_INT(ret, ==, 0);
		}
		UT_ASSERT_INT(j, ==, SMP2P_MAX_ENTRY);

		seq_printf(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");

		for (j = 0; j < SMP2P_MAX_ENTRY; j++)
			ret = msm_smp2p_in_unregister(SMP2P_REMOTE_MOCK_PROC,
				rmp->remote_item.entries[j].name,
				&(cb_in[j].nb));
	}
}