Lines Matching refs:p
223 struct ldc_packet *p; in handshake_get_tx_packet() local
232 p = lp->tx_base; in handshake_get_tx_packet()
233 return p + (lp->tx_tail / LDC_PACKET_SIZE); in handshake_get_tx_packet()
278 struct ldc_packet *p; in data_get_tx_packet() local
288 p = lp->tx_base; in data_get_tx_packet()
289 return p + (lp->tx_tail / LDC_PACKET_SIZE); in data_get_tx_packet()
341 struct ldc_packet *p, in send_tx_packet() argument
344 BUG_ON(p != (lp->tx_base + (lp->tx_tail / LDC_PACKET_SIZE))); in send_tx_packet()
354 struct ldc_packet *p = handshake_get_tx_packet(lp, new_tail); in handshake_compose_ctrl() local
356 if (p) { in handshake_compose_ctrl()
357 memset(p, 0, sizeof(*p)); in handshake_compose_ctrl()
358 p->type = LDC_CTRL; in handshake_compose_ctrl()
359 p->stype = stype; in handshake_compose_ctrl()
360 p->ctrl = ctrl; in handshake_compose_ctrl()
362 memcpy(p->u.u_data, data, dlen); in handshake_compose_ctrl()
364 return p; in handshake_compose_ctrl()
369 struct ldc_packet *p; in start_handshake() local
378 p = handshake_compose_ctrl(lp, LDC_INFO, LDC_VERS, in start_handshake()
380 if (p) { in start_handshake()
381 int err = send_tx_packet(lp, p, new_tail); in start_handshake()
392 struct ldc_packet *p; in send_version_nack() local
399 p = handshake_compose_ctrl(lp, LDC_NACK, LDC_VERS, in send_version_nack()
401 if (p) { in send_version_nack()
405 return send_tx_packet(lp, p, new_tail); in send_version_nack()
413 struct ldc_packet *p; in send_version_ack() local
416 p = handshake_compose_ctrl(lp, LDC_ACK, LDC_VERS, in send_version_ack()
418 if (p) { in send_version_ack()
422 return send_tx_packet(lp, p, new_tail); in send_version_ack()
429 struct ldc_packet *p; in send_rts() local
432 p = handshake_compose_ctrl(lp, LDC_INFO, LDC_RTS, NULL, 0, in send_rts()
434 if (p) { in send_rts()
435 p->env = lp->cfg.mode; in send_rts()
436 p->seqid = 0; in send_rts()
440 p->env, p->seqid); in send_rts()
442 return send_tx_packet(lp, p, new_tail); in send_rts()
449 struct ldc_packet *p; in send_rtr() local
452 p = handshake_compose_ctrl(lp, LDC_INFO, LDC_RTR, NULL, 0, in send_rtr()
454 if (p) { in send_rtr()
455 p->env = lp->cfg.mode; in send_rtr()
456 p->seqid = 0; in send_rtr()
459 p->env, p->seqid); in send_rtr()
461 return send_tx_packet(lp, p, new_tail); in send_rtr()
468 struct ldc_packet *p; in send_rdx() local
471 p = handshake_compose_ctrl(lp, LDC_INFO, LDC_RDX, NULL, 0, in send_rdx()
473 if (p) { in send_rdx()
474 p->env = 0; in send_rdx()
475 p->seqid = ++lp->snd_nxt; in send_rdx()
476 p->u.r.ackid = lp->rcv_nxt; in send_rdx()
479 p->env, p->seqid, p->u.r.ackid); in send_rdx()
481 return send_tx_packet(lp, p, new_tail); in send_rdx()
488 struct ldc_packet *p; in send_data_nack() local
492 p = data_get_tx_packet(lp, &new_tail); in send_data_nack()
493 if (!p) in send_data_nack()
495 memset(p, 0, sizeof(*p)); in send_data_nack()
496 p->type = data_pkt->type; in send_data_nack()
497 p->stype = LDC_NACK; in send_data_nack()
498 p->ctrl = data_pkt->ctrl & LDC_CTRL_MSK; in send_data_nack()
499 p->seqid = lp->snd_nxt + 1; in send_data_nack()
500 p->u.r.ackid = lp->rcv_nxt; in send_data_nack()
503 p->type, p->ctrl, p->seqid, p->u.r.ackid); in send_data_nack()
505 err = send_tx_packet(lp, p, new_tail); in send_data_nack()
628 struct ldc_packet *p; in process_ver_nack() local
638 p = handshake_compose_ctrl(lp, LDC_INFO, LDC_VERS, in process_ver_nack()
641 if (!p) in process_ver_nack()
644 return send_tx_packet(lp, p, new_tail); in process_ver_nack()
648 struct ldc_packet *p) in process_version() argument
652 vp = (struct ldc_version *) p->u.u_data; in process_version()
654 switch (p->stype) { in process_version()
670 struct ldc_packet *p) in process_rts() argument
673 p->stype, p->seqid, p->env); in process_rts()
675 if (p->stype != LDC_INFO || in process_rts()
677 p->env != lp->cfg.mode) in process_rts()
680 lp->snd_nxt = p->seqid; in process_rts()
681 lp->rcv_nxt = p->seqid; in process_rts()
690 struct ldc_packet *p) in process_rtr() argument
693 p->stype, p->seqid, p->env); in process_rtr()
695 if (p->stype != LDC_INFO || in process_rtr()
696 p->env != lp->cfg.mode) in process_rtr()
699 lp->snd_nxt = p->seqid; in process_rtr()
713 struct ldc_packet *p) in process_rdx() argument
716 p->stype, p->seqid, p->env, p->u.r.ackid); in process_rdx()
718 if (p->stype != LDC_INFO || in process_rdx()
719 !(rx_seq_ok(lp, p->seqid))) in process_rdx()
722 lp->rcv_nxt = p->seqid; in process_rdx()
731 struct ldc_packet *p) in process_control_frame() argument
733 switch (p->ctrl) { in process_control_frame()
735 return process_version(lp, p); in process_control_frame()
738 return process_rts(lp, p); in process_control_frame()
741 return process_rtr(lp, p); in process_control_frame()
744 return process_rdx(lp, p); in process_control_frame()
752 struct ldc_packet *p) in process_error_frame() argument
764 struct ldc_packet *p = lp->tx_base + (head / LDC_PACKET_SIZE); in process_data_ack() local
768 if (p->seqid == ackid) { in process_data_ack()
859 struct ldc_packet *p; in ldc_rx() local
863 p = lp->rx_base + (lp->rx_head / LDC_PACKET_SIZE); in ldc_rx()
865 switch (p->type) { in ldc_rx()
867 err = process_control_frame(lp, p); in ldc_rx()
878 err = process_error_frame(lp, p); in ldc_rx()
1502 struct ldc_packet *p; in write_raw() local
1517 p = data_get_tx_packet(lp, &new_tail); in write_raw()
1518 if (!p) in write_raw()
1521 memcpy(p, buf, size); in write_raw()
1523 err = send_tx_packet(lp, p, new_tail); in write_raw()
1532 struct ldc_packet *p; in read_raw() local
1553 p = lp->rx_base + (lp->rx_head / LDC_PACKET_SIZE); in read_raw()
1554 memcpy(buf, p, LDC_PACKET_SIZE); in read_raw()
1596 struct ldc_packet *p = lp->tx_base + (tail / LDC_PACKET_SIZE); in write_nonraw() local
1598 p->u.u_data : in write_nonraw()
1599 p->u.r.r_data); in write_nonraw()
1602 p->type = LDC_DATA; in write_nonraw()
1603 p->stype = LDC_INFO; in write_nonraw()
1604 p->ctrl = 0; in write_nonraw()
1612 p->env = (data_len | in write_nonraw()
1616 p->seqid = ++seq; in write_nonraw()
1619 p->type, in write_nonraw()
1620 p->stype, in write_nonraw()
1621 p->ctrl, in write_nonraw()
1622 p->env, in write_nonraw()
1623 p->seqid); in write_nonraw()
1641 static int rx_bad_seq(struct ldc_channel *lp, struct ldc_packet *p, in rx_bad_seq() argument
1649 err = send_data_nack(lp, p); in rx_bad_seq()
1660 static int data_ack_nack(struct ldc_channel *lp, struct ldc_packet *p) in data_ack_nack() argument
1662 if (p->stype & LDC_ACK) { in data_ack_nack()
1663 int err = process_data_ack(lp, p); in data_ack_nack()
1667 if (p->stype & LDC_NACK) in data_ack_nack()
1720 struct ldc_packet *p; in send_data_ack() local
1722 p = data_get_tx_packet(lp, &new_tail); in send_data_ack()
1723 if (likely(p)) { in send_data_ack()
1726 memset(p, 0, sizeof(*p)); in send_data_ack()
1727 p->type = LDC_DATA; in send_data_ack()
1728 p->stype = LDC_ACK; in send_data_ack()
1729 p->ctrl = 0; in send_data_ack()
1730 p->seqid = lp->snd_nxt + 1; in send_data_ack()
1731 p->u.r.ackid = lp->rcv_nxt; in send_data_ack()
1733 err = send_tx_packet(lp, p, new_tail); in send_data_ack()
1763 struct ldc_packet *p; in read_nonraw() local
1767 p = lp->rx_base + (new / LDC_PACKET_SIZE); in read_nonraw()
1771 p->type, in read_nonraw()
1772 p->stype, in read_nonraw()
1773 p->ctrl, in read_nonraw()
1774 p->env, in read_nonraw()
1775 p->seqid, in read_nonraw()
1776 p->u.r.ackid, in read_nonraw()
1779 if (unlikely(!rx_seq_ok(lp, p->seqid))) { in read_nonraw()
1780 err = rx_bad_seq(lp, p, first_frag); in read_nonraw()
1785 if (p->type & LDC_CTRL) { in read_nonraw()
1786 err = process_control_frame(lp, p); in read_nonraw()
1792 lp->rcv_nxt = p->seqid; in read_nonraw()
1799 if (!(p->type & LDC_DATA)) { in read_nonraw()
1803 if (p->stype & (LDC_ACK | LDC_NACK)) { in read_nonraw()
1804 err = data_ack_nack(lp, p); in read_nonraw()
1808 if (!(p->stype & LDC_INFO)) { in read_nonraw()
1816 pkt_len = p->env & LDC_LEN; in read_nonraw()
1831 if ((first_frag == NULL && !(p->env & LDC_START)) || in read_nonraw()
1832 (first_frag != NULL && (p->env & LDC_START))) { in read_nonraw()
1844 first_frag = p; in read_nonraw()
1868 p->u.u_data : p->u.r.r_data), pkt_len); in read_nonraw()
1872 if (p->env & LDC_STOP) in read_nonraw()