return rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr);
}
/* Parse an IPv4 header to fill l3_len, l4_len, and l4_proto */
static void
return rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr);
}
/* Parse an IPv4 header to fill l3_len, l4_len, and l4_proto */
static void
info->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4;
info->l4_proto = ipv4_hdr->next_proto_id;
/* only fill l4_len for TCP, it's useful for TSO */
if (info->l4_proto == IPPROTO_TCP) {
info->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4;
info->l4_proto = ipv4_hdr->next_proto_id;
/* only fill l4_len for TCP, it's useful for TSO */
if (info->l4_proto == IPPROTO_TCP) {
info->l4_proto = ipv6_hdr->proto;
/* only fill l4_len for TCP, it's useful for TSO */
if (info->l4_proto == IPPROTO_TCP) {
info->l4_proto = ipv6_hdr->proto;
/* only fill l4_len for TCP, it's useful for TSO */
if (info->l4_proto == IPPROTO_TCP) {
- case _htons(ETHER_TYPE_IPv4):
- ipv4_hdr = (struct ipv4_hdr *) ((char *)eth_hdr + info->l2_len);
+ case _htons(RTE_ETHER_TYPE_IPV4):
+ ipv4_hdr = (struct rte_ipv4_hdr *)
+ ((char *)eth_hdr + info->l2_len);
- case _htons(ETHER_TYPE_IPv6):
- ipv6_hdr = (struct ipv6_hdr *) ((char *)eth_hdr + info->l2_len);
+ case _htons(RTE_ETHER_TYPE_IPV6):
+ ipv6_hdr = (struct rte_ipv6_hdr *)
+ ((char *)eth_hdr + info->l2_len);
sizeof(struct rte_vxlan_hdr));
parse_ethernet(eth_hdr, info);
sizeof(struct rte_vxlan_hdr));
parse_ethernet(eth_hdr, info);
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)
{
struct rte_ether_hdr *eth_hdr;
parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)
{
struct rte_ether_hdr *eth_hdr;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
- struct ipv4_hdr *ipv4_hdr = l3_hdr;
- struct udp_hdr *udp_hdr;
- struct tcp_hdr *tcp_hdr;
- struct sctp_hdr *sctp_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr = l3_hdr;
+ struct rte_udp_hdr *udp_hdr;
+ struct rte_tcp_hdr *tcp_hdr;
+ struct rte_sctp_hdr *sctp_hdr;
ol_flags |= PKT_TX_IPV6;
else
return 0; /* packet type not supported, nothing to do */
if (info->l4_proto == IPPROTO_UDP) {
ol_flags |= PKT_TX_IPV6;
else
return 0; /* packet type not supported, nothing to do */
if (info->l4_proto == IPPROTO_UDP) {
/* do not recalculate udp cksum if it was 0 */
if (udp_hdr->dgram_cksum != 0) {
udp_hdr->dgram_cksum = 0;
/* do not recalculate udp cksum if it was 0 */
if (udp_hdr->dgram_cksum != 0) {
udp_hdr->dgram_cksum = 0;
process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,
uint64_t tx_offloads, int tso_enabled)
{
process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,
uint64_t tx_offloads, int tso_enabled)
{
- struct ipv4_hdr *ipv4_hdr = outer_l3_hdr;
- struct ipv6_hdr *ipv6_hdr = outer_l3_hdr;
- struct udp_hdr *udp_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr;
+ struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr;
+ struct rte_udp_hdr *udp_hdr;
/* outer UDP checksum is done in software. In the other side, for
* UDP tunneling, like VXLAN or Geneve, outer UDP checksum can be
/* outer UDP checksum is done in software. In the other side, for
* UDP tunneling, like VXLAN or Geneve, outer UDP checksum can be
/* do not recalculate udp cksum if it was 0 */
if (udp_hdr->dgram_cksum != 0) {
udp_hdr->dgram_cksum = 0;
/* do not recalculate udp cksum if it was 0 */
if (udp_hdr->dgram_cksum != 0) {
udp_hdr->dgram_cksum = 0;
ð_hdr->s_addr);
parse_ethernet(eth_hdr, &info);
l3_hdr = (char *)eth_hdr + info.l2_len;
ð_hdr->s_addr);
parse_ethernet(eth_hdr, &info);
l3_hdr = (char *)eth_hdr + info.l2_len;
parse_vxlan_gpe(udp_hdr, &info);
if (info.is_tunnel) {
tx_ol_flags |= PKT_TX_TUNNEL_VXLAN_GPE;
parse_vxlan_gpe(udp_hdr, &info);
if (info.is_tunnel) {
tx_ol_flags |= PKT_TX_TUNNEL_VXLAN_GPE;