From patchwork Wed Oct 16 11:40:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 176470 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp7243635ill; Wed, 16 Oct 2019 04:40:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzA0RAyUHxsRKic66y6hE11VTwGMN1D5b3i2GPoaRs3/xGITAPCXtpT/LwKgB0vGIf4puEz X-Received: by 2002:a17:906:3593:: with SMTP id o19mr39177026ejb.61.1571226043893; Wed, 16 Oct 2019 04:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571226043; cv=none; d=google.com; s=arc-20160816; b=dbWM76vFKzZXdPt0CrF9swv85+DAqrc3zu5F24X3Ng1CpXdod526W9pIllTwNh1Z66 VQwlUfZYz1WKOXWjGO0GZyeyfYFOQqF5uZ3zyelKaq7Y3EXlR9sI/wyDbivtyZfjBrqJ kf5uvOWvY88X6Kn09UD5loT8rUlKmDAiABCNyDI3JXl39epKM63m7wcu2ATY5K5GsNuB Cna+qPA9DjNHMBpiRYrrEUMKqfsp9yWzOgirvLlXPKt8aeaCAEpRWEjuUUOZaeu50Csh I8KCJEdIQe9x2OHuiEPCYe4z1RQHYqV+H05ehibAcEvleuU/BFxKRzK3df6fYMxntGbo ePog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=5BmxpLDnpwLj/rKEuNcorTG+zgO8YvtimK56et3jBEE=; b=cWAbhsqgEQwqTt46/WAXQkVLZYAt7jxgKK0oeDOux1luQZKndfNqWvtuNZ1r1+r1nz emRRF4TY+I4AKStFKG8AbDCmbmfw9xkFg63REG0CGp+ZS97Bu9dvwDc/oE8l2y4Buf0d PfAqY1tvaDfnUsc071TP2S1VvWT/AQvFFDUthh8zEfvxhEXeWIvMmd+4RBltGQvuPxs5 ecHj11u6A8HP1MxKe3B/cSQgD/y4L/fMBYRu7fGflN1BNsrkvkq55vGm3rPQz5LUllad kBBm6X/g7bZ7ewyjAv5EYykINwQUs6rOplzpEakvwmq5829YujDj8JF0yQqIvO45RLK8 YPSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HomfB66g; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c9si15308935ejn.362.2019.10.16.04.40.43; Wed, 16 Oct 2019 04:40:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HomfB66g; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727187AbfJPLkk (ORCPT + 8 others); Wed, 16 Oct 2019 07:40:40 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40535 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbfJPLkj (ORCPT ); Wed, 16 Oct 2019 07:40:39 -0400 Received: by mail-wm1-f66.google.com with SMTP id b24so2383573wmj.5 for ; Wed, 16 Oct 2019 04:40:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5BmxpLDnpwLj/rKEuNcorTG+zgO8YvtimK56et3jBEE=; b=HomfB66g+peuZMRNypTayjh4DsFkweI6KARmYnQT9H2F4gwdG4NxbHUTro8JV/wtPs I8fbQfNQ00x+s408Ql3AsES3Vz9HD3q8mxlVepRKztDKQDXvLZ59Yp6vMEzlCaZ9upBM iFDApUfQXUrtRC/fhoWk5XSvB4MdSrM1/GkpVAOiOGn/vSyJfFABKH29pN6C0VIl8NhO Ruimz5QleCbow2jAbqFHsF+9FFctFx4K6cTevf8/ItHBy7dbIOtyWzKaJQdKqMSQNGQO ook30efWLyvgLaKue1MCQLVHFiOLTNYSmk8dmd+F2w6s0puXoZgCb8TbPRE0hvS0dnY6 tg9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5BmxpLDnpwLj/rKEuNcorTG+zgO8YvtimK56et3jBEE=; b=EGj3CmN4PfLO/Av4tcIlkc6JDe8VqBPmiu9ZDT0V9B4S5UtjHHU3nORxKsyjCXcac3 kLbu8LBd27fwAunwOxGrUmZM3UpRV2xGozLr0xEJRwwG7WzToVSvAyA76976Rju87lhe /yatdAwzVKi4C65g4bHhAZdOFVX1VPkJ2tKL2hgJhfbPcjc2C3bN1wsTsRx0x57/LqAT 9ogm/lFpp7BrE+gnIC/VYI9g5A8S9wdE8voPz7ZafYryXNSQuIy8hnre7pjvywbApA7K kvO56tT+iDGLjZxkDY8dXZlUmWqCZPASyM5JFO0M6O0GQO+QUpoikN4h+hzb0+/r9ucS Jmaw== X-Gm-Message-State: APjAAAUAdgvbFNhE0uo40k/bEpc1y6068aNJ7KH4/5Vo16EBQK9xpMdh +MP5RvUrKW25cwakzZS6RyJPsYSpHE4= X-Received: by 2002:a7b:c849:: with SMTP id c9mr3088494wml.58.1571226037275; Wed, 16 Oct 2019 04:40:37 -0700 (PDT) Received: from apalos.home (ppp-94-65-92-5.home.otenet.gr. [94.65.92.5]) by smtp.gmail.com with ESMTPSA id y3sm8361628wmg.2.2019.10.16.04.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 04:40:36 -0700 (PDT) From: Ilias Apalodimas To: netdev@vger.kernel.org, jaswinder.singh@linaro.org, davem@davemloft.net, brouer@redhat.com, lorenzo@kernel.org Cc: Ilias Apalodimas Subject: [PATCH] net: netsec: Correct dma sync for XDP_TX frames Date: Wed, 16 Oct 2019 14:40:32 +0300 Message-Id: <20191016114032.21617-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org bpf_xdp_adjust_head() can change the frame boundaries. Account for the potential shift properly by calculating the new offset before syncing the buffer to the device for XDP_TX Fixes: ba2b232108d3 ("net: netsec: add XDP support") Signed-off-by: Ilias Apalodimas --- drivers/net/ethernet/socionext/netsec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.23.0 Reviewed-by: Jakub Kicinski diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index f9e6744d8fd6..41ddd8fff2a7 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -847,8 +847,8 @@ static u32 netsec_xdp_queue_one(struct netsec_priv *priv, enum dma_data_direction dma_dir = page_pool_get_dma_dir(rx_ring->page_pool); - dma_handle = page_pool_get_dma_addr(page) + - NETSEC_RXBUF_HEADROOM; + dma_handle = page_pool_get_dma_addr(page) + xdpf->headroom + + sizeof(*xdpf); dma_sync_single_for_device(priv->dev, dma_handle, xdpf->len, dma_dir); tx_desc.buf_type = TYPE_NETSEC_XDP_TX;