drivers/net/ethernet/meta/fbnic/fbnic_tlv.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/meta/fbnic/fbnic_tlv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/meta/fbnic/fbnic_tlv.c- Extension
.c- Size
- 23036 bytes
- Lines
- 837
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/gfp.hlinux/mm.hlinux/once.hlinux/random.hlinux/string.huapi/linux/if_ether.hfbnic_tlv.h
Detected Declarations
struct fbnic_tlv_testfunction fbnic_tlv_attr_put_flagfunction fbnic_tlv_attr_put_valuefunction __fbnic_tlv_attr_put_intfunction fbnic_tlv_attr_put_mac_addrfunction fbnic_tlv_attr_put_stringfunction fbnic_tlv_attr_get_unsignedfunction fbnic_tlv_attr_get_signedfunction fbnic_tlv_attr_get_stringfunction fbnic_tlv_attr_nest_stopfunction fbnic_tlv_attr_validatefunction fbnic_tlv_attr_parse_arrayfunction fbnic_tlv_attr_parsefunction fbnic_tlv_msg_parsefunction fbnic_tlv_parser_errorfunction fbnic_tlv_test_struct_initfunction fbnic_tlv_test_attr_datafunction fbnic_tlv_attr_addr_copyfunction fbnic_tlv_parser_test_attrfunction fbnic_tlv_test_dumpfunction fbnic_tlv_parser_test
Annotated Snippet
struct fbnic_tlv_test {
u64 test_u64;
s64 test_s64;
u32 test_u32;
s32 test_s32;
u16 test_u16;
s16 test_s16;
u8 test_mac[ETH_ALEN];
u8 test_mac_array[4][ETH_ALEN];
u8 test_true;
u8 test_false;
char test_string[FBNIC_TLV_TEST_STRING_LEN];
};
static struct fbnic_tlv_test test_struct;
const struct fbnic_tlv_index fbnic_tlv_test_index[] = {
FBNIC_TLV_ATTR_U64(FBNIC_TLV_TEST_MSG_U64),
FBNIC_TLV_ATTR_S64(FBNIC_TLV_TEST_MSG_S64),
FBNIC_TLV_ATTR_U32(FBNIC_TLV_TEST_MSG_U32),
FBNIC_TLV_ATTR_S32(FBNIC_TLV_TEST_MSG_S32),
FBNIC_TLV_ATTR_U32(FBNIC_TLV_TEST_MSG_U16),
FBNIC_TLV_ATTR_S32(FBNIC_TLV_TEST_MSG_S16),
FBNIC_TLV_ATTR_MAC_ADDR(FBNIC_TLV_TEST_MSG_MAC_ADDR),
FBNIC_TLV_ATTR_FLAG(FBNIC_TLV_TEST_MSG_FLAG_TRUE),
FBNIC_TLV_ATTR_FLAG(FBNIC_TLV_TEST_MSG_FLAG_FALSE),
FBNIC_TLV_ATTR_STRING(FBNIC_TLV_TEST_MSG_STRING,
FBNIC_TLV_TEST_STRING_LEN),
FBNIC_TLV_ATTR_ARRAY(FBNIC_TLV_TEST_MSG_ARRAY),
FBNIC_TLV_ATTR_NESTED(FBNIC_TLV_TEST_MSG_NESTED),
FBNIC_TLV_ATTR_LAST
};
static void fbnic_tlv_test_struct_init(void)
{
int i = FBNIC_TLV_TEST_STRING_LEN - 1;
/* Populate the struct with random data */
get_random_once(&test_struct,
offsetof(struct fbnic_tlv_test, test_string) + i);
/* Force true/false to their expected values */
test_struct.test_false = false;
test_struct.test_true = true;
/* Convert test_string to a true ASCII string */
test_struct.test_string[i] = '\0';
while (i--) {
/* Force characters into displayable range */
if (test_struct.test_string[i] < 64 ||
test_struct.test_string[i] >= 96) {
test_struct.test_string[i] %= 32;
test_struct.test_string[i] += 64;
}
}
}
static int fbnic_tlv_test_attr_data(struct fbnic_tlv_msg *msg)
{
struct fbnic_tlv_msg *array;
int err, i;
err = fbnic_tlv_attr_put_int(msg, FBNIC_TLV_TEST_MSG_U64,
test_struct.test_u64);
if (err)
return err;
err = fbnic_tlv_attr_put_int(msg, FBNIC_TLV_TEST_MSG_S64,
test_struct.test_s64);
if (err)
return err;
err = fbnic_tlv_attr_put_int(msg, FBNIC_TLV_TEST_MSG_U32,
test_struct.test_u32);
if (err)
return err;
err = fbnic_tlv_attr_put_int(msg, FBNIC_TLV_TEST_MSG_S32,
test_struct.test_s32);
if (err)
return err;
err = fbnic_tlv_attr_put_int(msg, FBNIC_TLV_TEST_MSG_U16,
test_struct.test_u16);
if (err)
return err;
err = fbnic_tlv_attr_put_int(msg, FBNIC_TLV_TEST_MSG_S16,
test_struct.test_s16);
if (err)
Annotation
- Immediate include surface: `linux/gfp.h`, `linux/mm.h`, `linux/once.h`, `linux/random.h`, `linux/string.h`, `uapi/linux/if_ether.h`, `fbnic_tlv.h`.
- Detected declarations: `struct fbnic_tlv_test`, `function fbnic_tlv_attr_put_flag`, `function fbnic_tlv_attr_put_value`, `function __fbnic_tlv_attr_put_int`, `function fbnic_tlv_attr_put_mac_addr`, `function fbnic_tlv_attr_put_string`, `function fbnic_tlv_attr_get_unsigned`, `function fbnic_tlv_attr_get_signed`, `function fbnic_tlv_attr_get_string`, `function fbnic_tlv_attr_nest_stop`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.