drivers/net/wireless/intel/iwlwifi/mei/net.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/mei/net.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/intel/iwlwifi/mei/net.c
Extension
.c
Size
10725 bytes
Lines
413
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (filt->flags & SAP_ETH_FILTER_STOP) {
			*pass_to_csme = true;
			return true;
		}

		return false;
	}

	 /* MCAST frames that don't match layer 2 filters are not sent to ME */
	*pass_to_csme  = false;

	return true;
}

/*
 * Returns true iff the frame should be passed to CSME in which case
 * rx_handler_res is set.
 */
static bool iwl_mei_rx_filter_arp(struct sk_buff *skb,
				  const struct iwl_sap_oob_filters *filters,
				  rx_handler_result_t *rx_handler_res)
{
	const struct iwl_sap_ipv4_filter *filt = &filters->ipv4_filter;
	const struct arphdr *arp;
	const __be32 *target_ip;
	u32 flags = le32_to_cpu(filt->flags);

	if (!pskb_may_pull(skb, arp_hdr_len(skb->dev)))
		return false;

	arp = arp_hdr(skb);

	/* Handle only IPv4 over ethernet ARP frames */
	if (arp->ar_hrd != htons(ARPHRD_ETHER) ||
	    arp->ar_pro != htons(ETH_P_IP))
		return false;

	/*
	 * After the ARP header, we have:
	 * src MAC address   - 6 bytes
	 * src IP address    - 4 bytes
	 * target MAC addess - 6 bytes
	 */
	target_ip = (const void *)((const u8 *)(arp + 1) +
				   ETH_ALEN + sizeof(__be32) + ETH_ALEN);

	/*
	 * ARP request is forwarded to ME only if IP address match in the
	 * ARP request's target ip field.
	 */
	if (arp->ar_op == htons(ARPOP_REQUEST) &&
	    (filt->flags & cpu_to_le32(SAP_IPV4_FILTER_ARP_REQ_PASS)) &&
	    (filt->ipv4_addr == 0 || filt->ipv4_addr == *target_ip)) {
		if (flags & SAP_IPV4_FILTER_ARP_REQ_COPY)
			*rx_handler_res = RX_HANDLER_PASS;
		else
			*rx_handler_res = RX_HANDLER_CONSUMED;

		return true;
	}

	/* ARP reply is always forwarded to ME regardless of the IP */
	if (flags & SAP_IPV4_FILTER_ARP_RESP_PASS &&
	    arp->ar_op == htons(ARPOP_REPLY)) {
		if (flags & SAP_IPV4_FILTER_ARP_RESP_COPY)
			*rx_handler_res = RX_HANDLER_PASS;
		else
			*rx_handler_res = RX_HANDLER_CONSUMED;

		return true;
	}

	return false;
}

static bool
iwl_mei_rx_filter_tcp_udp(struct sk_buff *skb, bool  ip_match,
			  const struct iwl_sap_oob_filters *filters,
			  rx_handler_result_t *rx_handler_res)
{
	const struct iwl_sap_flex_filter *filt;

	for (filt = &filters->flex_filters[0];
	     filt < &filters->flex_filters[0] + ARRAY_SIZE(filters->flex_filters);
	     filt++) {
		if (!(filt->flags & SAP_FLEX_FILTER_ENABLED))
			break;

		/*
		 * We are required to have a match on the IP level and we didn't

Annotation

Implementation Notes