drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_rss.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_rss.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_rss.c- Extension
.c- Size
- 14309 bytes
- Lines
- 519
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/skbuff.hhnae3.hhclge_comm_cmd.hhclge_comm_rss.h
Detected Declarations
function hclge_comm_init_rss_tuplefunction hclge_comm_rss_init_cfgfunction hclge_comm_get_rss_tc_infofunction hclge_comm_set_rss_tc_modefunction hclge_comm_set_rss_hash_keyfunction hclge_comm_set_rss_tuplefunction hclge_comm_get_rss_key_sizefunction hclge_comm_parse_rss_hfuncfunction hclge_comm_rss_indir_init_cfgfunction hclge_comm_get_rss_tuplefunction hclge_comm_append_rss_msb_infofunction hclge_comm_set_rss_indir_tablefunction hclge_comm_set_rss_input_tuplefunction hclge_comm_get_rss_hash_infofunction hclge_comm_get_rss_indir_tblfunction hclge_comm_set_rss_algo_keyfunction hclge_comm_get_rss_hash_bitsfunction hclge_comm_init_rss_tuple_cmdfunction hclge_comm_convert_rss_tupleexport hclge_comm_rss_init_cfgexport hclge_comm_get_rss_tc_infoexport hclge_comm_set_rss_tc_modeexport hclge_comm_set_rss_hash_keyexport hclge_comm_set_rss_tupleexport hclge_comm_get_rss_key_sizeexport hclge_comm_rss_indir_init_cfgexport hclge_comm_get_rss_tupleexport hclge_comm_set_rss_indir_tableexport hclge_comm_set_rss_input_tupleexport hclge_comm_get_rss_hash_infoexport hclge_comm_get_rss_indir_tblexport hclge_comm_set_rss_algo_keyexport hclge_comm_convert_rss_tuple
Annotated Snippet
if (ret) {
dev_err(&hw->cmq.csq.pdev->dev,
"failed to configure rss table, ret = %d.\n",
ret);
return ret;
}
}
return 0;
}
EXPORT_SYMBOL_GPL(hclge_comm_set_rss_indir_table);
int hclge_comm_set_rss_input_tuple(struct hclge_comm_hw *hw,
struct hclge_comm_rss_cfg *rss_cfg)
{
struct hclge_comm_rss_input_tuple_cmd *req;
struct hclge_desc desc;
int ret;
hclge_comm_cmd_setup_basic_desc(&desc, HCLGE_OPC_RSS_INPUT_TUPLE,
false);
req = (struct hclge_comm_rss_input_tuple_cmd *)desc.data;
req->ipv4_tcp_en = rss_cfg->rss_tuple_sets.ipv4_tcp_en;
req->ipv4_udp_en = rss_cfg->rss_tuple_sets.ipv4_udp_en;
req->ipv4_sctp_en = rss_cfg->rss_tuple_sets.ipv4_sctp_en;
req->ipv4_fragment_en = rss_cfg->rss_tuple_sets.ipv4_fragment_en;
req->ipv6_tcp_en = rss_cfg->rss_tuple_sets.ipv6_tcp_en;
req->ipv6_udp_en = rss_cfg->rss_tuple_sets.ipv6_udp_en;
req->ipv6_sctp_en = rss_cfg->rss_tuple_sets.ipv6_sctp_en;
req->ipv6_fragment_en = rss_cfg->rss_tuple_sets.ipv6_fragment_en;
ret = hclge_comm_cmd_send(hw, &desc, 1);
if (ret)
dev_err(&hw->cmq.csq.pdev->dev,
"failed to configure rss input, ret = %d.\n", ret);
return ret;
}
EXPORT_SYMBOL_GPL(hclge_comm_set_rss_input_tuple);
void hclge_comm_get_rss_hash_info(struct hclge_comm_rss_cfg *rss_cfg, u8 *key,
u8 *hfunc)
{
/* Get hash algorithm */
if (hfunc) {
switch (rss_cfg->rss_algo) {
case HCLGE_COMM_RSS_HASH_ALGO_TOEPLITZ:
*hfunc = ETH_RSS_HASH_TOP;
break;
case HCLGE_COMM_RSS_HASH_ALGO_SIMPLE:
*hfunc = ETH_RSS_HASH_XOR;
break;
default:
*hfunc = ETH_RSS_HASH_UNKNOWN;
break;
}
}
/* Get the RSS Key required by the user */
if (key)
memcpy(key, rss_cfg->rss_hash_key, HCLGE_COMM_RSS_KEY_SIZE);
}
EXPORT_SYMBOL_GPL(hclge_comm_get_rss_hash_info);
void hclge_comm_get_rss_indir_tbl(struct hclge_comm_rss_cfg *rss_cfg,
u32 *indir, u16 rss_ind_tbl_size)
{
u16 i;
if (!indir)
return;
for (i = 0; i < rss_ind_tbl_size; i++)
indir[i] = rss_cfg->rss_indirection_tbl[i];
}
EXPORT_SYMBOL_GPL(hclge_comm_get_rss_indir_tbl);
int hclge_comm_set_rss_algo_key(struct hclge_comm_hw *hw, const u8 hfunc,
const u8 *key)
{
struct hclge_comm_rss_config_cmd *req;
unsigned int key_offset = 0;
struct hclge_desc desc;
int key_counts;
int key_size;
int ret;
key_counts = HCLGE_COMM_RSS_KEY_SIZE;
req = (struct hclge_comm_rss_config_cmd *)desc.data;
Annotation
- Immediate include surface: `linux/skbuff.h`, `hnae3.h`, `hclge_comm_cmd.h`, `hclge_comm_rss.h`.
- Detected declarations: `function hclge_comm_init_rss_tuple`, `function hclge_comm_rss_init_cfg`, `function hclge_comm_get_rss_tc_info`, `function hclge_comm_set_rss_tc_mode`, `function hclge_comm_set_rss_hash_key`, `function hclge_comm_set_rss_tuple`, `function hclge_comm_get_rss_key_size`, `function hclge_comm_parse_rss_hfunc`, `function hclge_comm_rss_indir_init_cfg`, `function hclge_comm_get_rss_tuple`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.