Lines Matching refs:ro

123 	struct raw_sock *ro = raw_sk(sk);  in raw_rcv()  local
129 if (!ro->recv_own_msgs && oskb->sk == sk) in raw_rcv()
133 if (!ro->fd_frames && oskb->len != CAN_MTU) in raw_rcv()
137 if (this_cpu_ptr(ro->uniq)->skb == oskb && in raw_rcv()
138 this_cpu_ptr(ro->uniq)->skbcnt == can_skb_prv(oskb)->skbcnt) { in raw_rcv()
139 if (ro->join_filters) { in raw_rcv()
140 this_cpu_inc(ro->uniq->join_rx_count); in raw_rcv()
142 if (this_cpu_ptr(ro->uniq)->join_rx_count < ro->count) in raw_rcv()
148 this_cpu_ptr(ro->uniq)->skb = oskb; in raw_rcv()
149 this_cpu_ptr(ro->uniq)->skbcnt = can_skb_prv(oskb)->skbcnt; in raw_rcv()
150 this_cpu_ptr(ro->uniq)->join_rx_count = 1; in raw_rcv()
152 if (ro->join_filters && ro->count > 1) in raw_rcv()
247 struct raw_sock *ro = raw_sk(sk); in raw_disable_allfilters() local
249 raw_disable_filters(net, dev, sk, ro->filter, ro->count); in raw_disable_allfilters()
250 raw_disable_errfilter(net, dev, sk, ro->err_mask); in raw_disable_allfilters()
256 struct raw_sock *ro = raw_sk(sk); in raw_enable_allfilters() local
259 err = raw_enable_filters(net, dev, sk, ro->filter, ro->count); in raw_enable_allfilters()
261 err = raw_enable_errfilter(net, dev, sk, ro->err_mask); in raw_enable_allfilters()
263 raw_disable_filters(net, dev, sk, ro->filter, in raw_enable_allfilters()
264 ro->count); in raw_enable_allfilters()
270 static void raw_notify(struct raw_sock *ro, unsigned long msg, in raw_notify() argument
273 struct sock *sk = &ro->sk; in raw_notify()
278 if (ro->ifindex != dev->ifindex) in raw_notify()
285 if (ro->bound) in raw_notify()
288 if (ro->count > 1) in raw_notify()
289 kfree(ro->filter); in raw_notify()
291 ro->ifindex = 0; in raw_notify()
292 ro->bound = 0; in raw_notify()
293 ro->count = 0; in raw_notify()
334 struct raw_sock *ro = raw_sk(sk); in raw_init() local
336 ro->bound = 0; in raw_init()
337 ro->ifindex = 0; in raw_init()
340 ro->dfilter.can_id = 0; in raw_init()
341 ro->dfilter.can_mask = MASK_ALL; in raw_init()
342 ro->filter = &ro->dfilter; in raw_init()
343 ro->count = 1; in raw_init()
346 ro->loopback = 1; in raw_init()
347 ro->recv_own_msgs = 0; in raw_init()
348 ro->fd_frames = 0; in raw_init()
349 ro->join_filters = 0; in raw_init()
352 ro->uniq = alloc_percpu(struct uniqframe); in raw_init()
353 if (unlikely(!ro->uniq)) in raw_init()
358 list_add_tail(&ro->notifier, &raw_notifier_list); in raw_init()
367 struct raw_sock *ro; in raw_release() local
372 ro = raw_sk(sk); in raw_release()
375 while (raw_busy_notifier == ro) { in raw_release()
380 list_del(&ro->notifier); in raw_release()
386 if (ro->bound) { in raw_release()
387 if (ro->ifindex) { in raw_release()
390 dev = dev_get_by_index(sock_net(sk), ro->ifindex); in raw_release()
400 if (ro->count > 1) in raw_release()
401 kfree(ro->filter); in raw_release()
403 ro->ifindex = 0; in raw_release()
404 ro->bound = 0; in raw_release()
405 ro->count = 0; in raw_release()
406 free_percpu(ro->uniq); in raw_release()
421 struct raw_sock *ro = raw_sk(sk); in raw_bind() local
433 if (ro->bound && addr->can_ifindex == ro->ifindex) in raw_bind()
465 if (ro->bound) { in raw_bind()
467 if (ro->ifindex) { in raw_bind()
471 ro->ifindex); in raw_bind()
481 ro->ifindex = ifindex; in raw_bind()
482 ro->bound = 1; in raw_bind()
502 struct raw_sock *ro = raw_sk(sk); in raw_getname() local
509 addr->can_ifindex = ro->ifindex; in raw_getname()
518 struct raw_sock *ro = raw_sk(sk); in raw_setsockopt() local
552 if (ro->bound && ro->ifindex) { in raw_setsockopt()
553 dev = dev_get_by_index(sock_net(sk), ro->ifindex); in raw_setsockopt()
562 if (ro->bound) { in raw_setsockopt()
577 raw_disable_filters(sock_net(sk), dev, sk, ro->filter, in raw_setsockopt()
578 ro->count); in raw_setsockopt()
582 if (ro->count > 1) in raw_setsockopt()
583 kfree(ro->filter); in raw_setsockopt()
588 ro->dfilter = sfilter; in raw_setsockopt()
589 filter = &ro->dfilter; in raw_setsockopt()
591 ro->filter = filter; in raw_setsockopt()
592 ro->count = count; in raw_setsockopt()
613 if (ro->bound && ro->ifindex) { in raw_setsockopt()
614 dev = dev_get_by_index(sock_net(sk), ro->ifindex); in raw_setsockopt()
622 if (ro->bound) { in raw_setsockopt()
632 ro->err_mask); in raw_setsockopt()
636 ro->err_mask = err_mask; in raw_setsockopt()
646 if (optlen != sizeof(ro->loopback)) in raw_setsockopt()
649 if (copy_from_sockptr(&ro->loopback, optval, optlen)) in raw_setsockopt()
655 if (optlen != sizeof(ro->recv_own_msgs)) in raw_setsockopt()
658 if (copy_from_sockptr(&ro->recv_own_msgs, optval, optlen)) in raw_setsockopt()
664 if (optlen != sizeof(ro->fd_frames)) in raw_setsockopt()
667 if (copy_from_sockptr(&ro->fd_frames, optval, optlen)) in raw_setsockopt()
673 if (optlen != sizeof(ro->join_filters)) in raw_setsockopt()
676 if (copy_from_sockptr(&ro->join_filters, optval, optlen)) in raw_setsockopt()
691 struct raw_sock *ro = raw_sk(sk); in raw_getsockopt() local
706 if (ro->count > 0) { in raw_getsockopt()
707 int fsize = ro->count * sizeof(struct can_filter); in raw_getsockopt()
718 if (copy_to_user(optval, ro->filter, len)) in raw_getsockopt()
733 val = &ro->err_mask; in raw_getsockopt()
739 val = &ro->loopback; in raw_getsockopt()
745 val = &ro->recv_own_msgs; in raw_getsockopt()
751 val = &ro->fd_frames; in raw_getsockopt()
757 val = &ro->join_filters; in raw_getsockopt()
774 struct raw_sock *ro = raw_sk(sk); in raw_sendmsg() local
791 ifindex = ro->ifindex; in raw_sendmsg()
799 if (ro->fd_frames && dev->mtu == CANFD_MTU) { in raw_sendmsg()
826 err = can_send(skb, ro->loopback); in raw_sendmsg()