drivers/net/ethernet/meta/fbnic/fbnic_rpc.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/meta/fbnic/fbnic_rpc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/meta/fbnic/fbnic_rpc.c- Extension
.c- Size
- 36336 bytes
- Lines
- 1246
- 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/etherdevice.hlinux/ethtool.hnet/ipv6.hfbnic.hfbnic_fw.hfbnic_netdev.hfbnic_rpc.h
Detected Declarations
function fbnic_reset_indir_tblfunction fbnic_rss_key_fillfunction fbnic_rss_init_en_maskfunction fbnic_rss_disable_hwfunction FIELD_GETfunction fbnic_rss_reinit_hwfunction fbnic_bmc_rpc_all_multi_configfunction fbnic_bmc_rpc_initfunction fbnic_bmc_rpc_checkfunction fbnic_rss_reinitfunction __fbnic_xc_unsyncfunction fbnic_promisc_syncfunction fbnic_sift_macdafunction fbnic_clear_macda_entryfunction fbnic_clear_macdafunction fbnic_clear_valid_macdafunction fbnic_write_macda_entryfunction fbnic_write_macdafunction fbnic_clear_act_tcamfunction fbnic_clear_tce_tcam_entryfunction fbnic_write_tce_tcam_destfunction fbnic_write_tce_tcam_entryfunction __fbnic_write_tce_tcam_revfunction __fbnic_write_tce_tcamfunction fbnic_write_tce_tcamfunction __fbnic_ip_unsyncfunction fbnic_clear_ip_src_entryfunction fbnic_clear_ip_dst_entryfunction fbnic_clear_ip_outer_src_entryfunction fbnic_clear_ip_outer_dst_entryfunction fbnic_write_ip_src_entryfunction fbnic_write_ip_dst_entryfunction fbnic_write_ip_outer_src_entryfunction fbnic_write_ip_outer_dst_entryfunction fbnic_write_ip_addrfunction fbnic_clear_valid_act_tcamfunction fbnic_clear_rulesfunction fbnic_delete_act_tcamfunction fbnic_update_act_tcamfunction fbnic_write_rulesfunction fbnic_rpc_reset_valid_entries
Annotated Snippet
if (mac_addr->state != FBNIC_TCAM_S_VALID) {
eth_zero_addr(mac_addr->value.addr8);
eth_broadcast_addr(mac_addr->mask.addr8);
mac_addr->value.addr8[0] ^= 1;
mac_addr->mask.addr8[0] ^= 1;
set_bit(FBNIC_MAC_ADDR_T_BMC, mac_addr->act_tcam);
mac_addr->state = FBNIC_TCAM_S_ADD;
}
if (enable_host)
set_bit(FBNIC_MAC_ADDR_T_ALLMULTI,
mac_addr->act_tcam);
else
clear_bit(FBNIC_MAC_ADDR_T_ALLMULTI,
mac_addr->act_tcam);
} else {
__fbnic_xc_unsync(mac_addr, FBNIC_MAC_ADDR_T_BMC);
__fbnic_xc_unsync(mac_addr, FBNIC_MAC_ADDR_T_ALLMULTI);
}
/* We have to add a special handler for multicast as the
* BMC may have an all-multi rule already in place. As such
* adding a rule ourselves won't do any good so we will have
* to modify the rules for the ALL MULTI below if the BMC
* already has the rule in place.
*/
act_tcam = &fbd->act_tcam[FBNIC_RPC_ACT_TBL_BMC_ALL_MULTI_OFFSET];
/* If we are not enabling the rule just delete it. We will fall
* back to the RSS rules that support the multicast addresses.
*/
if (!fbnic_bmc_present(fbd) || !fbd->fw_cap.all_multi || enable_host) {
if (act_tcam->state == FBNIC_TCAM_S_VALID)
act_tcam->state = FBNIC_TCAM_S_DELETE;
return;
}
/* Rewrite TCAM rule 23 to handle BMC all-multi traffic */
act_tcam->dest = FIELD_PREP(FBNIC_RPC_ACT_TBL0_DEST_MASK,
FBNIC_RPC_ACT_TBL0_DEST_BMC);
act_tcam->mask.tcam[0] = 0xffff;
/* MACDA 0 - 3 is reserved for the BMC MAC address */
act_tcam->value.tcam[1] =
FIELD_PREP(FBNIC_RPC_TCAM_ACT1_L2_MACDA_IDX,
fbd->mac_addr_boundary - 1) |
FBNIC_RPC_TCAM_ACT1_L2_MACDA_VALID;
act_tcam->mask.tcam[1] = 0xffff &
~FBNIC_RPC_TCAM_ACT1_L2_MACDA_IDX &
~FBNIC_RPC_TCAM_ACT1_L2_MACDA_VALID;
for (j = 2; j < FBNIC_RPC_TCAM_ACT_WORD_LEN; j++)
act_tcam->mask.tcam[j] = 0xffff;
act_tcam->state = FBNIC_TCAM_S_UPDATE;
}
void fbnic_bmc_rpc_init(struct fbnic_dev *fbd)
{
int i = FBNIC_RPC_TCAM_MACDA_BMC_ADDR_IDX;
struct fbnic_act_tcam *act_tcam;
struct fbnic_mac_addr *mac_addr;
int j;
/* Check if BMC is present */
if (!fbnic_bmc_present(fbd))
return;
/* Fetch BMC MAC addresses from firmware capabilities */
for (j = 0; j < 4; j++) {
u8 *bmc_mac = fbd->fw_cap.bmc_mac_addr[j];
/* Validate BMC MAC addresses */
if (is_zero_ether_addr(bmc_mac))
continue;
if (is_multicast_ether_addr(bmc_mac))
mac_addr = __fbnic_mc_sync(fbd, bmc_mac);
else
mac_addr = &fbd->mac_addr[i++];
if (!mac_addr) {
netdev_err(fbd->netdev,
"No slot for BMC MAC address[%d]\n", j);
continue;
}
ether_addr_copy(mac_addr->value.addr8, bmc_mac);
eth_zero_addr(mac_addr->mask.addr8);
set_bit(FBNIC_MAC_ADDR_T_BMC, mac_addr->act_tcam);
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/ethtool.h`, `net/ipv6.h`, `fbnic.h`, `fbnic_fw.h`, `fbnic_netdev.h`, `fbnic_rpc.h`.
- Detected declarations: `function fbnic_reset_indir_tbl`, `function fbnic_rss_key_fill`, `function fbnic_rss_init_en_mask`, `function fbnic_rss_disable_hw`, `function FIELD_GET`, `function fbnic_rss_reinit_hw`, `function fbnic_bmc_rpc_all_multi_config`, `function fbnic_bmc_rpc_init`, `function fbnic_bmc_rpc_check`, `function fbnic_rss_reinit`.
- 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.