src/dpdk/drivers/net/enic/enic_flow.c
static void
enic_dump_filter(const struct filter_v2 *filt)
{
	const struct filter_generic_1 *gp;
	int i, j, mbyte;
	char buf[128], *bp;
	char ip4[16], ip6[16], udp[16], tcp[16], tcpudp[16], ip4csum[16];
	char l4csum[16], ipfrag[16];

	switch (filt->type) {
	case FILTER_IPV4_5TUPLE:
		ENICPMD_LOG(INFO, "FILTER_IPV4_5TUPLE\n");
		break;
	case FILTER_USNIC_IP:
	case FILTER_DPDK_1:
		/* FIXME: this should be a loop */
		gp = &filt->u.generic_1;
		ENICPMD_LOG(INFO, "Filter: vlan: 0x%04x, mask: 0x%04x\n",
		       gp->val_vlan, gp->mask_vlan);

		if (gp->mask_flags & FILTER_GENERIC_1_IPV4)
			sprintf(ip4, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_IPV4)
				 ? "ip4(y)" : "ip4(n)");
		else
			sprintf(ip4, "%s ", "ip4(x)");

		if (gp->mask_flags & FILTER_GENERIC_1_IPV6)
			sprintf(ip6, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_IPV6)
				 ? "ip6(y)" : "ip6(n)");
		else
			sprintf(ip6, "%s ", "ip6(x)");

		if (gp->mask_flags & FILTER_GENERIC_1_UDP)
			sprintf(udp, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_UDP)
				 ? "udp(y)" : "udp(n)");
		else
			sprintf(udp, "%s ", "udp(x)");

		if (gp->mask_flags & FILTER_GENERIC_1_TCP)
			sprintf(tcp, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_TCP)
				 ? "tcp(y)" : "tcp(n)");
		else
			sprintf(tcp, "%s ", "tcp(x)");

		if (gp->mask_flags & FILTER_GENERIC_1_TCP_OR_UDP)
			sprintf(tcpudp, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_TCP_OR_UDP)
				 ? "tcpudp(y)" : "tcpudp(n)");
		else
			sprintf(tcpudp, "%s ", "tcpudp(x)");

		if (gp->mask_flags & FILTER_GENERIC_1_IP4SUM_OK)
			sprintf(ip4csum, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_IP4SUM_OK)
				 ? "ip4csum(y)" : "ip4csum(n)");
		else
			sprintf(ip4csum, "%s ", "ip4csum(x)");

		if (gp->mask_flags & FILTER_GENERIC_1_L4SUM_OK)
			sprintf(l4csum, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_L4SUM_OK)
				 ? "l4csum(y)" : "l4csum(n)");
		else
			sprintf(l4csum, "%s ", "l4csum(x)");

		if (gp->mask_flags & FILTER_GENERIC_1_IPFRAG)
			sprintf(ipfrag, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_IPFRAG)
				 ? "ipfrag(y)" : "ipfrag(n)");
		else
			sprintf(ipfrag, "%s ", "ipfrag(x)");
		ENICPMD_LOG(INFO, "\tFlags: %s%s%s%s%s%s%s%s\n", ip4, ip6, udp,
			 tcp, tcpudp, ip4csum, l4csum, ipfrag);

		for (i = 0; i < FILTER_GENERIC_1_NUM_LAYERS; i++) {
			mbyte = FILTER_GENERIC_1_KEY_LEN - 1;
			while (mbyte && !gp->layer[i].mask[mbyte])
				mbyte--;
			if (mbyte == 0)
				continue;

			bp = buf;
			for (j = 0; j <= mbyte; j++) {
				sprintf(bp, "%02x",
					gp->layer[i].mask[j]);
				bp += 2;
			}
			*bp = '\0';
			ENICPMD_LOG(INFO, "\tL%u mask: %s\n", i + 2, buf);
			bp = buf;
			for (j = 0; j <= mbyte; j++) {
				sprintf(bp, "%02x",
					gp->layer[i].val[j]);
				bp += 2;
			}
			*bp = '\0';
			ENICPMD_LOG(INFO, "\tL%u  val: %s\n", i + 2, buf);
		}
		break;
	default:
		ENICPMD_LOG(INFO, "FILTER UNKNOWN\n");
		break;
	}
}
/* Debug function to dump internal NIC filter structure. */
Debug function to dump internal NIC filter structure.
Debug function to dump internal NIC filter structure .
static void
enic_dump_filter(const struct filter_v2 *filt)
{
	const struct filter_generic_1 *gp;
	int i, j, mbyte;
	char buf[128], *bp;
	char ip4[16], ip6[16], udp[16], tcp[16], tcpudp[16], ip4csum[16];
	char l4csum[16], ipfrag[16];
	switch (filt->type) {
	case FILTER_IPV4_5TUPLE:
		ENICPMD_LOG(INFO, "FILTER_IPV4_5TUPLE\n");
		break;
	case FILTER_USNIC_IP:
	case FILTER_DPDK_1:
		gp = &filt->u.generic_1;
		ENICPMD_LOG(INFO, "Filter: vlan: 0x%04x, mask: 0x%04x\n",
		       gp->val_vlan, gp->mask_vlan);
		if (gp->mask_flags & FILTER_GENERIC_1_IPV4)
			sprintf(ip4, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_IPV4)
				 ? "ip4(y)" : "ip4(n)");
		else
			sprintf(ip4, "%s ", "ip4(x)");
		if (gp->mask_flags & FILTER_GENERIC_1_IPV6)
			sprintf(ip6, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_IPV6)
				 ? "ip6(y)" : "ip6(n)");
		else
			sprintf(ip6, "%s ", "ip6(x)");
		if (gp->mask_flags & FILTER_GENERIC_1_UDP)
			sprintf(udp, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_UDP)
				 ? "udp(y)" : "udp(n)");
		else
			sprintf(udp, "%s ", "udp(x)");
		if (gp->mask_flags & FILTER_GENERIC_1_TCP)
			sprintf(tcp, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_TCP)
				 ? "tcp(y)" : "tcp(n)");
		else
			sprintf(tcp, "%s ", "tcp(x)");
		if (gp->mask_flags & FILTER_GENERIC_1_TCP_OR_UDP)
			sprintf(tcpudp, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_TCP_OR_UDP)
				 ? "tcpudp(y)" : "tcpudp(n)");
		else
			sprintf(tcpudp, "%s ", "tcpudp(x)");
		if (gp->mask_flags & FILTER_GENERIC_1_IP4SUM_OK)
			sprintf(ip4csum, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_IP4SUM_OK)
				 ? "ip4csum(y)" : "ip4csum(n)");
		else
			sprintf(ip4csum, "%s ", "ip4csum(x)");
		if (gp->mask_flags & FILTER_GENERIC_1_L4SUM_OK)
			sprintf(l4csum, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_L4SUM_OK)
				 ? "l4csum(y)" : "l4csum(n)");
		else
			sprintf(l4csum, "%s ", "l4csum(x)");
		if (gp->mask_flags & FILTER_GENERIC_1_IPFRAG)
			sprintf(ipfrag, "%s ",
				(gp->val_flags & FILTER_GENERIC_1_IPFRAG)
				 ? "ipfrag(y)" : "ipfrag(n)");
		else
			sprintf(ipfrag, "%s ", "ipfrag(x)");
		ENICPMD_LOG(INFO, "\tFlags: %s%s%s%s%s%s%s%s\n", ip4, ip6, udp,
			 tcp, tcpudp, ip4csum, l4csum, ipfrag);
		for (i = 0; i < FILTER_GENERIC_1_NUM_LAYERS; i++) {
			mbyte = FILTER_GENERIC_1_KEY_LEN - 1;
			while (mbyte && !gp->layer[i].mask[mbyte])
				mbyte--;
			if (mbyte == 0)
				continue;
			bp = buf;
			for (j = 0; j <= mbyte; j++) {
				sprintf(bp, "%02x",
					gp->layer[i].mask[j]);
				bp += 2;
			}
			*bp = '\0';
			ENICPMD_LOG(INFO, "\tL%u mask: %s\n", i + 2, buf);
			bp = buf;
			for (j = 0; j <= mbyte; j++) {
				sprintf(bp, "%02x",
					gp->layer[i].val[j]);
				bp += 2;
			}
			*bp = '\0';
			ENICPMD_LOG(INFO, "\tL%u  val: %s\n", i + 2, buf);
		}
		break;
	default:
		ENICPMD_LOG(INFO, "FILTER UNKNOWN\n");
		break;
	}
}
static void enic_dump_filter ( const struct filter_v2 * filt ) { const struct filter_generic_1 * gp ; int i , j , mbyte ; char buf [ 128 ] , * bp ; char ip4 [ 16 ] , ip6 [ 16 ] , udp [ 16 ] , tcp [ 16 ] , tcpudp [ 16 ] , ip4csum [ 16 ] ; char l4csum [ 16 ] , ipfrag [ 16 ] ; switch ( filt -> type ) { case FILTER_IPV4_5TUPLE : ENICPMD_LOG ( INFO , " \n " ) ; break ; case FILTER_USNIC_IP : case FILTER_DPDK_1 : gp = & filt -> u . generic_1 ; ENICPMD_LOG ( INFO , " \n " , gp -> val_vlan , gp -> mask_vlan ) ; if ( gp -> mask_flags & FILTER_GENERIC_1_IPV4 ) sprintf ( ip4 , " " , ( gp -> val_flags & FILTER_GENERIC_1_IPV4 ) ? " " : " " ) ; else sprintf ( ip4 , " " , " " ) ; if ( gp -> mask_flags & FILTER_GENERIC_1_IPV6 ) sprintf ( ip6 , " " , ( gp -> val_flags & FILTER_GENERIC_1_IPV6 ) ? " " : " " ) ; else sprintf ( ip6 , " " , " " ) ; if ( gp -> mask_flags & FILTER_GENERIC_1_UDP ) sprintf ( udp , " " , ( gp -> val_flags & FILTER_GENERIC_1_UDP ) ? " " : " " ) ; else sprintf ( udp , " " , " " ) ; if ( gp -> mask_flags & FILTER_GENERIC_1_TCP ) sprintf ( tcp , " " , ( gp -> val_flags & FILTER_GENERIC_1_TCP ) ? " " : " " ) ; else sprintf ( tcp , " " , " " ) ; if ( gp -> mask_flags & FILTER_GENERIC_1_TCP_OR_UDP ) sprintf ( tcpudp , " " , ( gp -> val_flags & FILTER_GENERIC_1_TCP_OR_UDP ) ? " " : " " ) ; else sprintf ( tcpudp , " " , " " ) ; if ( gp -> mask_flags & FILTER_GENERIC_1_IP4SUM_OK ) sprintf ( ip4csum , " " , ( gp -> val_flags & FILTER_GENERIC_1_IP4SUM_OK ) ? " " : " " ) ; else sprintf ( ip4csum , " " , " " ) ; if ( gp -> mask_flags & FILTER_GENERIC_1_L4SUM_OK ) sprintf ( l4csum , " " , ( gp -> val_flags & FILTER_GENERIC_1_L4SUM_OK ) ? " " : " " ) ; else sprintf ( l4csum , " " , " " ) ; if ( gp -> mask_flags & FILTER_GENERIC_1_IPFRAG ) sprintf ( ipfrag , " " , ( gp -> val_flags & FILTER_GENERIC_1_IPFRAG ) ? " " : " " ) ; else sprintf ( ipfrag , " " , " " ) ; ENICPMD_LOG ( INFO , " \t \n " , ip4 , ip6 , udp , tcp , tcpudp , ip4csum , l4csum , ipfrag ) ; for ( i = 0 ; i < FILTER_GENERIC_1_NUM_LAYERS ; i ++ ) { mbyte = FILTER_GENERIC_1_KEY_LEN - 1 ; while ( mbyte && ! gp -> layer [ i ] . mask [ mbyte ] ) mbyte -- ; if ( mbyte == 0 ) continue ; bp = buf ; for ( j = 0 ; j <= mbyte ; j ++ ) { sprintf ( bp , " " , gp -> layer [ i ] . mask [ j ] ) ; bp += 2 ; } * bp = ' \0 ' ; ENICPMD_LOG ( INFO , " \t \n " , i + 2 , buf ) ; bp = buf ; for ( j = 0 ; j <= mbyte ; j ++ ) { sprintf ( bp , " " , gp -> layer [ i ] . val [ j ] ) ; bp += 2 ; } * bp = ' \0 ' ; ENICPMD_LOG ( INFO , " \t \n " , i + 2 , buf ) ; } break ; default : ENICPMD_LOG ( INFO , " \n " ) ; break ; } }
Debug function to dump internal NIC filter structure.
Debug function to dump internal NIC filter structure .
/* FIXME: this should be a loop */