From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Emil Tantilov <emil.s.tantilov@intel.com>,
netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 09/13] ixgbevf: make sure all frames fit minimum size requirements
Date: Mon, 26 Feb 2018 10:07:52 -0800 [thread overview]
Message-ID: <20180226180756.10736-10-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <20180226180756.10736-1-jeffrey.t.kirsher@intel.com>
From: Emil Tantilov <emil.s.tantilov@intel.com>
Similar to commit a50c29dd09ed
("ixgbe: Make certain that all frames fit minimum size requirements")
Make sure that any packet we attempt to transmit will meet minimum
size requirements.
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 30 +++++++++++++++++++----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 189d6af43b37..a10b1bdc99e3 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -3779,11 +3779,10 @@ static int ixgbevf_maybe_stop_tx(struct ixgbevf_ring *tx_ring, int size)
return __ixgbevf_maybe_stop_tx(tx_ring, size);
}
-static int ixgbevf_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
+static int ixgbevf_xmit_frame_ring(struct sk_buff *skb,
+ struct ixgbevf_ring *tx_ring)
{
- struct ixgbevf_adapter *adapter = netdev_priv(netdev);
struct ixgbevf_tx_buffer *first;
- struct ixgbevf_ring *tx_ring;
int tso;
u32 tx_flags = 0;
u16 count = TXD_USE_COUNT(skb_headlen(skb));
@@ -3798,8 +3797,6 @@ static int ixgbevf_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
return NETDEV_TX_OK;
}
- tx_ring = adapter->tx_ring[skb->queue_mapping];
-
/* need: 1 descriptor per page * PAGE_SIZE/IXGBE_MAX_DATA_PER_TXD,
* + 1 desc for skb_headlen/IXGBE_MAX_DATA_PER_TXD,
* + 2 desc gap to keep tail from touching head,
@@ -3852,6 +3849,29 @@ static int ixgbevf_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
return NETDEV_TX_OK;
}
+static int ixgbevf_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
+{
+ struct ixgbevf_adapter *adapter = netdev_priv(netdev);
+ struct ixgbevf_ring *tx_ring;
+
+ if (skb->len <= 0) {
+ dev_kfree_skb_any(skb);
+ return NETDEV_TX_OK;
+ }
+
+ /* The minimum packet size for olinfo paylen is 17 so pad the skb
+ * in order to meet this minimum size requirement.
+ */
+ if (skb->len < 17) {
+ if (skb_padto(skb, 17))
+ return NETDEV_TX_OK;
+ skb->len = 17;
+ }
+
+ tx_ring = adapter->tx_ring[skb->queue_mapping];
+ return ixgbevf_xmit_frame_ring(skb, tx_ring);
+}
+
/**
* ixgbevf_set_mac - Change the Ethernet Address of the NIC
* @netdev: network interface device structure
--
2.14.3
next prev parent reply other threads:[~2018-02-26 18:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-26 18:07 [net-next 00/13][pull request] 10GbE Intel Wired LAN Driver Updates 2018-02-26 Jeff Kirsher
2018-02-26 18:07 ` [net-next 01/13] ixgbe: remove redundant initialization of 'pool' Jeff Kirsher
2018-02-26 18:07 ` [net-next 02/13] ixgbe: Avoid to write the RETA table when unnecessary Jeff Kirsher
2018-02-26 18:07 ` [net-next 03/13] ixgbe: prevent ptp_rx_hang from running when in FILTER_ALL mode Jeff Kirsher
2018-02-26 18:07 ` [net-next 04/13] ixgbevf: use page_address offset from page Jeff Kirsher
2018-02-26 18:07 ` [net-next 05/13] ixgbevf: add ethtool private flag for legacy Rx Jeff Kirsher
2018-02-26 18:07 ` [net-next 06/13] ixgbevf: add support for using order 1 pages to receive large frames Jeff Kirsher
2018-02-26 18:07 ` [net-next 07/13] ixgbevf: setup queue counts Jeff Kirsher
2018-02-26 18:07 ` [net-next 08/13] ixgbevf: add support for padding packet Jeff Kirsher
2018-02-26 18:07 ` Jeff Kirsher [this message]
2018-02-26 18:07 ` [net-next 10/13] ixgbevf: allocate the rings as part of q_vector Jeff Kirsher
2018-02-26 18:07 ` [net-next 11/13] ixgbevf: break out Rx buffer page management Jeff Kirsher
2018-02-26 18:07 ` [net-next 12/13] ixgbevf: add build_skb support Jeff Kirsher
2018-02-26 18:07 ` [net-next 13/13] ixgbevf: remove redundant initialization of variable 'dma' Jeff Kirsher
2018-02-27 1:59 ` [net-next 00/13][pull request] 10GbE Intel Wired LAN Driver Updates 2018-02-26 David Miller
2018-02-27 21:29 ` Alexander Duyck
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=20180226180756.10736-10-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=emil.s.tantilov@intel.com \
--cc=jogreene@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=sassmann@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).