Lines Matching refs:opts
55 bcm_xtlv_hdr_size(bcm_xtlv_opts_t opts) in bcm_xtlv_hdr_size() argument
58 if (opts & BCM_XTLV_OPTION_LENU8) --len; in bcm_xtlv_hdr_size()
59 if (opts & BCM_XTLV_OPTION_IDU8) --len; in bcm_xtlv_hdr_size()
65 bcm_valid_xtlv(const bcm_xtlv_t *elt, int buf_len, bcm_xtlv_opts_t opts) in bcm_valid_xtlv() argument
68 buf_len >= bcm_xtlv_hdr_size(opts) && in bcm_valid_xtlv()
69 buf_len >= bcm_xtlv_size(elt, opts); in bcm_valid_xtlv()
73 bcm_xtlv_size_for_data(int dlen, bcm_xtlv_opts_t opts) in bcm_xtlv_size_for_data() argument
77 hsz = bcm_xtlv_hdr_size(opts); in bcm_xtlv_size_for_data()
78 return ((opts & BCM_XTLV_OPTION_ALIGN32) ? ALIGN_SIZE(dlen + hsz, 4) in bcm_xtlv_size_for_data()
83 bcm_xtlv_size(const bcm_xtlv_t *elt, bcm_xtlv_opts_t opts) in bcm_xtlv_size() argument
88 len = BCM_XTLV_LEN_EX(elt, opts); in bcm_xtlv_size()
89 size = bcm_xtlv_size_for_data(len, opts); in bcm_xtlv_size()
94 bcm_xtlv_len(const bcm_xtlv_t *elt, bcm_xtlv_opts_t opts) in bcm_xtlv_len() argument
100 if (opts & BCM_XTLV_OPTION_IDU8) { in bcm_xtlv_len()
104 if (opts & BCM_XTLV_OPTION_LENU8) { in bcm_xtlv_len()
106 } else if (opts & BCM_XTLV_OPTION_LENBE) { in bcm_xtlv_len()
116 bcm_xtlv_id(const bcm_xtlv_t *elt, bcm_xtlv_opts_t opts) in bcm_xtlv_id() argument
119 if (opts & BCM_XTLV_OPTION_IDU8) { in bcm_xtlv_id()
121 } else if (opts & BCM_XTLV_OPTION_IDBE) { in bcm_xtlv_id()
131 bcm_next_xtlv(const bcm_xtlv_t *elt, int *buflen, bcm_xtlv_opts_t opts) in bcm_next_xtlv() argument
135 sz = BCM_XTLV_SIZE_EX(elt, opts); in bcm_next_xtlv()
140 if (!bcm_valid_xtlv(elt, *buflen, opts)) in bcm_next_xtlv()
149 bcm_xtlv_buf_init(bcm_xtlvbuf_t *tlv_buf, uint8 *buf, uint16 len, bcm_xtlv_opts_t opts) in bcm_xtlv_buf_init() argument
154 tlv_buf->opts = opts; in bcm_xtlv_buf_init()
200 bcm_xtlv_opts_t opts) in bcm_xtlv_pack_xtlv() argument
205 if (!(opts & mask)) { /* default */ in bcm_xtlv_pack_xtlv()
211 } else if ((opts & mask) == mask) { /* u8 id and u8 len */ in bcm_xtlv_pack_xtlv()
217 } else if (opts & BCM_XTLV_OPTION_IDU8) { /* u8 id, u16 len */ in bcm_xtlv_pack_xtlv()
223 } else if (opts & BCM_XTLV_OPTION_LENU8) { /* u16 id, u8 len */ in bcm_xtlv_pack_xtlv()
236 if (opts & BCM_XTLV_OPTION_LENU8) { in bcm_xtlv_pack_xtlv()
248 const uint8 **data, bcm_xtlv_opts_t opts) in bcm_xtlv_unpack_xtlv() argument
251 *type = (uint16)bcm_xtlv_id(xtlv, opts); in bcm_xtlv_unpack_xtlv()
253 *len = (uint16)bcm_xtlv_len(xtlv, opts); in bcm_xtlv_unpack_xtlv()
255 *data = (const uint8 *)xtlv + BCM_XTLV_HDR_SIZE_EX(opts); in bcm_xtlv_unpack_xtlv()
267 size = bcm_xtlv_size_for_data(n, tbuf->opts); in bcm_xtlv_put_data()
272 bcm_xtlv_pack_xtlv(xtlv, type, (uint16)n, data, tbuf->opts); in bcm_xtlv_put_data()
298 xtlv_data = (uint8 *)xtlv + bcm_xtlv_hdr_size(tbuf->opts); in bcm_xtlv_put_int()
359 uint8 *dst_data, bcm_xtlv_opts_t opts) in bcm_unpack_xtlv_entry() argument
368 bcm_xtlv_unpack_xtlv(ptlv, &type, &len, &data, opts); in bcm_unpack_xtlv_entry()
376 *tlv_buf += BCM_XTLV_SIZE_EX(ptlv, opts); in bcm_unpack_xtlv_entry()
386 const uint8 *src_data, bcm_xtlv_opts_t opts) in bcm_pack_xtlv_entry() argument
393 size = bcm_xtlv_size_for_data(len, opts); in bcm_pack_xtlv_entry()
399 bcm_xtlv_pack_xtlv(ptlv, type, len, src_data, opts); in bcm_pack_xtlv_entry()
413 bcm_unpack_xtlv_buf(void *ctx, const uint8 *tlv_buf, uint16 buflen, bcm_xtlv_opts_t opts, in bcm_unpack_xtlv_buf() argument
428 hdr_size = BCM_XTLV_HDR_SIZE_EX(opts); in bcm_unpack_xtlv_buf()
432 bcm_xtlv_unpack_xtlv(ptlv, &type, &len, &data, opts); in bcm_unpack_xtlv_buf()
433 size = bcm_xtlv_size_for_data(len, opts); in bcm_unpack_xtlv_buf()
447 bcm_pack_xtlv_buf(void *ctx, uint8 *tlv_buf, uint16 buflen, bcm_xtlv_opts_t opts, in bcm_pack_xtlv_buf() argument
467 hdr_size = BCM_XTLV_HDR_SIZE_EX(opts); in bcm_pack_xtlv_buf()
471 size = bcm_xtlv_size_for_data(tlv_len, opts); in bcm_pack_xtlv_buf()
477 bcm_xtlv_pack_xtlv((bcm_xtlv_t *)buf, tlv_id, tlv_len, NULL, opts); in bcm_pack_xtlv_buf()
497 bcm_xtlv_opts_t opts) in bcm_pack_xtlv_buf_from_mem() argument
505 items->len, items->ptr, opts); in bcm_pack_xtlv_buf_from_mem()
522 bcm_xtlv_opts_t opts) in bcm_unpack_xtlv_buf_to_mem() argument
527 elt = bcm_valid_xtlv((bcm_xtlv_t *)tlv_buf, *buflen, opts) ? (bcm_xtlv_t *)tlv_buf : NULL; in bcm_unpack_xtlv_buf_to_mem()
533 for (; elt != NULL && res == BCME_OK; elt = bcm_next_xtlv(elt, buflen, opts)) { in bcm_unpack_xtlv_buf_to_mem()
539 bcm_xtlv_unpack_xtlv(elt, &type, &len, &data, opts); in bcm_unpack_xtlv_buf_to_mem()
566 uint16 *datalen, bcm_xtlv_opts_t opts) in bcm_get_data_from_xtlv_buf() argument
576 hdr_size = BCM_XTLV_HDR_SIZE_EX(opts); in bcm_get_data_from_xtlv_buf()
584 bcm_xtlv_unpack_xtlv(ptlv, &type, &len, &data, opts); in bcm_get_data_from_xtlv_buf()
586 size = bcm_xtlv_size_for_data(len, opts); in bcm_get_data_from_xtlv_buf()
606 int src_buf_len, int dst_buf_len, bcm_xtlv_opts_t opts) in bcm_xtlv_bcopy() argument
609 src = (src && bcm_valid_xtlv(src, src_buf_len, opts)) ? src : NULL; in bcm_xtlv_bcopy()
615 bcm_xtlv_unpack_xtlv(src, &type, &len, &data, opts); in bcm_xtlv_bcopy()
616 size = bcm_xtlv_size_for_data(len, opts); in bcm_xtlv_bcopy()
618 bcm_xtlv_pack_xtlv(dst, type, len, data, opts); in bcm_xtlv_bcopy()