[Feature][ZXW-88]merge P50 version
Only Configure: No
Affected branch: master
Affected module: unknown
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I34667719d9e0e7e29e8e4368848601cde0a48408
diff --git a/ap/os/linux/linux-3.4.x/include/net/sock.h b/ap/os/linux/linux-3.4.x/include/net/sock.h
index efab120..7f2098b 100755
--- a/ap/os/linux/linux-3.4.x/include/net/sock.h
+++ b/ap/os/linux/linux-3.4.x/include/net/sock.h
@@ -85,6 +85,16 @@
{
}
#endif
+
+#ifdef CONFIG_IPC_SOCKET
+extern int socket_rpmsg_debug;
+
+#define sk_soc_dbg(format, arg...) if(socket_rpmsg_debug == 1) \
+ printk(KERN_DEBUG "[socket_rpmsg]<%s>: " format "\n" ,__func__ , ## arg)
+#define sk_soc_info(format, arg...) if(socket_rpmsg_debug == 1) \
+ printk(KERN_INFO "[socket_rpmsg]<%s>: " format "\n" ,__func__ , ## arg)
+
+#endif
/*
* This structure really needs to be cleaned up.
* Most of it is for TCP, and not used by any of
@@ -127,6 +137,15 @@
struct proto;
struct net;
+#ifdef CONFIG_IPC_SOCKET
+
+enum sock_flags;
+extern int unix_is_ipc_socket(struct sock *sock);
+extern int sock_soc_test_flags(struct sock *other, enum sock_flags flag);
+extern int sock_soc_sock_put(struct sock *other);
+extern void sock_soc_sock_hold(struct sock *other);
+
+#endif
/**
* struct sock_common - minimal network layer representation of sockets
* @skc_daddr: Foreign IPv4 addr
@@ -382,6 +401,12 @@
int (*sk_backlog_rcv)(struct sock *sk,
struct sk_buff *skb);
void (*sk_destruct)(struct sock *sk);
+#ifdef CONFIG_IPC_SOCKET
+ int ipc_flag;
+ int sk_fd;
+ struct sock* proxy_sock;
+ u8 closed;
+#endif
};
static inline int sk_peek_offset(struct sock *sk, int flags)
@@ -495,6 +520,9 @@
static inline void sock_hold(struct sock *sk)
{
atomic_inc(&sk->sk_refcnt);
+#ifdef CONFIG_IPC_SOCKET
+ sk_soc_dbg("sock_hold sk=%x, sk->sk_refcnt=%d\n", sk, sk->sk_refcnt);
+#endif
}
/* Ungrab socket in the context, which assumes that socket refcnt
@@ -502,6 +530,9 @@
*/
static inline void __sock_put(struct sock *sk)
{
+#ifdef CONFIG_IPC_SOCKET
+ sk_soc_dbg("__sock_put sk=%x, sk->sk_refcnt=%d\n",sk, sk->sk_refcnt);
+#endif
atomic_dec(&sk->sk_refcnt);
}
@@ -629,6 +660,10 @@
* Will use last 4 bytes of packet sent from
* user-space instead.
*/
+#ifdef CONFIG_IPC_SOCKET
+ SOCK_IPCSOCK, /*Indicates whether it is a cross core socket */
+ SOCK_IPC_LOCAL,
+#endif
};
static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -648,7 +683,16 @@
static inline int sock_flag(struct sock *sk, enum sock_flags flag)
{
+#ifdef CONFIG_IPC_SOCKET
+ if(unix_is_ipc_socket(sk)){
+ return sock_soc_test_flags(sk, flag);
+ }
+ else{
+#endif
return test_bit(flag, &sk->sk_flags);
+#ifdef CONFIG_IPC_SOCKET
+ }
+#endif
}
static inline void sk_acceptq_removed(struct sock *sk)
@@ -1586,7 +1630,10 @@
}
static inline void sk_set_socket(struct sock *sk, struct socket *sock)
-{
+{
+#ifdef CONFIG_IPC_SOCKET
+ sk_soc_dbg("sk_set_socket sk=%x, sock=%x \n", sk, sock);
+#endif
sk_tx_queue_clear(sk);
sk->sk_socket = sock;
}