Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH S30 v2 9/9] ice: allow 3k MTU for XDP
Date: Wed, 16 Oct 2019 08:02:01 -0700	[thread overview]
Message-ID: <20191016150201.41597-9-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20191016150201.41597-1-anthony.l.nguyen@intel.com>

From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

At this point ice driver is able to work on order 1 pages that are split
onto two 3k buffers. Let's reflect that when user is setting new mtu
size and XDP is present on interface.

Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 66e3b983d94a..88b5941ecf5c 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -4765,6 +4765,18 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
 	dev_err(dev, "Rebuild failed, unload and reload driver\n");
 }
 
+/**
+ * ice_max_xdp_frame_size - returns the maximum allowed frame size for XDP
+ * @vsi: Pointer to VSI structure
+ */
+static int ice_max_xdp_frame_size(struct ice_vsi *vsi)
+{
+	if (PAGE_SIZE >= 8192 || test_bit(ICE_FLAG_LEGACY_RX, vsi->back->flags))
+		return ICE_RXBUF_2048 - XDP_PACKET_HEADROOM;
+	else
+		return ICE_RXBUF_3072;
+}
+
 /**
  * ice_change_mtu - NDO callback to change the MTU
  * @netdev: network interface device structure
@@ -4786,11 +4798,11 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu)
 	}
 
 	if (ice_is_xdp_ena_vsi(vsi)) {
-		int frame_size = ICE_RXBUF_2048 - XDP_PACKET_HEADROOM;
+		int frame_size = ice_max_xdp_frame_size(vsi);
 
 		if (new_mtu + ICE_ETH_PKT_HDR_PAD > frame_size) {
 			netdev_err(netdev, "max MTU for XDP usage is %d\n",
-				   frame_size);
+				   frame_size - ICE_ETH_PKT_HDR_PAD);
 			return -EINVAL;
 		}
 	}
-- 
2.20.1


  parent reply	other threads:[~2019-10-16 15:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 15:01 [Intel-wired-lan] [PATCH S30 v2 1/9] ice: Introduce ice_base.c Tony Nguyen
2019-10-16 15:01 ` [Intel-wired-lan] [PATCH S30 v2 2/9] ice: get rid of per-tc flow in Tx queue configuration routines Tony Nguyen
2019-10-18  0:15   ` Bowers, AndrewX
2019-10-16 15:01 ` [Intel-wired-lan] [PATCH S30 v2 3/9] ice: Add support for XDP Tony Nguyen
2019-10-18  0:16   ` Bowers, AndrewX
2019-10-16 15:01 ` [Intel-wired-lan] [PATCH S30 v2 4/9] ice: Move common functions to ice_txrx_lib.c Tony Nguyen
2019-10-18  0:16   ` Bowers, AndrewX
2019-10-16 15:01 ` [Intel-wired-lan] [PATCH S30 v2 5/9] ice: Add support for AF_XDP Tony Nguyen
2019-10-18  0:17   ` Bowers, AndrewX
2019-10-16 15:01 ` [Intel-wired-lan] [PATCH S30 v2 6/9] ice: introduce legacy Rx flag Tony Nguyen
2019-10-18  0:17   ` Bowers, AndrewX
2019-10-16 15:01 ` [Intel-wired-lan] [PATCH S30 v2 7/9] ice: introduce frame padding computation logic Tony Nguyen
2019-10-18  0:17   ` Bowers, AndrewX
2019-10-16 15:02 ` [Intel-wired-lan] [PATCH S30 v2 8/9] ice: add build_skb() support Tony Nguyen
2019-10-18  0:18   ` Bowers, AndrewX
2019-10-16 15:02 ` Tony Nguyen [this message]
2019-10-18  0:18   ` [Intel-wired-lan] [PATCH S30 v2 9/9] ice: allow 3k MTU for XDP Bowers, AndrewX
2019-10-18  0:15 ` [Intel-wired-lan] [PATCH S30 v2 1/9] ice: Introduce ice_base.c Bowers, AndrewX

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=20191016150201.41597-9-anthony.l.nguyen@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@osuosl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox