All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: Jakub Kicinski <kubakici@wp.pl>
Cc: David Miller <davem@davemloft.net>, Netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 10/10] bnxt_en: Add support for XDP_TX action.
Date: Mon, 30 Jan 2017 23:19:40 -0800	[thread overview]
Message-ID: <CACKFLikzA0zyFwAatnKXUVc2jMzA3qGnTv70ubbUCVJ3c6kb2g@mail.gmail.com> (raw)
In-Reply-To: <20170130212727.69e9b646@cakuba>

On Mon, Jan 30, 2017 at 9:27 PM, Jakub Kicinski <kubakici@wp.pl> wrote:
> On Mon, 30 Jan 2017 20:49:35 -0500, Michael Chan wrote:
>> +static int bnxt_xmit_xdp(struct bnxt *bp, struct bnxt_napi *bnapi,
>> +                      struct page *page, dma_addr_t mapping, u32 offset,
>> +                      u32 len)
>> +{
>> +     struct bnxt_tx_ring_info *txr = bnapi->tx_ring;
>> +     struct bnxt_sw_tx_bd *tx_buf;
>> +     struct tx_bd_ext *txbd1;
>> +     struct tx_bd *txbd;
>> +     u32 flags;
>> +     u16 prod;
>> +
>> +     if (bnxt_tx_avail(bp, txr) < 2)
>> +             return -ENOSPC;
>> +
>> +     prod = txr->tx_prod;
>> +     txbd = &txr->tx_desc_ring[TX_RING(prod)][TX_IDX(prod)];
>> +
>> +     tx_buf = &txr->tx_buf_ring[prod];
>> +     tx_buf->page = page;
>> +     dma_unmap_addr_set(tx_buf, mapping, mapping);
>> +     flags = (len << TX_BD_LEN_SHIFT) | TX_BD_TYPE_LONG_TX_BD |
>> +             (2 << TX_BD_FLAGS_BD_CNT_SHIFT) | TX_BD_FLAGS_PACKET_END |
>> +             bnxt_lhint_arr[len >> 9];
>> +     txbd->tx_bd_len_flags_type = cpu_to_le32(flags);
>> +     txbd->tx_bd_opaque = prod;
>> +     txbd->tx_bd_haddr = cpu_to_le64(mapping + offset);
>> +
>> +     prod = NEXT_TX(prod);
>> +     txbd1 = (struct tx_bd_ext *)
>> +             &txr->tx_desc_ring[TX_RING(prod)][TX_IDX(prod)];
>> +
>> +     txbd1->tx_bd_hsize_lflags = cpu_to_le32(0);
>> +     txbd1->tx_bd_mss = cpu_to_le32(0);
>> +     txbd1->tx_bd_cfa_action = cpu_to_le32(0);
>> +     txbd1->tx_bd_cfa_meta = cpu_to_le32(0);
>> +
>> +     prod = NEXT_TX(prod);
>> +     txr->tx_prod = prod;
>> +     return 0;
>> +}
>
> Are you not lacking DMA syncs in general?  You map the buffers
> bidirectionally, but I failed to find any dma_syncs.  I would expect
> one before you run xdp and one before you TX because packet could have
> been modified.  What am I missing?

You are right.  I missed the DMA syncs.

  reply	other threads:[~2017-01-31  7:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-31  1:49 [PATCH net-next 00/10] bnxt_en: Add XDP support Michael Chan
2017-01-31  1:49 ` [PATCH net-next 01/10] bnxt_en: Refactor rx SKB function Michael Chan
2017-01-31  4:26   ` Jakub Kicinski
2017-01-31 18:27   ` David Miller
2017-01-31  1:49 ` [PATCH net-next 02/10] bnxt_en: Add bp->rx_dir field for rx buffer DMA direction Michael Chan
2017-01-31  1:49 ` [PATCH net-next 03/10] bnxt_en: Add RX page mode support Michael Chan
2017-01-31  1:49 ` [PATCH net-next 04/10] bnxt_en: Use event bit map in RX path Michael Chan
2017-01-31  1:49 ` [PATCH net-next 05/10] bnxt_en: Centralize logic to reserve rings Michael Chan
2017-01-31  1:49 ` [PATCH net-next 06/10] bnxt_en: Add tx ring mapping logic Michael Chan
2017-01-31  1:49 ` [PATCH net-next 07/10] bnxt_en: Add a set of TX rings to support XDP Michael Chan
2017-01-31  1:49 ` [PATCH net-next 08/10] bnxt_en: Refactor tx completion path Michael Chan
2017-01-31  1:49 ` [PATCH net-next 09/10] bnxt_en: Add basic XDP support Michael Chan
2017-01-31  5:04   ` Jakub Kicinski
2017-01-31  7:33     ` Michael Chan
2017-01-31  1:49 ` [PATCH net-next 10/10] bnxt_en: Add support for XDP_TX action Michael Chan
2017-01-31  5:27   ` Jakub Kicinski
2017-01-31  7:19     ` Michael Chan [this message]
2017-01-31  4:47 ` [PATCH net-next 00/10] bnxt_en: Add XDP support Alexei Starovoitov
2017-01-31  5:13   ` Jakub Kicinski
2017-01-31  7:38     ` Michael Chan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACKFLikzA0zyFwAatnKXUVc2jMzA3qGnTv70ubbUCVJ3c6kb2g@mail.gmail.com \
    --to=michael.chan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=kubakici@wp.pl \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.