commit d5c865e5804e54a4804fca653742dfacea94fcb0 From: John Fastabend lldpad: use correct array index in bld_dcbx2_pg_tlv Incorrect array index's are being used in bld_dcbx2_pg_tlv, resulting in the incorrect pgid being set. And make the coding style more Linux. Fix provided by Sourav Chatterjee. Signed-off-by: John Fastabend --- tlv_dcbx.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) -- Signed-off-by: John Fastabend diff --git a/tlv_dcbx.c b/tlv_dcbx.c index 69b4ef6..9b539fc 100644 --- a/tlv_dcbx.c +++ b/tlv_dcbx.c @@ -444,10 +444,15 @@ struct unpacked_tlv *bld_dcbx2_pg_tlv(struct dcbx_tlvs *dcbx, boolean_t *success tmpbyte = 0; if (pg_cfg.tx.up[k].strict_priority == dcb_link) tmpbyte = 0xf; - else tmpbyte = pg_cfg.tx.up[k+1].pgid & 0xf; + else + tmpbyte = pg_cfg.tx.up[k].pgid & 0xf; + + tmpbyte <<= 4; + if (pg_cfg.tx.up[k+1].strict_priority == dcb_link) - tmpbyte |= (0xf) << 4; - else tmpbyte |= (pg_cfg.tx.up[k].pgid & 0xf) << 4; + tmpbyte |= 0xf; + else + tmpbyte |= (pg_cfg.tx.up[k+1].pgid & 0xf); pg_info->data.pg_ids[j] = tmpbyte; } for (i = 0; i < MAX_BANDWIDTH_GROUPS; i++) {