lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 30 Jan 2017 23:19:40 -0800
From:   Michael Chan <michael.chan@...adcom.com>
To:     Jakub Kicinski <kubakici@...pl>
Cc:     David Miller <davem@...emloft.net>, Netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 10/10] bnxt_en: Add support for XDP_TX action.

On Mon, Jan 30, 2017 at 9:27 PM, Jakub Kicinski <kubakici@...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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