drivers/net/ethernet/intel/iavf/iavf_adv_rss.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/iavf/iavf_adv_rss.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/intel/iavf/iavf_adv_rss.c
Extension
.c
Size
9191 bytes
Lines
296
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.

Dependency Surface

Detected Declarations

Annotated Snippet

switch (packet_l3_hdrs) {
		case IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4:
			iavf_fill_adv_rss_ip4_hdr(hdr, hash_flds);
			break;
		case IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6:
			iavf_fill_adv_rss_ip6_hdr(hdr, hash_flds);
			break;
		default:
			return -EINVAL;
		}
	}

	if (packet_l4_hdrs) {
		hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++];
		switch (packet_l4_hdrs) {
		case IAVF_ADV_RSS_FLOW_SEG_HDR_TCP:
			iavf_fill_adv_rss_tcp_hdr(hdr, hash_flds);
			break;
		case IAVF_ADV_RSS_FLOW_SEG_HDR_UDP:
			iavf_fill_adv_rss_udp_hdr(hdr, hash_flds);
			break;
		case IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP:
			iavf_fill_adv_rss_sctp_hdr(hdr, hash_flds);
			break;
		default:
			return -EINVAL;
		}
	}

	if (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_GTP) {
		hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++];
		if (iavf_fill_adv_rss_gtp_hdr(proto_hdrs, packet_hdrs, hash_flds))
			return -EINVAL;
	}

	return 0;
}

/**
 * iavf_find_adv_rss_cfg_by_hdrs - find RSS configuration with header type
 * @adapter: pointer to the VF adapter structure
 * @packet_hdrs: protocol header type to find.
 *
 * Returns pointer to advance RSS configuration if found or null
 */
struct iavf_adv_rss *
iavf_find_adv_rss_cfg_by_hdrs(struct iavf_adapter *adapter, u32 packet_hdrs)
{
	struct iavf_adv_rss *rss;

	list_for_each_entry(rss, &adapter->adv_rss_list_head, list)
		if (rss->packet_hdrs == packet_hdrs)
			return rss;

	return NULL;
}

/**
 * iavf_print_adv_rss_cfg
 * @adapter: pointer to the VF adapter structure
 * @rss: pointer to the advance RSS configuration to print
 * @action: the string description about how to handle the RSS
 * @result: the string description about the virtchnl result
 *
 * Print the advance RSS configuration
 **/
void
iavf_print_adv_rss_cfg(struct iavf_adapter *adapter, struct iavf_adv_rss *rss,
		       const char *action, const char *result)
{
	u32 packet_hdrs = rss->packet_hdrs;
	u64 hash_flds = rss->hash_flds;
	static char hash_opt[300];
	const char *proto;

	if (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_TCP)
		proto = "TCP";
	else if (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_UDP)
		proto = "UDP";
	else if (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP)
		proto = "SCTP";
	else if (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_GTP)
		proto = "GTP";
	else
		return;

	memset(hash_opt, 0, sizeof(hash_opt));

	strcat(hash_opt, proto);
	if (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4)

Annotation

Implementation Notes