drivers/net/ethernet/intel/i40e/i40e_txrx.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/i40e/i40e_txrx.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/intel/i40e/i40e_txrx.c
Extension
.c
Size
114308 bytes
Lines
4042
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 (input->ipl4_proto) {
		case IPPROTO_TCP:
			ret = i40e_add_del_fdir_tcp(vsi, input, add, ipv4);
			break;
		case IPPROTO_UDP:
			ret = i40e_add_del_fdir_udp(vsi, input, add, ipv4);
			break;
		case IPPROTO_SCTP:
			ret = i40e_add_del_fdir_sctp(vsi, input, add, ipv4);
			break;
		case IPPROTO_IP:
			ret = i40e_add_del_fdir_ip(vsi, input, add, ipv4);
			break;
		default:
			/* We cannot support masking based on protocol */
			dev_info(&pf->pdev->dev, "Unsupported IPv4 protocol 0x%02x\n",
				 input->ipl4_proto);
			return -EINVAL;
		}
		break;
	case IPV6_USER_FLOW:
		switch (input->ipl4_proto) {
		case IPPROTO_TCP:
			ret = i40e_add_del_fdir_tcp(vsi, input, add, ipv6);
			break;
		case IPPROTO_UDP:
			ret = i40e_add_del_fdir_udp(vsi, input, add, ipv6);
			break;
		case IPPROTO_SCTP:
			ret = i40e_add_del_fdir_sctp(vsi, input, add, ipv6);
			break;
		case IPPROTO_IP:
			ret = i40e_add_del_fdir_ip(vsi, input, add, ipv6);
			break;
		default:
			/* We cannot support masking based on protocol */
			dev_info(&pf->pdev->dev, "Unsupported IPv6 protocol 0x%02x\n",
				 input->ipl4_proto);
			return -EINVAL;
		}
		break;
	default:
		dev_info(&pf->pdev->dev, "Unsupported flow type 0x%02x\n",
			 input->flow_type);
		return -EINVAL;
	}

	/* The buffer allocated here will be normally be freed by
	 * i40e_clean_fdir_tx_irq() as it reclaims resources after transmit
	 * completion. In the event of an error adding the buffer to the FDIR
	 * ring, it will immediately be freed. It may also be freed by
	 * i40e_clean_tx_ring() when closing the VSI.
	 */
	return ret;
}

/**
 * i40e_fd_handle_status - check the Programming Status for FD
 * @rx_ring: the Rx ring for this descriptor
 * @qword0_raw: qword0
 * @qword1: qword1 after le_to_cpu
 * @prog_id: the id originally used for programming
 *
 * This is used to verify if the FD programming or invalidation
 * requested by SW to the HW is successful or not and take actions accordingly.
 **/
static void i40e_fd_handle_status(struct i40e_ring *rx_ring, u64 qword0_raw,
				  u64 qword1, u8 prog_id)
{
	struct i40e_pf *pf = rx_ring->vsi->back;
	struct pci_dev *pdev = pf->pdev;
	struct i40e_16b_rx_wb_qw0 *qw0;
	u32 fcnt_prog, fcnt_avail;
	u32 error;

	qw0 = (struct i40e_16b_rx_wb_qw0 *)&qword0_raw;
	error = FIELD_GET(I40E_RX_PROG_STATUS_DESC_QW1_ERROR_MASK, qword1);

	if (error == BIT(I40E_RX_PROG_STATUS_DESC_FD_TBL_FULL_SHIFT)) {
		pf->fd_inv = le32_to_cpu(qw0->hi_dword.fd_id);
		if (qw0->hi_dword.fd_id != 0 ||
		    (I40E_DEBUG_FD & pf->hw.debug_mask))
			dev_warn(&pdev->dev, "ntuple filter loc = %d, could not be added\n",
				 pf->fd_inv);

		/* Check if the programming error is for ATR.
		 * If so, auto disable ATR and set a state for
		 * flush in progress. Next time we come here if flush is in
		 * progress do nothing, once flush is complete the state will
		 * be cleared.

Annotation

Implementation Notes