struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, u64 addr, size_t length) { struct hpsb_packet *packet; if (length == 0) return NULL; packet = hpsb_alloc_packet(length); if (!packet) return NULL; packet->host = host; packet->node_id = node; if (hpsb_get_tlabel(packet)) { hpsb_free_packet(packet); return NULL; } if (length == 4) fill_async_readquad(packet, addr); else fill_async_readblock(packet, addr, length); return packet; }
struct hpsb_packet *hpsb_make_readbpacket(struct hpsb_host *host, nodeid_t node, u64 addr, size_t length) { struct hpsb_packet *p; p = alloc_hpsb_packet(length + (length % 4 ? 4 - (length % 4) : 0)); if (!p) return NULL; p->host = host; p->tlabel = get_tlabel(host, node, 1); p->node_id = node; fill_async_readblock(p, addr, length); return p; }