Lines Matching defs:canp
234 can_output(struct mbuf *m, struct canpcb *canp)
240 if (canp == NULL) {
244 ifp = canp->canp_ifp;
258 mutex_enter(&canp->canp_mtx);
259 canp_ref(canp);
260 mutex_exit(&canp->canp_mtx);
261 *(struct canpcb **)(sotag + 1) = canp;
316 struct canpcb *canp;
345 TAILQ_FOREACH(canp, &cbtable.canpt_queue, canp_queue) {
348 mutex_enter(&canp->canp_mtx);
350 if (canp->canp_state == CANP_DETACHED) {
351 mutex_exit(&canp->canp_mtx);
356 if (canp->canp_ifp != NULL &&
357 canp->canp_ifp->if_index != rcv_ifindex) {
358 mutex_exit(&canp->canp_mtx);
362 if (canp == sender_canp &&
363 (canp->canp_flags & CANP_RECEIVE_OWN) == 0) {
364 mutex_exit(&canp->canp_mtx);
369 if (!can_pcbfilter(canp, m)) {
370 mutex_exit(&canp->canp_mtx);
374 if (TAILQ_NEXT(canp, canp_queue) != NULL) {
389 if (sbappendaddr(&canp->canp_socket->so_rcv,
392 soroverflow(canp->canp_socket);
395 sorwakeup(canp->canp_socket);
396 mutex_exit(&canp->canp_mtx);
461 struct canpcb *canp;
464 canp = sotocanpcb(so);
465 can_pcbdetach(canp);
481 struct canpcb *canp = sotocanpcb(so);
487 return can_pcbbind(canp, scan, l);
501 struct canpcb *canp = sotocanpcb(so);
505 KASSERT(canp != NULL);
508 error = can_pcbconnect(canp, (struct sockaddr_can *)nam);
525 struct canpcb *canp = sotocanpcb(so);
528 KASSERT(canp != NULL);
532 can_pcbdisconnect(canp);
612 struct canpcb *canp = sotocanpcb(so);
637 error = can_pcbbind(canp, (struct sockaddr_can *)nam, l);
648 error = can_output(m, canp);
654 can_pcbbind(canp, &lscan, l);
681 struct canpcb *canp;
699 canp = sotocanpcb(so);
704 if (canp == 0 && req != PRU_ATTACH) {
705 printf("can_usrreq: no pcb %p %d\n", canp, req);
717 if (canp != 0) {
734 canp = sotocanpcb(so);
741 can_pcbdetach(canp);
745 error = can_pcbbind(canp, nam, l);
753 error = can_pcbconnect(canp, nam);
766 can_pcbdisconnect(canp);
767 can_pcbstate(canp, CANP_BOUND); /* XXX */
818 can_notify(struct canpcb *canp, int errno)
821 canp->canp_socket->so_error = errno;
822 sorwakeup(canp->canp_socket);
823 sowwakeup(canp->canp_socket);
860 can_raw_getop(struct canpcb *canp, struct sockopt *sopt)
867 optval = (canp->canp_flags & CANP_NO_LOOPBACK) ? 0 : 1;
871 optval = (canp->canp_flags & CANP_RECEIVE_OWN) ? 1 : 0;
875 error = sockopt_set(sopt, canp->canp_filters,
876 sizeof(struct can_filter) * canp->canp_nfilters);
886 can_raw_setop(struct canpcb *canp, struct sockopt *sopt)
896 canp->canp_flags &= ~CANP_NO_LOOPBACK;
898 canp->canp_flags |= CANP_NO_LOOPBACK;
906 canp->canp_flags |= CANP_RECEIVE_OWN;
908 canp->canp_flags &= ~CANP_RECEIVE_OWN;
917 error = can_pcbsetfilter(canp, sopt->sopt_data, nfilters);
934 struct canpcb *canp;
945 canp = sotocanpcb(so);
946 if (canp == NULL) {
952 error = can_raw_setop(canp, sopt);
954 error = can_raw_getop(canp, sopt);