From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753372AbcGaKQE (ORCPT ); Sun, 31 Jul 2016 06:16:04 -0400 Received: from mga09.intel.com ([134.134.136.24]:25009 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751332AbcGaKP4 convert rfc822-to-8bit (ORCPT ); Sun, 31 Jul 2016 06:15:56 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,449,1464678000"; d="scan'208";a="742159206" From: "Levy, Amir (Jer)" To: Stephen Hemminger CC: "andreas.noever@gmail.com" , "gregkh@linuxfoundation.org" , "bhelgaas@google.com" , "corbet@lwn.net" , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-doc@vger.kernel.org" , thunderbolt-linux , "Westerberg, Mika" , "Winkler, Tomas" Subject: RE: [PATCH v5 6/8] thunderbolt: Networking transmit and receive Thread-Topic: [PATCH v5 6/8] thunderbolt: Networking transmit and receive Thread-Index: AQHR6KhzX+8ky2JNcEq59AE2G5Wy76AvtuCAgAKgpTA= Date: Sun, 31 Jul 2016 10:15:52 +0000 Message-ID: References: <1469693721-5641-1-git-send-email-amir.jer.levy@intel.com> <1469693721-5641-7-git-send-email-amir.jer.levy@intel.com> <20160729140741.18ca3e35@xeon-e3> In-Reply-To: <20160729140741.18ca3e35@xeon-e3> Accept-Language: he-IL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.184.70.11] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 30 2016, 12:07 AM, Stephen Hemminger wrote: > On Thu, 28 Jul 2016 11:15:19 +0300 > Amir Levy wrote: > > > + /* pad short packets */ > > + if (unlikely(skb->len < ETH_ZLEN)) { > > + int pad_len = ETH_ZLEN - skb->len; > > + > > + /* The skb is freed on error */ > > + if (unlikely(skb_pad(skb, pad_len))) { > > + cleaned_count += frame_count; > > + continue; > > + } > > + __skb_put(skb, pad_len); > > + } > > Packets should be padded on transmit, not on receive?? This driver emulates an Ethernet adapter on top of Thunderbolt technology. The Thunderbolt medium hasn't any restriction on minimum frame size and doesn't have the Ethernet collision detection limitation. So moving this code from transmit is actually an optimization - sending the minimum on the wire. The network stack thinks it is Ethernet, it might not accept Runt frames, so the driver pads the frame in receive. Looks like it deserves a comment in the code. Will add it.