drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c- Extension
.c- Size
- 16157 bytes
- Lines
- 598
- 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
linux/pci.hlinux/phylink.hlinux/netdevice.h../libwx/wx_ethtool.h../libwx/wx_type.h../libwx/wx_lib.htxgbe_type.htxgbe_fdir.htxgbe_aml.htxgbe_ethtool.h
Detected Declarations
function txgbe_get_link_ksettingsfunction txgbe_set_ringparamfunction txgbe_get_ethtool_fdir_entryfunction hlist_for_each_entry_safefunction txgbe_get_ethtool_fdir_allfunction hlist_for_each_entry_safefunction txgbe_get_rx_ring_countfunction txgbe_get_rxnfcfunction txgbe_flowspec_to_flow_typefunction txgbe_match_ethtool_fdir_entryfunction hlist_for_each_entry_safefunction txgbe_update_ethtool_fdir_entryfunction hlist_for_each_entry_safefunction txgbe_add_ethtool_fdir_entryfunction txgbe_del_ethtool_fdir_entryfunction txgbe_set_rxnfcfunction txgbe_get_module_eeprom_by_pagefunction txgbe_set_ethtool_ops
Annotated Snippet
switch (fsp->h_u.usr_ip4_spec.proto) {
case IPPROTO_TCP:
*flow_type = TXGBE_ATR_FLOW_TYPE_TCPV4;
break;
case IPPROTO_UDP:
*flow_type = TXGBE_ATR_FLOW_TYPE_UDPV4;
break;
case IPPROTO_SCTP:
*flow_type = TXGBE_ATR_FLOW_TYPE_SCTPV4;
break;
case 0:
if (!fsp->m_u.usr_ip4_spec.proto) {
*flow_type = TXGBE_ATR_FLOW_TYPE_IPV4;
break;
}
fallthrough;
default:
return -EINVAL;
}
break;
default:
return -EINVAL;
}
return 0;
}
static bool txgbe_match_ethtool_fdir_entry(struct txgbe *txgbe,
struct txgbe_fdir_filter *input)
{
struct txgbe_fdir_filter *rule = NULL;
struct hlist_node *node2;
hlist_for_each_entry_safe(rule, node2, &txgbe->fdir_filter_list,
fdir_node) {
if (rule->filter.formatted.bkt_hash ==
input->filter.formatted.bkt_hash &&
rule->action == input->action) {
wx_dbg(txgbe->wx, "FDIR entry already exist\n");
return true;
}
}
return false;
}
static int txgbe_update_ethtool_fdir_entry(struct txgbe *txgbe,
struct txgbe_fdir_filter *input,
u16 sw_idx)
{
struct hlist_node *node = NULL, *parent = NULL;
struct txgbe_fdir_filter *rule;
struct wx *wx = txgbe->wx;
bool deleted = false;
int err;
hlist_for_each_entry_safe(rule, node, &txgbe->fdir_filter_list,
fdir_node) {
/* hash found, or no matching entry */
if (rule->sw_idx >= sw_idx)
break;
parent = node;
}
/* if there is an old rule occupying our place remove it */
if (rule && rule->sw_idx == sw_idx) {
/* hardware filters are only configured when interface is up,
* and we should not issue filter commands while the interface
* is down
*/
if (netif_running(wx->netdev) &&
(!input || rule->filter.formatted.bkt_hash !=
input->filter.formatted.bkt_hash)) {
err = txgbe_fdir_erase_perfect_filter(wx,
&rule->filter,
sw_idx);
if (err)
return -EINVAL;
}
hlist_del(&rule->fdir_node);
kfree(rule);
txgbe->fdir_filter_count--;
deleted = true;
}
/* If we weren't given an input, then this was a request to delete a
* filter. We should return -EINVAL if the filter wasn't found, but
* return 0 if the rule was successfully deleted.
*/
if (!input)
Annotation
- Immediate include surface: `linux/pci.h`, `linux/phylink.h`, `linux/netdevice.h`, `../libwx/wx_ethtool.h`, `../libwx/wx_type.h`, `../libwx/wx_lib.h`, `txgbe_type.h`, `txgbe_fdir.h`.
- Detected declarations: `function txgbe_get_link_ksettings`, `function txgbe_set_ringparam`, `function txgbe_get_ethtool_fdir_entry`, `function hlist_for_each_entry_safe`, `function txgbe_get_ethtool_fdir_all`, `function hlist_for_each_entry_safe`, `function txgbe_get_rx_ring_count`, `function txgbe_get_rxnfc`, `function txgbe_flowspec_to_flow_type`, `function txgbe_match_ethtool_fdir_entry`.
- 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.