t4_alloc_vi(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– t4_alloc_vi(9) β€” the Kernel API Manual page you didn't know you needed πŸ’–

okay so bestie, welcome to the Kernel API Manual entry for t4_alloc_vi(9), and trust me, this one's a whole thing but we're gonna get through it together 🫢 It's from the kernel-doc girlies in the networking corner, and ngl it's giving "I wrote this at 2am but I ate" energy.


✨ NAME ✨

t4_alloc_vi β€” allocate a virtual interface 🌈

Like, it literally makes you a VI. that's the whole vibe.


πŸŽ€ SYNOPSIS πŸŽ€

int t4_alloc_vi (struct adapter *adap , unsigned int mbox , unsigned int
port , unsigned int pf , unsigned int vf , unsigned int nmac , u8 *mac ,
unsigned int *rss_size , u8 *vivld , u8 *vin );

that's a lot of arguments bestie, but we're gonna break every single one of them down below, no skipping πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • adap β€” the adapter, aka the whole reason we're here 🫢 this is your NIC's main character.
  • mbox β€” the mailbox to use for the FW command. yep, you pick which mailbox you're sliding into. it's for the firmware, iykyk.
  • port β€” the physical port associated with the VI. like which actual plug-in port this interface lives on ✨
  • pf β€” the PF owning the VI. (physical function, for the uninitiated πŸ’€)
  • vf β€” the VF owning the VI. (that's the virtual function, and yes you need both of these, don't come for me)
  • nmac β€” number of MAC addresses needed, and it's a range: 1 to 5. 1 to 5. don't try to be cute and pass 6 πŸ™ˆ
  • mac β€” the MAC addresses of the VI.
  • rss_size β€” size of the RSS table slice associated with this VI. (if you don't know what RSS is, just nod and know it's important πŸŽ€)
  • vivld β€” the destination to store the VI Valid value. yes, it's spelled like that, no I didn't make it up.
  • vin β€” the destination to store the VIN value. (not the car kind πŸ’€ it's the VI number)

πŸ”₯ DESCRIPTION πŸ”₯

okay so, the actual tea: t4_alloc_vi allocates a virtual interface for the given physical port. one adapter, one port, one freshly allocated VI, slay πŸ’…

If mac is not NULL it contains the MAC addresses of the VI as assigned by FW. yes, FW (firmware) is picking your MACs for you like a matchmaker, and honestly, let it πŸ‘‘

Now here's the part where you have to actually pay attention, bestie β€” mac should be large enough to hold nmac Ethernet addresses, they are stored consecutively so the space needed is nmac * 6 bytes. consecutively!! nmac * 6 bytes!! not a byte more, not a byte less, or you get to meet your friend undefined behaviour and that's not a cute look 🫢

It returns a negative error number or the non-negative VI id. so β€” bad news? negative error number, sorry girl 😭. good news? the non-negative VI id, and you can go live your life 🌸


🌟 SEE ALSO 🌟

the source itself lives in the kernel file ./drivers/net/ethernet/chelsio/cxgb4/t4_hw.c β€” go read it if you're feeling brave 🧚

and now the mother of all SEE ALSO lists. I'm not skipping a single one, because these are all icons and they all reference (9), so here we go, buckle up:

t4_wait_op_done_val(9), t4_set_reg_field(9), t4_read_indirect(9), t4_write_indirect(9), t4_record_mbox(9), t4_wr_mbox_meat_timeout(9), t4_memory_rw_init(9), t4_memory_update_win(9), t4_memory_rw_residual(9), t4_memory_rw(9), t4_get_regs_len(9), t4_get_regs(9), t4_eeprom_ptov(9), t4_seeprom_wp(9), t4_get_raw_vpd_params(9), t4_get_vpd_params(9), t4_get_pfres(9), sf1_read(9), sf1_write(9), flash_wait_op(9), t4_read_flash(9), t4_write_flash(9), t4_get_fw_version(9), t4_get_bs_version(9), t4_get_tp_version(9), t4_get_exprom_version(9), t4_get_vpd_version(9), t4_get_scfg_version(9), t4_get_version_info(9), t4_dump_version_info(9), t4_check_fw_version(9), t4_flash_erase_sectors(9), t4_flash_cfg_addr(9), t4_load_fw(9), t4_phy_fw_ver(9), t4_load_phy_fw(9), t4_fwcache(9), fwcaps16_to_caps32(9), fwcaps32_to_caps16(9), t4_link_acaps(9), t4_link_l1cfg_core(9), t4_restart_aneg(9), t4_handle_intr_status(9), t4_slow_intr_handler(9), t4_intr_enable(9), t4_intr_disable(9), t4_config_rss_range(9), t4_config_glbl_rss(9), t4_config_vi_rss(9), t4_read_rss(9), t4_tp_fw_ldst_rw(9), t4_tp_indirect_rw(9), t4_tp_pio_read(9), t4_tp_pio_write(9), t4_tp_tm_pio_read(9), t4_tp_mib_read(9), t4_read_rss_key(9), t4_write_rss_key(9), t4_read_rss_pf_config(9), t4_read_rss_vf_config(9), t4_read_rss_pf_map(9), t4_read_rss_pf_mask(9), t4_tp_get_tcp_stats(9), t4_tp_get_err_stats(9), t4_tp_get_cpl_stats(9), t4_tp_get_rdma_stats(9), t4_get_fcoe_stats(9), t4_get_usm_stats(9), t4_read_mtu_tbl(9), t4_read_cong_tbl(9), t4_tp_wr_bits_indirect(9), init_cong_ctrl(9), t4_load_mtus(9), t4_get_chan_txrate(9), t4_set_trace_filter(9), t4_get_trace_filter(9), t4_pmtx_get_stats(9), t4_pmrx_get_stats(9), compute_mps_bg_map(9), t4_get_mps_bg_map(9), t4_get_tp_e2c_map(9), t4_get_tp_ch_map(9), t4_get_port_type_description(9), t4_get_port_stats_offset(9), t4_get_port_stats(9), t4_get_lb_stats(9), t4_mdio_rd(9), t4_mdio_wr(9), t4_sge_decode_idma_state(9), t4_sge_ctxt_flush(9), t4_read_sge_dbqtimers(9), t4_fw_hello(9), t4_fw_bye(9), t4_early_init(9), t4_fw_reset(9), t4_fw_halt(9), t4_fw_restart(9), t4_fw_upgrade(9), t4_fl_pkt_align(9), t4_fixup_host_params(9), t4_fw_initialize(9), t4_query_params_rw(9), t4_set_params_timeout(9), t4_set_params(9), t4_cfg_pfvf(9), t4_free_vi(9), t4_set_rxmode(9), t4_free_encap_mac_filt(9), t4_free_raw_mac_filt(9), t4_alloc_encap_mac_filt(9), t4_alloc_raw_mac_filt(9), t4_alloc_mac_filt(9), t4_free_mac_filt(9), t4_change_mac(9), t4_set_addr_hash(9), t4_enable_vi_params(9), t4_enable_vi(9), t4_enable_pi_params(9), t4_identify_port(9), t4_iq_stop(9), t4_iq_free(9), t4_eth_eq_free(9), t4_ctrl_eq_free(9), t4_ofld_eq_free(9), t4_link_down_rc_str(9), fwcap_to_fwspeed(9), lstatus_to_fwcap(9), t4_handle_get_port_info(9), t4_update_port_info(9), t4_get_link_params(9), t4_handle_fw_rpl(9), init_link_config(9), t4_prep_adapter(9), t4_shutdown_adapter(9), t4_bar2_sge_qregs(9), t4_init_devlog_params(9), t4_init_sge_params(9), t4_init_tp_params(9), t4_filter_field_shift(9), t4_init_portinfo(9), t4_read_cimq_cfg(9), t4_read_cim_ibq(9), t4_read_cim_obq(9), t4_cim_read(9), t4_cim_write(9), t4_cim_read_la(9), t4_tp_read_la(9), t4_idma_monitor_init(9), t4_idma_monitor(9), t4_load_cfg(9), t4_set_vf_mac_acl(9), t4_read_pace_tbl(9), t4_get_tx_sched(9), t4_sge_ctxt_rd_bd(9), t4_i2c_rd(9), t4_set_vlan_acl(9), modify_device_id(9), t4_load_boot(9), t4_flash_bootcfg_addr(9)

periodt. every single one of them, accounted for πŸ’…

lowkey pro tip from your girl: t4_free_vi(9) is right there in that list for a reason β€” what the kernel allocates, the kernel must free. she's the icon, she's the moment πŸ™ˆ

alright bestie, that's the whole page ✨ this one's stamped ./drivers/net/ethernet/chelsio... and dated October 2026, and it came to you straight from the Kernel API Manual, page t4_alloc_vi(9). now go allocate a VI, but responsibly πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from