From patchwork Thu Sep 7 17:32:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Fastabend X-Patchwork-Id: 811090 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="r9UYyd0L"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xp6x36MXjz9sRY for ; Fri, 8 Sep 2017 03:33:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 502BC87AFE; Thu, 7 Sep 2017 17:33:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i_7Qm-tZADxZ; Thu, 7 Sep 2017 17:33:08 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id F40E687BC5; Thu, 7 Sep 2017 17:33:07 +0000 (UTC) X-Original-To: intel-wired-lan@osuosl.org Delivered-To: intel-wired-lan@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id ED4B01C2922 for ; Thu, 7 Sep 2017 17:33:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E6B8E87B02 for ; Thu, 7 Sep 2017 17:33:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rYCPbKvvvvPc for ; Thu, 7 Sep 2017 17:33:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 711AE87AFE for ; Thu, 7 Sep 2017 17:33:05 +0000 (UTC) Received: by mail-pf0-f194.google.com with SMTP id y68so168313pfd.1 for ; Thu, 07 Sep 2017 10:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=G9GPh+D+I74WfL6nt87ZZmatss7ju7ksF6utet38iX8=; b=r9UYyd0LFf5Y1t4OBXFS1XL8fp++RGDmUFNssiSD6RREU5xaOqfu4bsKSlpdX9Mvv5 6kUbsUjF8G/mIMDQknwOcR6A4bwH/Hkcno3SPiz/C553dvgzE782loyPsnx/HElRWUYF n4F5TDBX/7k1/KIHhWThmuuTt2tCSb6NnpG09dKXPx3pW6hkFz4ksdj2LSMTRN23pSLj tuC6Ai5Dc1LaGMGrPfyFpvZ87mjEHJxsijm8PVAUS72YkJ8LSUf6sei0x5/ZdqWvbLSP qU276vkA/8CZrlTKjB3bg4ceCwGM1WLsQYx9OJcXsHKVQDMypHUDqRGYYjp1OCmziZHm tutw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=G9GPh+D+I74WfL6nt87ZZmatss7ju7ksF6utet38iX8=; b=WhrjBKJryJ9XSv3lHGbC9lD98GgLzt8DqYZBgaNgSP3ZGNgBVyhM60k8qxnyoXRCWY 6qaTl3LE4GjSZyf3jFHoNCYA3ZreZgEXEM/5urWS0eJfo3DZJrgrs75xgOUCKXmX0ysl NtT6pzdmuSCV2CgmRlKVBd3A+1GNRVBvtETlKaQHVtSzvydFg7DfGlo6YMWxqrXvqAAm v7HkAyeW+rEnhmrxWt8WLUC7V7OLiDGJBYEhqXblrh343B3aK6Um/XNyhrtiSwHHzuDu tdCcuTPyBVFrwYM+R7nvI9id1y9e7fFU81OgpQO5C5f0Hzw0Ym1YpmfA2h/qgmVJ5FIs 3eyg== X-Gm-Message-State: AHPjjUjErqxQJeqlKQ1lGbgY76OZEBTPlUiCFKyU+5JehCeESB4/tqzm zToaYDIwgtFvcVjf X-Google-Smtp-Source: ADKCNb7ITt9idErrV/NoeE+V9JHUeFABXV4MSw7HLbG/nBAiGM1hS8/xYUSoyEzkohyNDug0HobrNg== X-Received: by 10.98.223.210 with SMTP id d79mr81170pfl.67.1504805584707; Thu, 07 Sep 2017 10:33:04 -0700 (PDT) Received: from [127.0.1.1] ([72.168.144.71]) by smtp.gmail.com with ESMTPSA id y28sm290643pfd.58.2017.09.07.10.33.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 10:33:03 -0700 (PDT) From: John Fastabend To: intel-wired-lan@osuosl.org Date: Thu, 07 Sep 2017 10:32:48 -0700 Message-ID: <20170907173248.7589.44547.stgit@john-Precision-Tower-5810> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [net PATCH] ixgbe: incorrect xdp ring accounting in ethtool tx_frame param X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Changing the TX ring parameters with an XDP program attached may cause the XDP queues to be cleared and the TX rings to be incorrectly configured. Fix by doing correct ring accounting in setup call. Fixes: 33fdc82f0883 ("ixgbe: add support for XDP_TX action") Signed-off-by: John Fastabend Tested-by: Andrew Bowers --- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 72c5657..c3e7a81 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c @@ -1048,7 +1048,7 @@ static int ixgbe_set_ringparam(struct net_device *netdev, { struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_ring *temp_ring; - int i, err = 0; + int i, j, err = 0; u32 new_rx_count, new_tx_count; if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) @@ -1085,8 +1085,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev, } /* allocate temporary buffer to store rings in */ - i = max_t(int, adapter->num_tx_queues, adapter->num_rx_queues); - i = max_t(int, i, adapter->num_xdp_queues); + i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues, + adapter->num_rx_queues); temp_ring = vmalloc(i * sizeof(struct ixgbe_ring)); if (!temp_ring) { @@ -1118,8 +1118,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev, } } - for (i = 0; i < adapter->num_xdp_queues; i++) { - memcpy(&temp_ring[i], adapter->xdp_ring[i], + for (j = 0; j < adapter->num_xdp_queues; j++, i++) { + memcpy(&temp_ring[i], adapter->xdp_ring[j], sizeof(struct ixgbe_ring)); temp_ring[i].count = new_tx_count; @@ -1139,10 +1139,10 @@ static int ixgbe_set_ringparam(struct net_device *netdev, memcpy(adapter->tx_ring[i], &temp_ring[i], sizeof(struct ixgbe_ring)); } - for (i = 0; i < adapter->num_xdp_queues; i++) { - ixgbe_free_tx_resources(adapter->xdp_ring[i]); + for (j = 0; j < adapter->num_xdp_queues; j++, i++) { + ixgbe_free_tx_resources(adapter->xdp_ring[j]); - memcpy(adapter->xdp_ring[i], &temp_ring[i], + memcpy(adapter->xdp_ring[j], &temp_ring[i], sizeof(struct ixgbe_ring)); }