Re: [PATCH 3/4 net-next] ibmvnic: Pad small packets to minimum MTU size

2018-03-12 Thread Thomas Falcon
On 03/11/2018 09:56 PM, David Miller wrote:
> From: Thomas Falcon 
> 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.



Re: [PATCH 3/4 net-next] ibmvnic: Pad small packets to minimum MTU size

2018-03-11 Thread David Miller
From: Thomas Falcon 
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.


[PATCH 3/4 net-next] ibmvnic: Pad small packets to minimum MTU size

2018-03-09 Thread 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 
---
 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