drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c- Extension
.c- Size
- 61525 bytes
- Lines
- 2176
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/ipv6.hcxgb4.ht4_regs.ht4_tcb.ht4_values.hclip_tbl.hl2t.hsmt.ht4fw_api.hcxgb4_filter.h
Detected Declarations
function Copyrightfunction unsupportedfunction set_tcb_fieldfunction set_tcb_tflagfunction mk_abort_req_ulpfunction mk_abort_rpl_ulpfunction mk_set_tcb_ulpfunction configure_filter_smacfunction set_nat_paramsfunction validate_filterfunction get_filter_steerqfunction get_filter_countfunction cxgb4_get_filter_countersfunction cxgb4_filter_prio_in_rangefunction cxgb4_get_free_ftidfunction cxgb4_set_ftidfunction cxgb4_set_hpftidfunction cxgb4_clear_ftidfunction cxgb4_clear_hpftidfunction del_filter_wrfunction set_filter_wrfunction Tablefunction writable_filterfunction delete_filterfunction clear_filterfunction clear_all_filtersfunction fill_default_maskfunction is_addr_all_maskfunction is_inaddr_anyfunction is_filter_exact_matchfunction hash_filter_ntuplefunction mk_act_open_req6function mk_act_open_reqfunction cxgb4_set_hash_filterfunction Tablefunction __cxgb4_set_filterfunction cxgb4_del_hash_filterfunction __cxgb4_del_filterfunction cxgb4_set_filterfunction cxgb4_del_filterfunction configure_filter_tcbfunction hash_del_filter_rplfunction hash_filter_rplfunction filter_rplfunction init_hash_filter
Annotated Snippet
if (f->fs.type) {
set_tcb_field(adap, f, tid, TCB_SND_UNA_RAW_W,
WORD_MASK, f->fs.nat_lip[15] |
f->fs.nat_lip[14] << 8 |
f->fs.nat_lip[13] << 16 |
(u64)f->fs.nat_lip[12] << 24, 1);
set_tcb_field(adap, f, tid, TCB_SND_UNA_RAW_W + 1,
WORD_MASK, f->fs.nat_lip[11] |
f->fs.nat_lip[10] << 8 |
f->fs.nat_lip[9] << 16 |
(u64)f->fs.nat_lip[8] << 24, 1);
set_tcb_field(adap, f, tid, TCB_SND_UNA_RAW_W + 2,
WORD_MASK, f->fs.nat_lip[7] |
f->fs.nat_lip[6] << 8 |
f->fs.nat_lip[5] << 16 |
(u64)f->fs.nat_lip[4] << 24, 1);
set_tcb_field(adap, f, tid, TCB_SND_UNA_RAW_W + 3,
WORD_MASK, f->fs.nat_lip[3] |
f->fs.nat_lip[2] << 8 |
f->fs.nat_lip[1] << 16 |
(u64)f->fs.nat_lip[0] << 24, 1);
} else {
set_tcb_field(adap, f, tid, TCB_RX_FRAG3_LEN_RAW_W,
WORD_MASK, f->fs.nat_lip[3] |
f->fs.nat_lip[2] << 8 |
f->fs.nat_lip[1] << 16 |
(u64)f->fs.nat_lip[0] << 24, 1);
}
}
if (sip) {
if (f->fs.type) {
set_tcb_field(adap, f, tid, TCB_RX_FRAG2_PTR_RAW_W,
WORD_MASK, f->fs.nat_fip[15] |
f->fs.nat_fip[14] << 8 |
f->fs.nat_fip[13] << 16 |
(u64)f->fs.nat_fip[12] << 24, 1);
set_tcb_field(adap, f, tid, TCB_RX_FRAG2_PTR_RAW_W + 1,
WORD_MASK, f->fs.nat_fip[11] |
f->fs.nat_fip[10] << 8 |
f->fs.nat_fip[9] << 16 |
(u64)f->fs.nat_fip[8] << 24, 1);
set_tcb_field(adap, f, tid, TCB_RX_FRAG2_PTR_RAW_W + 2,
WORD_MASK, f->fs.nat_fip[7] |
f->fs.nat_fip[6] << 8 |
f->fs.nat_fip[5] << 16 |
(u64)f->fs.nat_fip[4] << 24, 1);
set_tcb_field(adap, f, tid, TCB_RX_FRAG2_PTR_RAW_W + 3,
WORD_MASK, f->fs.nat_fip[3] |
f->fs.nat_fip[2] << 8 |
f->fs.nat_fip[1] << 16 |
(u64)f->fs.nat_fip[0] << 24, 1);
} else {
set_tcb_field(adap, f, tid,
TCB_RX_FRAG3_START_IDX_OFFSET_RAW_W,
WORD_MASK, f->fs.nat_fip[3] |
f->fs.nat_fip[2] << 8 |
f->fs.nat_fip[1] << 16 |
(u64)f->fs.nat_fip[0] << 24, 1);
}
}
set_tcb_field(adap, f, tid, TCB_PDU_HDR_LEN_W, WORD_MASK,
(dp ? (nat_lp[1] | nat_lp[0] << 8) : 0) |
(sp ? (nat_fp[1] << 16 | (u64)nat_fp[0] << 24) : 0),
1);
}
/* Validate filter spec against configuration done on the card. */
static int validate_filter(struct net_device *dev,
struct ch_filter_specification *fs)
{
struct adapter *adapter = netdev2adap(dev);
u32 fconf, iconf;
/* Check for unconfigured fields being used. */
iconf = adapter->params.tp.ingress_config;
fconf = fs->hash ? adapter->params.tp.filter_mask :
adapter->params.tp.vlan_pri_map;
if (unsupported(fconf, FCOE_F, fs->val.fcoe, fs->mask.fcoe) ||
unsupported(fconf, PORT_F, fs->val.iport, fs->mask.iport) ||
unsupported(fconf, TOS_F, fs->val.tos, fs->mask.tos) ||
Annotation
- Immediate include surface: `net/ipv6.h`, `cxgb4.h`, `t4_regs.h`, `t4_tcb.h`, `t4_values.h`, `clip_tbl.h`, `l2t.h`, `smt.h`.
- Detected declarations: `function Copyright`, `function unsupported`, `function set_tcb_field`, `function set_tcb_tflag`, `function mk_abort_req_ulp`, `function mk_abort_rpl_ulp`, `function mk_set_tcb_ulp`, `function configure_filter_smac`, `function set_nat_params`, `function validate_filter`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.