xpp: correct size for BRI multibyte packets

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
This commit is contained in:
Tzafrir Cohen 2017-03-27 18:48:45 +03:00
parent 95de230835
commit b8b884d205
2 changed files with 10 additions and 6 deletions

View File

@ -564,7 +564,7 @@ static void fill_multibyte(xpd_t *xpd, xpacket_t *pack,
char *p;
XPACKET_INIT(pack, GLOBAL, REGISTER_REQUEST, xpd->xbus_idx, 0, 0);
XPACKET_LEN(pack) = RPACKET_SIZE(GLOBAL, REGISTER_REQUEST);
XPACKET_LEN(pack) = XFRAME_CMD_LEN(REG);
reg_cmd = &RPACKET_FIELD(pack, GLOBAL, REGISTER_REQUEST, reg_cmd);
reg_cmd->h.bytes = len;
reg_cmd->h.is_multibyte = 1;
@ -610,7 +610,7 @@ static int tx_dchan(xpd_t *xpd)
return -ENOMEM;
}
for (packet_count = 0, eoframe = 0; !eoframe; packet_count++) {
int packet_len = RPACKET_SIZE(GLOBAL, REGISTER_REQUEST);
int packet_len = XFRAME_CMD_LEN(REG);
char buf[MULTIBYTE_MAX_LEN];
int len = MULTIBYTE_MAX_LEN;

View File

@ -222,12 +222,16 @@ typedef struct reg_cmd {
#ifdef __KERNEL__
#define XFRAME_CMD_LEN(variant) \
( \
sizeof(struct xpacket_header) + \
sizeof(struct reg_cmd_header) + \
sizeof(struct reg_cmd_ ## variant) \
)
#define XFRAME_NEW_REG_CMD(frm, p, xbus, card, variant, to) \
do { \
int pack_len = \
sizeof(struct xpacket_header) + \
sizeof(struct reg_cmd_header) + \
sizeof(struct reg_cmd_ ## variant); \
int pack_len = XFRAME_CMD_LEN(variant); \
\
if (!XBUS_FLAGS(xbus, CONNECTED)) \
return -ENODEV; \