Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1293391 > unrolled thread

Re: [PATCH] net: add Qualcomm IPC router

Started byCourtney Cavin <courtney.cavin@sonymobile.com>
First post2015-12-17 00:40 +0100
Last post2015-12-17 00:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] net: add Qualcomm IPC router Courtney Cavin <courtney.cavin@sonymobile.com> - 2015-12-17 00:40 +0100

#1293391 — Re: [PATCH] net: add Qualcomm IPC router

FromCourtney Cavin <courtney.cavin@sonymobile.com>
Date2015-12-17 00:40 +0100
SubjectRe: [PATCH] net: add Qualcomm IPC router
Message-ID<qGtPQ-8mr-9@gated-at.bofh.it>
On Fri, Dec 11, 2015 at 09:41:59PM +0100, Bjorn Andersson wrote:
> From: Courtney Cavin <courtney.cavin@sonymobile.com>
> 
> Add an implementation of Qualcomm's IPC router protocol, used to
> communicate with service providing remote processors.
> 
> Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
> ---
[...]
> +static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
> +{
> +       DECLARE_SOCKADDR(struct sockaddr_qrtr *, addr, msg->msg_name);
> +       int (*enqueue_fn)(struct qrtr_node *, struct sk_buff *);
> +       struct qrtr_sock *ipc = qrtr_sk(sock->sk);
> +       struct sock *sk = sock->sk;
> +       struct qrtr_node *node;
> +       struct qrtr_hdr *hdr;
> +       struct sk_buff *skb;
> +       size_t plen;
> +       int rc;
> +
> +       if (msg->msg_flags & ~(MSG_DONTWAIT))
> +               return -EINVAL;
> +
> +       if (len > 65535)
> +               return -EMSGSIZE;
> +
> +       lock_sock(sk);
> +
> +       if (addr) {
> +               if (msg->msg_namelen < sizeof(*addr)) {
> +                       release_sock(sk);
> +                       return -EINVAL;
> +               }
> +
> +               if (addr->sq_family != AF_QIPCRTR) {
> +                       release_sock(sk);
> +                       return -EINVAL;
> +               }
> +
> +               rc = qrtr_autobind(sock);
> +               if (rc) {
> +                       release_sock(sk);
> +                       return rc;
> +               }
> +       } else if (sk->sk_state == TCP_ESTABLISHED) {
> +               addr = &ipc->peer;
> +       } else {
> +               release_sock(sk);
> +               return -ENOTCONN;
> +       }
> +
> +       node = NULL;
> +       if (addr->sq_node == QRTR_NODE_BCAST) {
> +               enqueue_fn = qrtr_bcast_enqueue;
> +       } else if (addr->sq_node == 0 || addr->sq_node == ipc->us.sq_node) {

'addr->sq_node == 0' should be removed from this if-condition.  Zero is
a valid node id.  Clients needing the local address can use
getsockname(2).

> +               enqueue_fn = qrtr_local_enqueue;
> +       } else {
> +               enqueue_fn = qrtr_node_enqueue;
> +               node = qrtr_node_lookup(addr->sq_node);
> +               if (!node) {
> +                       release_sock(sk);
> +                       return -ECONNRESET;
> +               }
> +       }

-Courtney
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web