log: normalize packet burst messages

This commit is contained in:
OAI
2026-06-01 12:16:51 +00:00
committed by Mario Fetka
parent ace258eb4e
commit 6947aa046d

View File

@@ -5701,7 +5701,7 @@ static int send_burst(int offset, int datasize, int flags)
memcpy(sb+1, burst_w->send_buf+offset, datasize);
burst_w->ud.udata.len =
burst_w->ud.udata.maxlen = datasize+sizeof(BURSTPACKET);
XDPRINTF((8, 0, "Packet Burst send packet: seq=%u off=%d size=%d flags=0x%x",
XDPRINTF((8, 0, "DBUG BURST SEND seq=%u off=%d size=%d flags=0x%x",
(unsigned)(burst_w->packet_sequence-1), offset, datasize, flags));
if (t_sndudata(FD_NCP_OUT, &(burst_w->ud)) < 0){
if (nw_debug) t_error("t_sndudata in NWCONN !OK");
@@ -5726,7 +5726,7 @@ static void handle_burst_response(uint32 offset, int size)
U16_TO_BE16(burst_w->burst_sequence+1, sb->ack_seq);
U32_TO_BE32(size, sb->burstsize);
XDPRINTF((3, 0, "Packet Burst response: seq=%u offset=%u size=%d max_packet_data=%d",
XDPRINTF((3, 0, "DBUG BURST RESPONSE seq=%u offset=%u size=%d max_packet_data=%d",
(unsigned)burst_w->burst_sequence, (unsigned)offset, size,
burst_w->max_burst_data_size));
@@ -5751,13 +5751,13 @@ static void handle_burst(BURSTPACKET *bp, int len)
int burstsequence = GET_BE16(bp->burst_seq);
int datasize = GET_BE16(bp->datasize);
XDPRINTF((6, 0, "Packet Burst recv packet: seq=%d flags=0x%x off=%u datasize=%d len=%d",
XDPRINTF((6, 0, "DBUG BURST RECV seq=%d flags=0x%x off=%u datasize=%d len=%d",
burstsequence, bp->flags, (unsigned)burstoffset, datasize, len));
if (datasize && !(bp->flags & 0x80)) {
/* copy if no System Packet */
if (datasize+burstoffset > burst_w->max_recv_size+24) {
XDPRINTF((1, 0, "recv burstpacket offs=%d+size=%d > max_recv+24=%d",
XDPRINTF((1, 0, "WARN BURST REJECT reason=recv_overflow off=%d size=%d max_recv_plus_24=%d",
burstoffset, datasize, burst_w->max_recv_size+24));
return;
}
@@ -5793,19 +5793,19 @@ static void handle_burst(BURSTPACKET *bp, int len)
} *xdata= (struct XDATA*)burst_w->send_buf;
int zusatz = 0; /* (foffset & 1) ? 1 : 0; */
int size;
XDPRINTF((2, 0, "Packet Burst READ request: fh=0x%x off=%u size=%u seq=%d",
XDPRINTF((2, 0, "DBUG BURST READ_REQUEST fh=0x%x off=%u size=%u seq=%d",
(unsigned)fhandle, (unsigned)foffset, (unsigned)fsize,
burstsequence));
size = nw_read_file(fhandle,
burst_w->send_buf+sizeof(struct XDATA),
fsize, foffset);
if (zusatz) {
XDPRINTF((1, 0, "foffset=%d, fsize=%d", foffset, fsize));
XDPRINTF((1, 0, "DBUG BURST READ_ALIGNMENT off=%d size=%d", foffset, fsize));
}
if (size > -1) {
U32_TO_32(0, xdata->resultcode);
U32_TO_BE32(size, xdata->readbytes);
XDPRINTF((2, 0, "Packet Burst READ reply: fh=0x%x off=%u requested=%u read=%d",
XDPRINTF((2, 0, "DBUG BURST READ_REPLY fh=0x%x off=%u requested=%u read=%d",
(unsigned)fhandle, (unsigned)foffset, (unsigned)fsize, size));
} else {
U32_TO_32(3, xdata->resultcode);
@@ -5822,37 +5822,37 @@ static void handle_burst(BURSTPACKET *bp, int len)
*/
} *xdata= (struct XDATA*)burst_w->send_buf;
int size;
XDPRINTF((2, 0, "Packet Burst WRITE request: fh=0x%x off=%u size=%u seq=%d",
XDPRINTF((2, 0, "DBUG BURST WRITE_REQUEST fh=0x%x off=%u size=%u seq=%d",
(unsigned)fhandle, (unsigned)foffset, (unsigned)fsize,
burstsequence));
size = nw_write_file(fhandle, req->data, fsize, foffset);
U32_TO_32(size==fsize ? 0 : 4, xdata->resultcode);
XDPRINTF((2, 0, "Packet Burst WRITE reply: fh=0x%x off=%u requested=%u written=%d result=%s",
XDPRINTF((2, 0, "DBUG BURST WRITE_REPLY fh=0x%x off=%u requested=%u written=%d result=%s",
(unsigned)fhandle, (unsigned)foffset, (unsigned)fsize, size,
size==fsize ? "ok" : "error"));
burst_w->burst_sequence = burstsequence;
handle_burst_response(0, sizeof(struct XDATA));
}
} else {
XDPRINTF((1, 0, "burst unknow function=0x%x", function));
XDPRINTF((1, 0, "WARN BURST UNKNOWN function=0x%x result=ignored", function));
}
req->function[0]=0;
} else if (bp->flags & 0x80) { /* System Flag */
int missing=GET_BE16(bp->missing);
uint8 *p=(uint8*)(bp+1);
burst_w->burst_sequence = burstsequence;
XDPRINTF((3, 0, "Packet Burst missing-list request: seq=%d missing=%d",
XDPRINTF((3, 0, "DBUG BURST MISSING_REQUEST seq=%d missing=%d",
burstsequence, missing));
while (missing--){
int offs=GET_BE32(p);
int size=GET_BE16(p+4);
XDPRINTF((3, 0, "Packet Burst resend range: off=%d size=%d", offs, size));
XDPRINTF((3, 0, "DBUG BURST RESEND off=%d size=%d", offs, size));
handle_burst_response(offs, size);
p+=6;
}
}
} else {
XDPRINTF((1, 0, "burst_w not allocated"));
XDPRINTF((1, 0, "WARN BURST REJECT reason=not_allocated"));
}
}
#endif