Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0cabc1d7 authored by Chris Lew's avatar Chris Lew
Browse files

diag: Change the socket interfaces to use QRTR



IPC Router is being deprecated in favor of QRTR. Refactor the control
socket behavior to be handled by QMI helpers. Change socket family to
QRTR. Add handling for ENETRESET errors from the QRTR nameservice.

Change-Id: Ic4e7dfc7564f01953e26f345f8d37de1b0ec89ac
Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
parent 431fad72
Loading
Loading
Loading
Loading
+506 −666

File changed.

Preview size limit exceeded, changes collapsed.

+7 −40
Original line number Diff line number Diff line
@@ -14,13 +14,10 @@
#define DIAGFWD_SOCKET_H

#include <linux/socket.h>
#include <linux/msm_ipc.h>
#include <linux/soc/qcom/qmi.h>

#define DIAG_SOCKET_NAME_SZ		24

#define DIAG_SOCK_MODEM_SVC_ID		64
#define DIAG_SOCK_MODEM_INS_ID		3

#define PORT_TYPE_SERVER		0
#define PORT_TYPE_CLIENT		1

@@ -28,10 +25,6 @@
#define PEPIPHERAL_SSR_DOWN		1
#define PEPIPHERAL_SSR_UP		2

#define CNTL_CMD_NEW_SERVER		4
#define CNTL_CMD_REMOVE_SERVER		5
#define CNTL_CMD_REMOVE_CLIENT		6

enum {
	SOCKET_MODEM,
	SOCKET_ADSP,
@@ -57,8 +50,7 @@ struct diag_socket_info {
	atomic_t flow_cnt;
	char name[DIAG_SOCKET_NAME_SZ];
	spinlock_t lock;
	wait_queue_head_t wait_q;
	struct sockaddr_msm_ipc remote_addr;
	struct sockaddr_qrtr remote_addr;
	struct socket *hdl;
	struct workqueue_struct *wq;
	struct work_struct init_work;
@@ -67,31 +59,6 @@ struct diag_socket_info {
	wait_queue_head_t read_wait_q;
};

union cntl_port_msg {
	struct {
		uint32_t cmd;
		uint32_t service;
		uint32_t instance;
		uint32_t node_id;
		uint32_t port_id;
	} srv;
	struct {
		uint32_t cmd;
		uint32_t node_id;
		uint32_t port_id;
	} cli;
};

struct diag_cntl_socket_info {
	uint32_t svc_id;
	uint32_t ins_id;
	atomic_t data_ready;
	struct workqueue_struct *wq;
	struct work_struct read_work;
	struct work_struct init_work;
	wait_queue_head_t read_wait_q;
	struct socket *hdl;
};

extern struct diag_socket_info socket_data[NUM_PERIPHERALS];
extern struct diag_socket_info socket_cntl[NUM_PERIPHERALS];
@@ -99,12 +66,12 @@ extern struct diag_socket_info socket_dci[NUM_PERIPHERALS];
extern struct diag_socket_info socket_cmd[NUM_PERIPHERALS];
extern struct diag_socket_info socket_dci_cmd[NUM_PERIPHERALS];

extern struct diag_cntl_socket_info *cntl_socket;
extern struct qmi_handle *cntl_qmi;

int diag_socket_init(void);
int diag_socket_init_peripheral(uint8_t peripheral);
void diag_socket_exit(void);
void diag_socket_early_exit(void);
void diag_socket_invalidate(void *ctxt, struct diagfwd_info *fwd_ctxt);
int diag_socket_check_state(void *ctxt);

int diag_socket_init(void);
void diag_socket_exit(void);
int diag_socket_init_peripheral(uint8_t peripheral);
#endif