void oct_send_response(cvmx_wqe_t *work, uint16_t opcode, void *data, uint32_t size) { void *resp = NULL; rpc_ether_hdr_t *hdr; rpc_msg_t *rpcmsg; resp = (void *)cvmx_phys_to_ptr(work->packet_ptr.s.addr); hdr = (rpc_ether_hdr_t *)resp; hdr->type = ETH_P; rpcmsg = (rpc_msg_t *)((uint8_t *)resp + sizeof(rpc_ether_hdr_t)); rpcmsg->opcode = opcode; rpcmsg->info_len = size; memcpy((void *)rpcmsg->info_buf, data, size); work->packet_ptr.s.size = sizeof(rpc_ether_hdr_t) + sizeof(rpc_msg_t) + rpcmsg->info_len; cvmx_wqe_set_len(work, work->packet_ptr.s.size); cvmx_wqe_set_port(work, 0); cvmx_wqe_set_grp(work, TO_LINUX_GROUP); cvmx_pow_work_submit(work, work->word1.tag, work->word1.tag_type, cvmx_wqe_get_qos(work), TO_LINUX_GROUP); }
uint32_t oct_pow_se2linux(mbuf_t *m) { cvmx_wqe_t *work = NULL; uint8_t input = 0; uint8_t linux_group = 0; /* Get a work queue entry */ work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL); if(NULL == work) { return SEC_NO; } memset(work, 0, sizeof(cvmx_wqe_t)); work->packet_ptr.u64 = m->packet_ptr.u64; work->word2.s.bufs = 1; input = m->input_port; if(input == 0) { linux_group = POW0_LINUX_GROUP; } else if (input == 1) { linux_group = POW1_LINUX_GROUP; } else if (input == 2) { linux_group = POW2_LINUX_GROUP; } else if (input == 3) { linux_group = POW3_LINUX_GROUP; } else { return SEC_NO; } cvmx_wqe_set_len(work, m->pkt_totallen); cvmx_wqe_set_port(work, m->input_port); cvmx_wqe_set_grp(work, linux_group); cvmx_pow_work_submit(work, 0, 0, 0, linux_group); MBUF_FREE(m); return SEC_OK; }