src/dpdk/drivers/net/mvpp2/mrvl_flow.c
static int
mrvl_parse_tcp(const struct rte_flow_item *item,
	       struct rte_flow *flow,
	       struct rte_flow_error *error)
{
	const struct rte_flow_item_tcp *spec = NULL, *mask = NULL;
	int ret;

	ret = mrvl_parse_init(item, (const void **)&spec, (const void **)&mask,
			      &rte_flow_item_tcp_mask,
			      sizeof(struct rte_flow_item_tcp), error);
	if (ret)
		return ret;

	if (mask->hdr.sent_seq ||
	    mask->hdr.recv_ack ||
	    mask->hdr.data_off ||
	    mask->hdr.tcp_flags ||
	    mask->hdr.rx_win ||
	    mask->hdr.cksum ||
	    mask->hdr.tcp_urp) {
		rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
				   NULL, "Not supported by classifier\n");
		return -rte_errno;
	}

	if (mask->hdr.src_port) {
		MRVL_LOG(WARNING, "tcp sport mask is ignored");
		ret = mrvl_parse_tcp_sport(spec, mask, flow);
		if (ret)
			goto out;
	}

	if (mask->hdr.dst_port) {
		MRVL_LOG(WARNING, "tcp dport mask is ignored");
		ret = mrvl_parse_tcp_dport(spec, mask, flow);
		if (ret)
			goto out;
	}

	return 0;
out:
	rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
			   "Reached maximum number of fields in cls tbl key\n");
	return -rte_errno;
}
/**
 * Parse tcp flow item.
 *
 * @param item Pointer to the flow item.
 * @param flow Pointer to the flow.
 * @param error Pointer to the flow error.
 * @returns 0 on success, negative value otherwise.
 */
Parse tcp flow item.
@param item Pointer to the flow item.
@param flow Pointer to the flow.
@param error Pointer to the flow error.
@returns 0 on success, negative value otherwise.
Parse tcp flow item . @param item Pointer to the flow item . @param flow Pointer to the flow . @param error Pointer to the flow error . @returns 0 on success negative value otherwise .
static int
mrvl_parse_tcp(const struct rte_flow_item *item,
	       struct rte_flow *flow,
	       struct rte_flow_error *error)
{
	const struct rte_flow_item_tcp *spec = NULL, *mask = NULL;
	int ret;
	ret = mrvl_parse_init(item, (const void **)&spec, (const void **)&mask,
			      &rte_flow_item_tcp_mask,
			      sizeof(struct rte_flow_item_tcp), error);
	if (ret)
		return ret;
	if (mask->hdr.sent_seq ||
	    mask->hdr.recv_ack ||
	    mask->hdr.data_off ||
	    mask->hdr.tcp_flags ||
	    mask->hdr.rx_win ||
	    mask->hdr.cksum ||
	    mask->hdr.tcp_urp) {
		rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
				   NULL, "Not supported by classifier\n");
		return -rte_errno;
	}
	if (mask->hdr.src_port) {
		MRVL_LOG(WARNING, "tcp sport mask is ignored");
		ret = mrvl_parse_tcp_sport(spec, mask, flow);
		if (ret)
			goto out;
	}
	if (mask->hdr.dst_port) {
		MRVL_LOG(WARNING, "tcp dport mask is ignored");
		ret = mrvl_parse_tcp_dport(spec, mask, flow);
		if (ret)
			goto out;
	}
	return 0;
out:
	rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
			   "Reached maximum number of fields in cls tbl key\n");
	return -rte_errno;
}
static int mrvl_parse_tcp ( const struct rte_flow_item * item , struct rte_flow * flow , struct rte_flow_error * error ) { const struct rte_flow_item_tcp * spec = NULL , * mask = NULL ; int ret ; ret = mrvl_parse_init ( item , ( const void * * ) & spec , ( const void * * ) & mask , & rte_flow_item_tcp_mask , sizeof ( struct rte_flow_item_tcp ) , error ) ; if ( ret ) return ret ; if ( mask -> hdr . sent_seq || mask -> hdr . recv_ack || mask -> hdr . data_off || mask -> hdr . tcp_flags || mask -> hdr . rx_win || mask -> hdr . cksum || mask -> hdr . tcp_urp ) { rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_ITEM , NULL , " \n " ) ; return - rte_errno ; } if ( mask -> hdr . src_port ) { MRVL_LOG ( WARNING , " " ) ; ret = mrvl_parse_tcp_sport ( spec , mask , flow ) ; if ( ret ) goto out ; } if ( mask -> hdr . dst_port ) { MRVL_LOG ( WARNING , " " ) ; ret = mrvl_parse_tcp_dport ( spec , mask , flow ) ; if ( ret ) goto out ; } return 0 ; out : rte_flow_error_set ( error , EINVAL , RTE_FLOW_ERROR_TYPE_UNSPECIFIED , NULL , " \n " ) ; return - rte_errno ; }
Parse tcp flow item.
Parse tcp flow item .