* [PATCH 0/4 net-next] ibmvnic: Fix VLAN and other device errata
@ 2018-03-09 19:23 Thomas Falcon
2018-03-09 19:23 ` [PATCH 1/4 net-next] ibmvnic: Account for VLAN tag in L2 Header descriptor Thomas Falcon
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Thomas Falcon @ 2018-03-09 19:23 UTC (permalink / raw)
To: netdev; +Cc: nfont, jallen, Thomas Falcon
This patch series contains fixes for VLAN and other backing hardware
errata. The VLAN fixes are mostly to account for the additional four
bytes VLAN header in TX descriptors and buffers, when applicable.
The other fixes for device errata are to pad small packets to avoid a
possible connection error that can occur when some devices attempt to
transmit small packets. The other fixes are GSO related. Some devices
cannot handle a smaller MSS or a packet with a single segment, so
disable GSO in those cases.
Thomas Falcon (4):
ibmvnic: Account for VLAN tag in L2 Header descriptor
ibmvnic: Account for VLAN header length in TX buffers
ibmvnic: Pad small packets to minimum MTU size
ibmvnic: Handle TSO backing device errata
drivers/net/ethernet/ibm/ibmvnic.c | 50 +++++++++++++++++++++++++++++++++++---
1 file changed, 46 insertions(+), 4 deletions(-)
--
2.12.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4 net-next] ibmvnic: Account for VLAN tag in L2 Header descriptor
2018-03-09 19:23 [PATCH 0/4 net-next] ibmvnic: Fix VLAN and other device errata Thomas Falcon
@ 2018-03-09 19:23 ` Thomas Falcon
2018-03-09 19:23 ` [PATCH 2/4 net-next] ibmvnic: Account for VLAN header length in TX buffers Thomas Falcon
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Thomas Falcon @ 2018-03-09 19:23 UTC (permalink / raw)
To: netdev; +Cc: nfont, jallen, Thomas Falcon
If a VLAN tag is present in the Ethernet header, account
for that when providing the L2 header to firmware.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 765407179fdd..ecfeba7ea981 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1226,7 +1226,10 @@ static int build_hdr_data(u8 hdr_field, struct sk_buff *skb,
int len = 0;
u8 *hdr;
- hdr_len[0] = sizeof(struct ethhdr);
+ if (skb_vlan_tagged(skb) && !skb_vlan_tag_present(skb))
+ hdr_len[0] = sizeof(struct vlan_ethhdr);
+ else
+ hdr_len[0] = sizeof(struct ethhdr);
if (skb->protocol == htons(ETH_P_IP)) {
hdr_len[1] = ip_hdr(skb)->ihl * 4;
--
2.12.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4 net-next] ibmvnic: Account for VLAN header length in TX buffers
2018-03-09 19:23 [PATCH 0/4 net-next] ibmvnic: Fix VLAN and other device errata Thomas Falcon
2018-03-09 19:23 ` [PATCH 1/4 net-next] ibmvnic: Account for VLAN tag in L2 Header descriptor Thomas Falcon
@ 2018-03-09 19:23 ` Thomas Falcon
2018-03-09 19:23 ` [PATCH 3/4 net-next] ibmvnic: Pad small packets to minimum MTU size Thomas Falcon
2018-03-09 19:23 ` [PATCH 4/4 net-next] ibmvnic: Handle TSO backing device errata Thomas Falcon
3 siblings, 0 replies; 7+ messages in thread
From: Thomas Falcon @ 2018-03-09 19:23 UTC (permalink / raw)
To: netdev; +Cc: nfont, jallen, Thomas Falcon
The extra four bytes of a VLAN packet was throwing off
TX buffer entry values used by the driver. Account for those
bytes when in buffer size and buffer entry calculations
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index ecfeba7ea981..ddb8afa11525 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -659,7 +659,7 @@ static int init_tx_pools(struct net_device *netdev)
if (alloc_long_term_buff(adapter, &tx_pool->long_term_buff,
adapter->req_tx_entries_per_subcrq *
- adapter->req_mtu)) {
+ (adapter->req_mtu + VLAN_HLEN))) {
release_tx_pools(adapter);
return -1;
}
@@ -1399,9 +1399,9 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
if (tx_pool->tso_index == IBMVNIC_TSO_BUFS)
tx_pool->tso_index = 0;
} else {
- offset = index * adapter->req_mtu;
+ offset = index * (adapter->req_mtu + VLAN_HLEN);
dst = tx_pool->long_term_buff.buff + offset;
- memset(dst, 0, adapter->req_mtu);
+ memset(dst, 0, adapter->req_mtu + VLAN_HLEN);
data_dma_addr = tx_pool->long_term_buff.addr + offset;
}
--
2.12.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4 net-next] ibmvnic: Pad small packets to minimum MTU size
2018-03-09 19:23 [PATCH 0/4 net-next] ibmvnic: Fix VLAN and other device errata Thomas Falcon
2018-03-09 19:23 ` [PATCH 1/4 net-next] ibmvnic: Account for VLAN tag in L2 Header descriptor Thomas Falcon
2018-03-09 19:23 ` [PATCH 2/4 net-next] ibmvnic: Account for VLAN header length in TX buffers Thomas Falcon
@ 2018-03-09 19:23 ` Thomas Falcon
2018-03-12 2:56 ` David Miller
2018-03-09 19:23 ` [PATCH 4/4 net-next] ibmvnic: Handle TSO backing device errata Thomas Falcon
3 siblings, 1 reply; 7+ messages in thread
From: Thomas Falcon @ 2018-03-09 19:23 UTC (permalink / raw)
To: netdev; +Cc: nfont, jallen, Thomas Falcon
Some backing devices cannot handle small packets well,
so pad any small packets to avoid that. It was recommended
that the VNIC driver should not send packets smaller than the
minimum MTU value provided by firmware, so pad small packets
to be at least that long.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index ddb8afa11525..d47379b95477 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1345,6 +1345,20 @@ static void build_hdr_descs_arr(struct ibmvnic_tx_buff *txbuff,
txbuff->indir_arr + 1);
}
+static int ibmvnic_xmit_workarounds(struct sk_buff *skb,
+ struct net_device *netdev)
+{
+ /* For some backing devices, mishandling of small packets
+ * can result in a loss of connection or TX stall. Device
+ * architects recommend that no packet should be smaller
+ * than the minimum MTU value provided to the driver, so
+ * pad any packets to that length
+ */
+ if (skb->len < netdev->min_mtu) {
+ return skb_put_padto(skb, netdev->min_mtu);
+ }
+}
+
static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
{
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
@@ -1382,6 +1396,13 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
goto out;
}
+ if (ibmvnic_xmit_workarounds(skb, adapter)) {
+ tx_dropped++;
+ tx_send_failed++;
+ ret = NETDEV_TX_OK;
+ goto out;
+ }
+
tx_pool = &adapter->tx_pool[queue_num];
tx_scrq = adapter->tx_scrq[queue_num];
txq = netdev_get_tx_queue(netdev, skb_get_queue_mapping(skb));
--
2.12.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4 net-next] ibmvnic: Handle TSO backing device errata
2018-03-09 19:23 [PATCH 0/4 net-next] ibmvnic: Fix VLAN and other device errata Thomas Falcon
` (2 preceding siblings ...)
2018-03-09 19:23 ` [PATCH 3/4 net-next] ibmvnic: Pad small packets to minimum MTU size Thomas Falcon
@ 2018-03-09 19:23 ` Thomas Falcon
3 siblings, 0 replies; 7+ messages in thread
From: Thomas Falcon @ 2018-03-09 19:23 UTC (permalink / raw)
To: netdev; +Cc: nfont, jallen, Thomas Falcon
TSO packets with one segment or with an MSS less than 224 can
cause errors on some backing devices, so disable GSO in those cases.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index d47379b95477..47377977591d 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -2052,6 +2052,23 @@ static int ibmvnic_change_mtu(struct net_device *netdev, int new_mtu)
return wait_for_reset(adapter);
}
+static netdev_features_t ibmvnic_features_check(struct sk_buff *skb,
+ struct net_device *dev,
+ netdev_features_t features)
+{
+ /* Some backing hardware adapters can not
+ * handle packets with a MSS less than 224
+ * or with only one segment.
+ */
+ if (skb_is_gso(skb)) {
+ if (skb_shinfo(skb)->gso_size < 224 ||
+ skb_shinfo(skb)->gso_segs == 1)
+ features &= ~NETIF_F_GSO_MASK;
+ }
+
+ return features;
+}
+
static const struct net_device_ops ibmvnic_netdev_ops = {
.ndo_open = ibmvnic_open,
.ndo_stop = ibmvnic_close,
@@ -2064,6 +2081,7 @@ static const struct net_device_ops ibmvnic_netdev_ops = {
.ndo_poll_controller = ibmvnic_netpoll_controller,
#endif
.ndo_change_mtu = ibmvnic_change_mtu,
+ .ndo_features_check = ibmvnic_features_check,
};
/* ethtool functions */
--
2.12.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4 net-next] ibmvnic: Pad small packets to minimum MTU size
2018-03-09 19:23 ` [PATCH 3/4 net-next] ibmvnic: Pad small packets to minimum MTU size Thomas Falcon
@ 2018-03-12 2:56 ` David Miller
2018-03-12 15:24 ` Thomas Falcon
0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2018-03-12 2:56 UTC (permalink / raw)
To: tlfalcon; +Cc: netdev, nfont, jallen
From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Fri, 9 Mar 2018 13:23:56 -0600
> + /* For some backing devices, mishandling of small packets
> + * can result in a loss of connection or TX stall. Device
> + * architects recommend that no packet should be smaller
> + * than the minimum MTU value provided to the driver, so
> + * pad any packets to that length
> + */
> + if (skb->len < netdev->min_mtu) {
> + return skb_put_padto(skb, netdev->min_mtu);
> + }
Please do not use curly braces for a single statement
basic block.
Thank you.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4 net-next] ibmvnic: Pad small packets to minimum MTU size
2018-03-12 2:56 ` David Miller
@ 2018-03-12 15:24 ` Thomas Falcon
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Falcon @ 2018-03-12 15:24 UTC (permalink / raw)
To: David Miller; +Cc: netdev, nfont, jallen
On 03/11/2018 09:56 PM, David Miller wrote:
> From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
> Date: Fri, 9 Mar 2018 13:23:56 -0600
>
>> + /* For some backing devices, mishandling of small packets
>> + * can result in a loss of connection or TX stall. Device
>> + * architects recommend that no packet should be smaller
>> + * than the minimum MTU value provided to the driver, so
>> + * pad any packets to that length
>> + */
>> + if (skb->len < netdev->min_mtu) {
>> + return skb_put_padto(skb, netdev->min_mtu);
>> + }
> Please do not use curly braces for a single statement
> basic block.
>
> Thank you.
>
Oops, sorry about that. I'll fix that and resend.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-03-12 15:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-09 19:23 [PATCH 0/4 net-next] ibmvnic: Fix VLAN and other device errata Thomas Falcon
2018-03-09 19:23 ` [PATCH 1/4 net-next] ibmvnic: Account for VLAN tag in L2 Header descriptor Thomas Falcon
2018-03-09 19:23 ` [PATCH 2/4 net-next] ibmvnic: Account for VLAN header length in TX buffers Thomas Falcon
2018-03-09 19:23 ` [PATCH 3/4 net-next] ibmvnic: Pad small packets to minimum MTU size Thomas Falcon
2018-03-12 2:56 ` David Miller
2018-03-12 15:24 ` Thomas Falcon
2018-03-09 19:23 ` [PATCH 4/4 net-next] ibmvnic: Handle TSO backing device errata Thomas Falcon
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).