diff --git a/dpdk-1.6.0r2/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/dpdk-1.6.0r2/lib/librte_pmd_ixgbe/ixgbe_rxtx.c index 027164f..55414b9 100644 --- a/dpdk-1.6.0r2/lib/librte_pmd_ixgbe/ixgbe_rxtx.c +++ b/dpdk-1.6.0r2/lib/librte_pmd_ixgbe/ixgbe_rxtx.c @@ -350,7 +350,7 @@ ixgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts, static inline void ixgbe_set_xmit_ctx(struct igb_tx_queue* txq, volatile struct ixgbe_adv_tx_context_desc *ctx_txd, - uint16_t ol_flags, uint32_t vlan_macip_lens,uint32_t mss_l4len) + uint16_t ol_flags, uint32_t vlan_macip_lens) { uint32_t type_tucmd_mlhl; uint32_t mss_l4len_idx; @@ -372,7 +372,6 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq, /* Specify which HW CTX to upload. */ mss_l4len_idx = (ctx_idx << IXGBE_ADVTXD_IDX_SHIFT); -// mss_l4len_idx = 0; switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_UDP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_UDP | @@ -383,8 +382,7 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= mss_l4len << IXGBE_ADVTXD_L4LEN_SHIFT; - mss_l4len_idx |= 1448 << IXGBE_ADVTXD_MSS_SHIFT; + mss_l4len_idx |= sizeof(struct tcp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; cmp_mask |= TX_MACIP_LEN_CMP_MASK; break; case PKT_TX_SCTP_CKSUM: @@ -403,7 +401,6 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq, txq->ctx_cache[ctx_idx].cmp_mask = cmp_mask; txq->ctx_cache[ctx_idx].vlan_macip_lens.data = vlan_macip_lens & cmp_mask; - txq->ctx_cache[ctx_idx].mss_l4_len = mss_l4len; ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl); ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens); @@ -417,13 +414,12 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq, */ static inline uint32_t what_advctx_update(struct igb_tx_queue *txq, uint16_t flags, - uint32_t vlan_macip_lens,uint32_t mss_l4_len) + uint32_t vlan_macip_lens) { /* If match with the current used context */ if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && (txq->ctx_cache[txq->ctx_curr].vlan_macip_lens.data == - (txq->ctx_cache[txq->ctx_curr].cmp_mask & vlan_macip_lens))&& - (txq->ctx_cache[txq->ctx_curr].mss_l4_len == mss_l4_len))) { + (txq->ctx_cache[txq->ctx_curr].cmp_mask & vlan_macip_lens)))) { return txq->ctx_curr; } @@ -431,8 +427,7 @@ what_advctx_update(struct igb_tx_queue *txq, uint16_t flags, txq->ctx_curr ^= 1; if (likely((txq->ctx_cache[txq->ctx_curr].flags == flags) && (txq->ctx_cache[txq->ctx_curr].vlan_macip_lens.data == - (txq->ctx_cache[txq->ctx_curr].cmp_mask & vlan_macip_lens))&& - (txq->ctx_cache[txq->ctx_curr].mss_l4_len == mss_l4_len))) { + (txq->ctx_cache[txq->ctx_curr].cmp_mask & vlan_macip_lens)))) { return txq->ctx_curr; } @@ -583,7 +578,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, if (tx_ol_req) { /* If new context need be built or reuse the exist ctx. */ ctx = what_advctx_update(txq, tx_ol_req, - vlan_macip_lens,tx_pkt->pkt.hash.fdir.hash); + vlan_macip_lens); /* Only allocate context descriptor if required*/ new_ctx = (ctx == IXGBE_CTX_NUM); ctx = txq->ctx_curr; @@ -698,15 +693,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, */ cmd_type_len = IXGBE_ADVTXD_DTYP_DATA | IXGBE_ADVTXD_DCMD_IFCS | IXGBE_ADVTXD_DCMD_DEXT; -#define IXGBE_TX_FLAGS_TSO 0x2 - if(tx_ol_req) { - olinfo_status = (pkt_len - (tx_pkt->pkt.hash.fdir.hash + tx_pkt->pkt.hash.fdir.id)) << IXGBE_ADVTXD_PAYLEN_SHIFT; - cmd_type_len |= ((IXGBE_TX_FLAGS_TSO <= IXGBE_ADVTXD_DCMD_TSE) ? (IXGBE_TX_FLAGS_TSO * (IXGBE_ADVTXD_DCMD_TSE / IXGBE_TX_FLAGS_TSO)) : \ - (IXGBE_TX_FLAGS_TSO / (IXGBE_TX_FLAGS_TSO / IXGBE_ADVTXD_DCMD_TSE))); - } - else { - olinfo_status = (pkt_len << IXGBE_ADVTXD_PAYLEN_SHIFT); - } + olinfo_status = (pkt_len << IXGBE_ADVTXD_PAYLEN_SHIFT); #ifdef RTE_LIBRTE_IEEE1588 if (ol_flags & PKT_TX_IEEE1588_TMST) cmd_type_len |= IXGBE_ADVTXD_MAC_1588; @@ -733,7 +720,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, } ixgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req, - vlan_macip_lens,tx_pkt->pkt.hash.fdir.hash); + vlan_macip_lens); txe->last_id = tx_last; tx_id = txe->next_id; @@ -770,9 +757,6 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, rte_cpu_to_le_32(cmd_type_len | slen); txd->read.olinfo_status = rte_cpu_to_le_32(olinfo_status); - if (tx_ol_req) { - olinfo_status = 0; - } txe->last_id = tx_last; tx_id = txe->next_id; txe = txn; diff --git a/dpdk-1.6.0r2/lib/librte_pmd_ixgbe/ixgbe_rxtx.h b/dpdk-1.6.0r2/lib/librte_pmd_ixgbe/ixgbe_rxtx.h index 54df592..446eeb7 100644 --- a/dpdk-1.6.0r2/lib/librte_pmd_ixgbe/ixgbe_rxtx.h +++ b/dpdk-1.6.0r2/lib/librte_pmd_ixgbe/ixgbe_rxtx.h @@ -154,7 +154,6 @@ struct ixgbe_advctx_info { uint16_t flags; /**< ol_flags for context build. */ uint32_t cmp_mask; /**< compare mask for vlan_macip_lens */ union rte_vlan_macip vlan_macip_lens; /**< vlan, mac ip length. */ - uint32_t mss_l4_len; }; /** diff --git a/drivers/net/dpdk/device.c b/drivers/net/dpdk/device.c index f195472..1dcfe5d 100644 --- a/drivers/net/dpdk/device.c +++ b/drivers/net/dpdk/device.c @@ -153,8 +153,16 @@ static netdev_tx_t dpdk_xmit_frame(struct sk_buff *skb, IPPROTO_TCP, 0); } -#else - head->ol_flags = PKT_TX_IP_CKSUM; +#else +// if (skb->protocol == htons(ETH_P_IP)) { +// head->ol_flags = PKT_TX_IP_CKSUM; + // struct iphdr *iph = ip_hdr(skb); + // iph->check = 0; + // if (ip_hdr(skb)->protocol == IPPROTO_TCP) + // head->ol_flags = PKT_TX_TCP_CKSUM; + // else if(ip_hdr(skb)->protocol == IPPROTO_UDP) + // head->ol_flags = PKT_TX_UDP_CKSUM; + // } #endif /* this will pass the mbuf to DPDK PMD driver */ dpdk_dev_enqueue_for_tx(priv->port_number,head); @@ -403,7 +411,7 @@ void *create_netdev(int port_num) #ifdef GSO netdev->features = NETIF_F_SG | NETIF_F_GSO | NETIF_F_FRAGLIST; #else - netdev->features = NETIF_F_SG | NETIF_F_FRAGLIST|NETIF_F_V4_CSUM; + netdev->features = NETIF_F_SG | NETIF_F_FRAGLIST/*|NETIF_F_V4_CSUM*/; #endif netdev->hw_features = 0; diff --git a/porting/libinit.c b/porting/libinit.c index 0d611b7..679e086 100644 --- a/porting/libinit.c +++ b/porting/libinit.c @@ -156,7 +156,7 @@ static const struct rte_eth_conf port_conf = { .rxmode = { .split_hdr_size = 0, .header_split = 0, /**< Header Split disabled */ - .hw_ip_checksum = 1, /**< IP checksum offload disabled */ + .hw_ip_checksum = 0, /**< IP checksum offload disabled */ .hw_vlan_filter = 0, /**< VLAN filtering disabled */ .jumbo_frame = 1, /**< Jumbo Frame Support disabled */ .max_rx_pkt_len = 0x2000, diff --git a/user_callbacks.h b/user_callbacks.h index 47f16c1..ca8d8be 100644 --- a/user_callbacks.h +++ b/user_callbacks.h @@ -78,7 +78,7 @@ static inline __attribute__ ((always_inline)) int user_on_transmission_opportuni struct iovec iov; struct rte_mbuf *mbuf[MAX_PKT_BURST]; struct sock *sk = sock->sk; - int dequeued,rc = 0,loop = 1; + int dequeued,rc = 0,loop = 0; msghdr.msg_namelen = sizeof(struct sockaddr_in); msghdr.msg_iov = &iov; @@ -95,20 +95,16 @@ static inline __attribute__ ((always_inline)) int user_on_transmission_opportuni p_addr -= sizeof(struct sockaddr_in); msghdr.msg_name = p_addr; - iov.head = mbuf[i]; - sent += rc; - + iov.head = mbuf[i]; + sent = 1; rc = udp_sendmsg(NULL, sk, &msghdr, mbuf[i]->pkt.data_len); + sent = (rc > 0); } user_on_tx_opportunity_api_failed += dequeued - i; for(;i < dequeued;i++) { rte_pktmbuf_free(mbuf[i]); - loop = 0; } - }while(loop); - } - if(!sent) { - user_on_tx_opportunity_cannot_send++; + }while((dequeued > 0) && (sent > 0)); } user_on_tx_opportunity_cycles += rte_rdtsc() - ts; return sent;