Skip to content

Commit

Permalink
ixgbe: add LRO support
Browse files Browse the repository at this point in the history
    - Only x540 and 82599 devices support LRO.
    - Add the appropriate HW configuration.
    - Add RSC aware rx_pkt_burst() handlers:
       - Implemented bulk allocation and non-bulk allocation versions.
       - Add LRO-specific fields to rte_eth_rxmode, to rte_eth_dev_data
         and to ixgbe_rx_queue.
       - Use the appropriate handler when LRO is requested.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
  • Loading branch information
Vlad Zolotarov authored and Thomas Monjalon committed Apr 13, 2015
1 parent 7b5b00e commit 8eecb32
Show file tree
Hide file tree
Showing 6 changed files with 644 additions and 8 deletions.
9 changes: 7 additions & 2 deletions lib/librte_ether/rte_ethdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ extern "C" {

#include <stdint.h>

/* Use this macro to check if LRO API is supported */
#define RTE_ETHDEV_HAS_LRO_SUPPORT

#include <rte_log.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
Expand Down Expand Up @@ -320,14 +323,15 @@ struct rte_eth_rxmode {
enum rte_eth_rx_mq_mode mq_mode;
uint32_t max_rx_pkt_len; /**< Only used if jumbo_frame enabled. */
uint16_t split_hdr_size; /**< hdr buf size (header_split enabled).*/
uint8_t header_split : 1, /**< Header Split enable. */
uint16_t header_split : 1, /**< Header Split enable. */
hw_ip_checksum : 1, /**< IP/UDP/TCP checksum offload enable. */
hw_vlan_filter : 1, /**< VLAN filter enable. */
hw_vlan_strip : 1, /**< VLAN strip enable. */
hw_vlan_extend : 1, /**< Extended VLAN enable. */
jumbo_frame : 1, /**< Jumbo Frame Receipt enable. */
hw_strip_crc : 1, /**< Enable CRC stripping by hardware. */
enable_scatter : 1; /**< Enable scatter packets rx handler */
enable_scatter : 1, /**< Enable scatter packets rx handler */
enable_lro : 1; /**< Enable LRO */
};

/**
Expand Down Expand Up @@ -1537,6 +1541,7 @@ struct rte_eth_dev_data {
uint8_t port_id; /**< Device [external] port identifier. */
uint8_t promiscuous : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
scattered_rx : 1, /**< RX of scattered packets is ON(1) / OFF(0) */
lro : 1, /**< RX LRO is ON(1) / OFF(0) */
all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
dev_started : 1; /**< Device state: STARTED(1) / STOPPED(0). */
};
Expand Down
3 changes: 3 additions & 0 deletions lib/librte_net/rte_ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ struct ipv4_hdr {
(((c) & 0xff) << 8) | \
((d) & 0xff))

/** Maximal IPv4 packet length (including a header) */
#define IPV4_MAX_PKT_LEN 65535

/** Internet header length mask for version_ihl field */
#define IPV4_HDR_IHL_MASK (0x0f)
/**
Expand Down
11 changes: 11 additions & 0 deletions lib/librte_pmd_ixgbe/ixgbe_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)

/* Clear stored conf */
dev->data->scattered_rx = 0;
dev->data->lro = 0;

/* Clear recorded link status */
memset(&link, 0, sizeof(link));
Expand Down Expand Up @@ -2012,6 +2013,16 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
DEV_RX_OFFLOAD_IPV4_CKSUM |
DEV_RX_OFFLOAD_UDP_CKSUM |
DEV_RX_OFFLOAD_TCP_CKSUM;

/*
* RSC is only supported by 82599 and x540 PF devices in a non-SR-IOV
* mode.
*/
if ((hw->mac.type == ixgbe_mac_82599EB ||
hw->mac.type == ixgbe_mac_X540) &&
!RTE_ETH_DEV_SRIOV(dev).active)
dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO;

dev_info->tx_offload_capa =
DEV_TX_OFFLOAD_VLAN_INSERT |
DEV_TX_OFFLOAD_IPV4_CKSUM |
Expand Down
13 changes: 13 additions & 0 deletions lib/librte_pmd_ixgbe/ixgbe_ethdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@
#endif
#define IXGBE_HWSTRIP_BITMAP_SIZE (IXGBE_MAX_RX_QUEUE_NUM / (sizeof(uint32_t) * NBBY))

/* EITR Inteval is in 2048ns uinits for 1G and 10G link */
#define IXGBE_EITR_INTERVAL_UNIT_NS 2048
#define IXGBE_EITR_ITR_INT_SHIFT 3
#define IXGBE_EITR_INTERVAL_US(us) \
(((us) * 1000 / IXGBE_EITR_INTERVAL_UNIT_NS << IXGBE_EITR_ITR_INT_SHIFT) & \
IXGBE_EITR_ITR_INT_MASK)


/* Loopback operation modes */
/* 82599 specific loopback operation types */
#define IXGBE_LPBK_82599_NONE 0x0 /* Default value. Loopback is disabled. */
Expand Down Expand Up @@ -344,6 +352,11 @@ uint16_t ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t ixgbe_recv_scattered_pkts(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);

uint16_t ixgbe_recv_pkts_lro_single_alloc(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);

uint16_t ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);

Expand Down
Loading

0 comments on commit 8eecb32

Please sign in to comment.