[dpdk-dev] [PATCH v7 3/3] ixgbe: Add LRO support

2015-03-11 Thread Vlad Zolotarov


On 03/11/15 17:02, Ananyev, Konstantin wrote:
>
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Vlad Zolotarov
>> Sent: Tuesday, March 10, 2015 7:32 PM
>> To: dev at dpdk.org
>> Subject: [dpdk-dev] [PATCH v7 3/3] ixgbe: Add LRO support
>>
>>  - 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 igb_rx_queue.
>> - Use the appropriate handler when LRO is requested.
>>
>> Signed-off-by: Vlad Zolotarov 
>> ---
>> New in v7:
>> - Free not-yet-completed RSC aggregations in rte_eth_dev_stop() flow.
>> - Fixed rx_bulk_alloc_allowed and rx_vec_allowed initialization:
>>- Don't set them to FALSE in rte_eth_dev_stop() flow - the following
>>  rte_eth_dev_start() will need them.
>>- Reset them to TRUE in rte_eth_dev_configure() and not in a probe() 
>> flow.
>>  This will ensure the proper behaviour if port is re-configured.
>> - Reset the sw_ring[].mbuf entry in a bulk allocation case.
>>   This is needed for ixgbe_rx_queue_release_mbufs().
>> - _recv_pkts_lro(): added the missing memory barrier before RDT update 
>> in a
>>   non-bulk allocation case.
>> - Don't allow RSC when device is configured in an SR-IOV mode.
>>
>> New in v5:
>> - Put the RTE_ETHDEV_HAS_LRO_SUPPORT definition at the beginning of 
>> rte_ethdev.h.
>> - Removed the "TODO: Remove me" comment near RTE_ETHDEV_HAS_LRO_SUPPORT.
>>
>> New in v4:
>> - Define RTE_ETHDEV_HAS_LRO_SUPPORT in rte_ethdev.h instead of
>>   RTE_ETHDEV_LRO_SUPPORT defined in config/common_linuxapp.
>>
>> New in v2:
>> - Removed rte_eth_dev_data.lro_bulk_alloc.
>> - Fixed a few styling and spelling issues.
>>
>> ixgbe: Fixed rx_bulk_alloc_allowed and rx_vec_allowed initialization
>>
>> - Don't set them to FALSE in rte_eth_dev_stop() flow - the following
>>   rte_eth_dev_start() will need them.
>> - Reset them to TRUE in rte_eth_dev_configure() and not in a probe() 
>> flow.
>>   This will ensure the proper behaviour if port is re-configured.
>> ---
>>   lib/librte_ether/rte_ethdev.h   |   9 +-
>>   lib/librte_pmd_ixgbe/ixgbe_ethdev.c |  29 +-
>>   lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   5 +
>>   lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 595 
>> +++-
>>   lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |   6 +
>>   5 files changed, 628 insertions(+), 16 deletions(-)
>>
>> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
>> index 8db3127..44f081f 100644
>> --- a/lib/librte_ether/rte_ethdev.h
>> +++ b/lib/librte_ether/rte_ethdev.h
>> @@ -172,6 +172,9 @@ extern "C" {
>>
>>   #include 
>>
>> +/* Use this macro to check if LRO API is supported */
>> +#define RTE_ETHDEV_HAS_LRO_SUPPORT
>> +
>>   #include 
>>   #include 
>>   #include 
>> @@ -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 */
>>   };
>>
>>   /**
>> @@ -1515,6 +1519,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

[dpdk-dev] [PATCH v7 3/3] ixgbe: Add LRO support

2015-03-11 Thread Ananyev, Konstantin


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Vlad Zolotarov
> Sent: Tuesday, March 10, 2015 7:32 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v7 3/3] ixgbe: Add LRO support
> 
> - 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 igb_rx_queue.
>- Use the appropriate handler when LRO is requested.
> 
> Signed-off-by: Vlad Zolotarov 
> ---
> New in v7:
>- Free not-yet-completed RSC aggregations in rte_eth_dev_stop() flow.
>- Fixed rx_bulk_alloc_allowed and rx_vec_allowed initialization:
>   - Don't set them to FALSE in rte_eth_dev_stop() flow - the following
> rte_eth_dev_start() will need them.
>   - Reset them to TRUE in rte_eth_dev_configure() and not in a probe() 
> flow.
> This will ensure the proper behaviour if port is re-configured.
>- Reset the sw_ring[].mbuf entry in a bulk allocation case.
>  This is needed for ixgbe_rx_queue_release_mbufs().
>- _recv_pkts_lro(): added the missing memory barrier before RDT update in a
>  non-bulk allocation case.
>- Don't allow RSC when device is configured in an SR-IOV mode.
> 
> New in v5:
>- Put the RTE_ETHDEV_HAS_LRO_SUPPORT definition at the beginning of 
> rte_ethdev.h.
>- Removed the "TODO: Remove me" comment near RTE_ETHDEV_HAS_LRO_SUPPORT.
> 
> New in v4:
>- Define RTE_ETHDEV_HAS_LRO_SUPPORT in rte_ethdev.h instead of
>  RTE_ETHDEV_LRO_SUPPORT defined in config/common_linuxapp.
> 
> New in v2:
>- Removed rte_eth_dev_data.lro_bulk_alloc.
>- Fixed a few styling and spelling issues.
> 
> ixgbe: Fixed rx_bulk_alloc_allowed and rx_vec_allowed initialization
> 
>- Don't set them to FALSE in rte_eth_dev_stop() flow - the following
>  rte_eth_dev_start() will need them.
>- Reset them to TRUE in rte_eth_dev_configure() and not in a probe() flow.
>  This will ensure the proper behaviour if port is re-configured.
> ---
>  lib/librte_ether/rte_ethdev.h   |   9 +-
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.c |  29 +-
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   5 +
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 595 
> +++-
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |   6 +
>  5 files changed, 628 insertions(+), 16 deletions(-)
> 
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 8db3127..44f081f 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -172,6 +172,9 @@ extern "C" {
> 
>  #include 
> 
> +/* Use this macro to check if LRO API is supported */
> +#define RTE_ETHDEV_HAS_LRO_SUPPORT
> +
>  #include 
>  #include 
>  #include 
> @@ -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 */
>  };
> 
>  /**
> @@ -1515,6 +1519,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). 
> */
>  };
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
> b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> index 9d3de1

