Lines Matching defs:lc

47 ldc_rx_ctrl(struct ldc_conn *lc, struct ldc_pkt *lp)
51 ldc_rx_ctrl_vers(lc, lp);
55 ldc_rx_ctrl_rts(lc, lp);
59 ldc_rx_ctrl_rtr(lc, lp);
63 ldc_rx_ctrl_rdx(lc, lp);
68 ldc_reset(lc);
74 ldc_rx_ctrl_vers(struct ldc_conn *lc, struct ldc_pkt *lp)
81 ldc_send_ack(lc);
90 if (lc->lc_state != LDC_SND_VERS) {
92 lc->lc_state, lp->major, lp->minor));
95 ldc_send_rts(lc);
101 ldc_reset(lc);
106 ldc_reset(lc);
112 ldc_rx_ctrl_rts(struct ldc_conn *lc, struct ldc_pkt *lp)
116 if (lc->lc_state != LDC_RCV_VERS) {
118 lc->lc_state));
119 ldc_reset(lc);
123 ldc_send_rtr(lc);
128 ldc_reset(lc);
133 ldc_reset(lc);
138 ldc_reset(lc);
144 ldc_rx_ctrl_rtr(struct ldc_conn *lc, struct ldc_pkt *lp)
148 if (lc->lc_state != LDC_SND_RTS) {
150 lc->lc_state));
151 ldc_reset(lc);
155 ldc_send_rdx(lc);
156 lc->lc_start(lc);
161 ldc_reset(lc);
166 ldc_reset(lc);
171 ldc_reset(lc);
177 ldc_rx_ctrl_rdx(struct ldc_conn *lc, struct ldc_pkt *lp)
181 if (lc->lc_state != LDC_SND_RTR) {
183 lc->lc_state));
184 ldc_reset(lc);
188 lc->lc_start(lc);
193 ldc_reset(lc);
198 ldc_reset(lc);
203 ldc_reset(lc);
209 ldc_rx_data(struct ldc_conn *lc, struct ldc_pkt *lp)
215 ldc_reset(lc);
219 if (lc->lc_state != LDC_SND_RTR &&
220 lc->lc_state != LDC_SND_RDX) {
221 DPRINTF(("Spurious DATA/INFO: state %d\n", lc->lc_state));
222 ldc_reset(lc);
227 lc->lc_len = (lp->env & LDC_LEN_MASK) + 8;
228 KASSERT(lc->lc_len <= sizeof(lc->lc_msg));
229 memcpy((uint8_t *)lc->lc_msg, lp, lc->lc_len);
232 if (lc->lc_len + len > sizeof(lc->lc_msg)) {
234 ldc_reset(lc);
237 memcpy(((uint8_t *)lc->lc_msg) + lc->lc_len, &lp->major, len);
238 lc->lc_len += len;
242 lc->lc_rx_data(lc, (struct ldc_pkt *)lc->lc_msg);
246 ldc_send_vers(struct ldc_conn *lc)
252 mutex_enter(&lc->lc_txq->lq_mtx);
253 err = hv_ldc_tx_get_state(lc->lc_id, &tx_head, &tx_tail, &tx_state);
255 mutex_exit(&lc->lc_txq->lq_mtx);
259 lp = (struct ldc_pkt *)(uintptr_t)(lc->lc_txq->lq_va + tx_tail);
269 tx_tail &= ((lc->lc_txq->lq_nentries * sizeof(*lp)) - 1);
270 err = hv_ldc_tx_set_qtail(lc->lc_id, tx_tail);
273 mutex_exit(&lc->lc_txq->lq_mtx);
277 lc->lc_state = LDC_SND_VERS;
278 DPRINTF(("ldc_send_vers() setting lc->lc_state to %d\n", lc->lc_state));
279 mutex_exit(&lc->lc_txq->lq_mtx);
284 ldc_send_ack(struct ldc_conn *lc)
290 mutex_enter(&lc->lc_txq->lq_mtx);
291 err = hv_ldc_tx_get_state(lc->lc_id, &tx_head, &tx_tail, &tx_state);
293 mutex_exit(&lc->lc_txq->lq_mtx);
298 lp = (struct ldc_pkt *)(uintptr_t)(lc->lc_txq->lq_va + tx_tail);
307 tx_tail &= ((lc->lc_txq->lq_nentries * sizeof(*lp)) - 1);
308 err = hv_ldc_tx_set_qtail(lc->lc_id, tx_tail);
311 mutex_exit(&lc->lc_txq->lq_mtx);
315 lc->lc_state = LDC_RCV_VERS;
316 DPRINTF(("ldc_send_ack() setting lc->lc_state to %d\n", lc->lc_state));
317 mutex_exit(&lc->lc_txq->lq_mtx);
322 ldc_send_rts(struct ldc_conn *lc)
328 mutex_enter(&lc->lc_txq->lq_mtx);
329 err = hv_ldc_tx_get_state(lc->lc_id, &tx_head, &tx_tail, &tx_state);
331 mutex_exit(&lc->lc_txq->lq_mtx);
336 lp = (struct ldc_pkt *)(uintptr_t)(lc->lc_txq->lq_va + tx_tail);
342 lp->seqid = lc->lc_tx_seqid++;
345 tx_tail &= ((lc->lc_txq->lq_nentries * sizeof(*lp)) - 1);
346 err = hv_ldc_tx_set_qtail(lc->lc_id, tx_tail);
349 mutex_exit(&lc->lc_txq->lq_mtx);
353 lc->lc_state = LDC_SND_RTS;
354 DPRINTF(("ldc_send_rts() setting lc->lc_state to %d\n", lc->lc_state));
355 mutex_exit(&lc->lc_txq->lq_mtx);
360 ldc_send_rtr(struct ldc_conn *lc)
366 mutex_enter(&lc->lc_txq->lq_mtx);
367 err = hv_ldc_tx_get_state(lc->lc_id, &tx_head, &tx_tail, &tx_state);
369 mutex_exit(&lc->lc_txq->lq_mtx);
374 lp = (struct ldc_pkt *)(uintptr_t)(lc->lc_txq->lq_va + tx_tail);
380 lp->seqid = lc->lc_tx_seqid++;
383 tx_tail &= ((lc->lc_txq->lq_nentries * sizeof(*lp)) - 1);
384 err = hv_ldc_tx_set_qtail(lc->lc_id, tx_tail);
387 mutex_exit(&lc->lc_txq->lq_mtx);
391 lc->lc_state = LDC_SND_RTR;
392 DPRINTF(("ldc_send_rtr() setting lc->lc_state to %d\n", lc->lc_state));
393 mutex_exit(&lc->lc_txq->lq_mtx);
398 ldc_send_rdx(struct ldc_conn *lc)
404 mutex_enter(&lc->lc_txq->lq_mtx);
405 err = hv_ldc_tx_get_state(lc->lc_id, &tx_head, &tx_tail, &tx_state);
407 mutex_exit(&lc->lc_txq->lq_mtx);
412 lp = (struct ldc_pkt *)(uintptr_t)(lc->lc_txq->lq_va + tx_tail);
418 lp->seqid = lc->lc_tx_seqid++;
421 tx_tail &= ((lc->lc_txq->lq_nentries * sizeof(*lp)) - 1);
422 err = hv_ldc_tx_set_qtail(lc->lc_id, tx_tail);
425 mutex_exit(&lc->lc_txq->lq_mtx);
429 lc->lc_state = LDC_SND_RDX;
430 DPRINTF(("ldc_send_rdx() setting lc->lc_state to %d\n", lc->lc_state));
431 mutex_exit(&lc->lc_txq->lq_mtx);
436 ldc_send_unreliable(struct ldc_conn *lc, void *msg, size_t len)
444 mutex_enter(&lc->lc_txq->lq_mtx);
445 err = hv_ldc_tx_get_state(lc->lc_id, &tx_head, &tx_tail, &tx_state);
447 mutex_exit(&lc->lc_txq->lq_mtx);
453 lc->lc_txq->lq_nentries - 1;
454 tx_avail %= lc->lc_txq->lq_nentries;
456 mutex_exit(&lc->lc_txq->lq_mtx);
461 lp = (struct ldc_pkt *)(uintptr_t)(lc->lc_txq->lq_va + tx_tail);
470 lp->seqid = lc->lc_tx_seqid++;
474 tx_tail &= ((lc->lc_txq->lq_nentries * sizeof(*lp)) - 1);
475 err = hv_ldc_tx_set_qtail(lc->lc_id, tx_tail);
478 mutex_exit(&lc->lc_txq->lq_mtx);
485 mutex_exit(&lc->lc_txq->lq_mtx);
490 ldc_reset(struct ldc_conn *lc)
498 mutex_enter(&lc->lc_txq->lq_mtx);
501 err = hv_ldc_tx_qconf(lc->lc_id,
502 lc->lc_txq->lq_map->dm_segs[0].ds_addr, lc->lc_txq->lq_nentries);
504 va = lc->lc_txq->lq_va;
508 err = hv_ldc_tx_qconf(lc->lc_id, pa, lc->lc_txq->lq_nentries);
514 err = hv_ldc_rx_qconf(lc->lc_id,
515 lc->lc_rxq->lq_map->dm_segs[0].ds_addr, lc->lc_rxq->lq_nentries);
517 va = lc->lc_rxq->lq_va;
521 err = hv_ldc_tx_qconf(lc->lc_id, pa, lc->lc_rxq->lq_nentries);
526 lc->lc_tx_seqid = 0;
527 lc->lc_state = 0;
528 lc->lc_tx_state = lc->lc_rx_state = LDC_CHANNEL_DOWN;
529 mutex_exit(&lc->lc_txq->lq_mtx);
531 lc->lc_reset(lc);