[dpdk-dev] [PATCH v2 1/2] net/ena: convert to new Tx offloads API

Rafał Kozik rk at semihalf.com
Thu Jan 18 10:18:37 CET 2018


2018-01-17 19:58 GMT+01:00 Ferruh Yigit <ferruh.yigit at intel.com>:
> On 1/17/2018 8:23 AM, Rafal Kozik wrote:
>> Ethdev Tx offloads API has changed since:
>>
>> commit cba7f53b717d ("ethdev: introduce Tx queue offloads API")
>>
>> This commit support the new Tx offloads API. Queue configuration
>> is stored in ena_ring.offloads. During preparing mbufs for tx, offloads are
>> allowed only if appropriate flags in this field are set.
>>
>> Signed-off-by: Rafal Kozik <rk at semihalf.com>
>
> <...>
>
>> @@ -280,21 +290,24 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
>>  }
>>
>>  static inline void ena_tx_mbuf_prepare(struct rte_mbuf *mbuf,
>> -                                    struct ena_com_tx_ctx *ena_tx_ctx)
>> +                                    struct ena_com_tx_ctx *ena_tx_ctx,
>> +                                    uint64_t queue_offloads)
>>  {
>>       struct ena_com_tx_meta *ena_meta = &ena_tx_ctx->ena_meta;
>>
>> -     if (mbuf->ol_flags &
>> -         (PKT_TX_L4_MASK | PKT_TX_IP_CKSUM | PKT_TX_TCP_SEG)) {
>> +     if ((mbuf->ol_flags & MBUF_OFFLOADS) &&
>> +         (queue_offloads & QUEUE_OFFLOADS)) {
>>               /* check if TSO is required */
>> -             if (mbuf->ol_flags & PKT_TX_TCP_SEG) {
>> +             if ((mbuf->ol_flags & PKT_TX_TCP_SEG) &&
>> +                 (queue_offloads & DEV_TX_OFFLOAD_TCP_TSO)) {
>>                       ena_tx_ctx->tso_enable = true;
>>
>>                       ena_meta->l4_hdr_len = GET_L4_HDR_LEN(mbuf);
>>               }
>>
>>               /* check if L3 checksum is needed */
>> -             if (mbuf->ol_flags & PKT_TX_IP_CKSUM)
>> +             if ((mbuf->ol_flags & PKT_TX_IP_CKSUM) &&
>> +                 (queue_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM))
>>                       ena_tx_ctx->l3_csum_enable = true;
>
> This function is fast path right?
> Do you really need new extra check to queue_offloads, isn't that information is
> for setup phase?
>

ENA does not have a switch for enabling/disabling offloads during configuration.
We must use additional variable and track it, otherwise the driver could use
checksum offloads by enabling it in mbuf although it was disabled in
queue configuration.


More information about the dev mailing list