net/enic: improve packet type identification

- add l4 ptypes to the ones we report as supporting
- report/use RTE_PTYPE_L3_IPV4_EXT_UNKNOWN and
  RTE_PTYPE_L3_IPV6_EXT_UNKNOWN instead of RTE_PTYPE_L3_IPV4 and
  RTE_PTYPE_L3_IPV6 as vic can't distinguish between packets with
  extentions and those without extentions.
- correctly set the ptype bits set on packets that are both tcp/udp
  and a frag
- set RTE_PTYPE_L4_NONFRAG on ip packets we know are not udp, tcp,
  or fragments.

Fixes: 947d860c82 ("enic: improve Rx performance")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
This commit is contained in:
Nelson Escobar 2016-06-14 16:54:05 -07:00 committed by Bruce Richardson
parent 07491889d1
commit 097e1f1e40
2 changed files with 31 additions and 16 deletions

View File

@ -455,8 +455,12 @@ static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev,
static const uint32_t *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev)
{
static const uint32_t ptypes[] = {
RTE_PTYPE_L3_IPV4,
RTE_PTYPE_L3_IPV6,
RTE_PTYPE_L3_IPV4_EXT_UNKNOWN,
RTE_PTYPE_L3_IPV6_EXT_UNKNOWN,
RTE_PTYPE_L4_TCP,
RTE_PTYPE_L4_UDP,
RTE_PTYPE_L4_FRAG,
RTE_PTYPE_L4_NONFRAG,
RTE_PTYPE_UNKNOWN
};

View File

@ -148,20 +148,31 @@ enic_cq_rx_flags_to_pkt_type(struct cq_desc *cqd)
struct cq_enet_rq_desc *cqrd = (struct cq_enet_rq_desc *)cqd;
uint8_t cqrd_flags = cqrd->flags;
static const uint32_t cq_type_table[128] __rte_cache_aligned = {
[32] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4,
[34] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4
| RTE_PTYPE_L4_UDP,
[36] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4
| RTE_PTYPE_L4_TCP,
[96] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4
| RTE_PTYPE_L4_FRAG,
[16] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6,
[18] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6
| RTE_PTYPE_L4_UDP,
[20] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6
| RTE_PTYPE_L4_TCP,
[80] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6
| RTE_PTYPE_L4_FRAG,
[0x00] = RTE_PTYPE_UNKNOWN,
[0x20] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN
| RTE_PTYPE_L4_NONFRAG,
[0x22] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN
| RTE_PTYPE_L4_UDP,
[0x24] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN
| RTE_PTYPE_L4_TCP,
[0x60] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN
| RTE_PTYPE_L4_FRAG,
[0x62] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN
| RTE_PTYPE_L4_UDP,
[0x64] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN
| RTE_PTYPE_L4_TCP,
[0x10] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN
| RTE_PTYPE_L4_NONFRAG,
[0x12] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN
| RTE_PTYPE_L4_UDP,
[0x14] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN
| RTE_PTYPE_L4_TCP,
[0x50] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN
| RTE_PTYPE_L4_FRAG,
[0x52] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN
| RTE_PTYPE_L4_UDP,
[0x54] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN
| RTE_PTYPE_L4_TCP,
/* All others reserved */
};
cqrd_flags &= CQ_ENET_RQ_DESC_FLAGS_IPV4_FRAGMENT