[dpdk-dev] [PATCH v7 3/3] ixgbe: Add LRO support

2015-03-10 Thread Vlad Zolotarov
- 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 igb_rx_queue.
   - Use the appropriate handler when LRO is requested.

Signed-off-by: Vlad Zolotarov 
---
New in v7:
   - Free not-yet-completed RSC aggregations in rte_eth_dev_stop() flow.
   - Fixed rx_bulk_alloc_allowed and rx_vec_allowed initialization:
  - Don't set them to FALSE in rte_eth_dev_stop() flow - the following
rte_eth_dev_start() will need them.
  - Reset them to TRUE in rte_eth_dev_configure() and not in a probe() flow.
This will ensure the proper behaviour if port is re-configured.
   - Reset the sw_ring[].mbuf entry in a bulk allocation case.
 This is needed for ixgbe_rx_queue_release_mbufs().
   - _recv_pkts_lro(): added the missing memory barrier before RDT update in a
 non-bulk allocation case.
   - Don't allow RSC when device is configured in an SR-IOV mode.

New in v5:
   - Put the RTE_ETHDEV_HAS_LRO_SUPPORT definition at the beginning of 
rte_ethdev.h.
   - Removed the "TODO: Remove me" comment near RTE_ETHDEV_HAS_LRO_SUPPORT.

New in v4:
   - Define RTE_ETHDEV_HAS_LRO_SUPPORT in rte_ethdev.h instead of
 RTE_ETHDEV_LRO_SUPPORT defined in config/common_linuxapp.

New in v2:
   - Removed rte_eth_dev_data.lro_bulk_alloc.
   - Fixed a few styling and spelling issues.

ixgbe: Fixed rx_bulk_alloc_allowed and rx_vec_allowed initialization

   - Don't set them to FALSE in rte_eth_dev_stop() flow - the following
 rte_eth_dev_start() will need them.
   - Reset them to TRUE in rte_eth_dev_configure() and not in a probe() flow.
 This will ensure the proper behaviour if port is re-configured.
---
 lib/librte_ether/rte_ethdev.h   |   9 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |  29 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   5 +
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 595 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |   6 +
 5 files changed, 628 insertions(+), 16 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8db3127..44f081f 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -172,6 +172,9 @@ extern "C" {

 #include 

+/* Use this macro to check if LRO API is supported */
+#define RTE_ETHDEV_HAS_LRO_SUPPORT
+
 #include 
 #include 
 #include 
@@ -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 */
 };

 /**
@@ -1515,6 +1519,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). 
*/
 };
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 9d3de1a..f0a3100 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -772,13 +772,6 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct 
eth_driver *eth_drv,
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
hw->allow_unsupported_sfp = 1;

-   /*
-* Initialize to TRUE. If any of Rx queues doesn't meet the bulk
-* allocation or vector Rx preconditions we will reset it.
-*/
-   hw->rx_bulk_alloc_allowed = true;
-   hw->rx_vec_allowed = true;
-
/* Initialize the shared code (base driver) */
 #ifdef RTE_NIC_BYPASS
diag = ixgbe_bypass_init_shared_code(hw);
@@ -1441,12 +1434,21 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
 {
struct ixgbe_interrupt *intr =