From owner-freebsd-net@freebsd.org  Tue Sep 13 01:50:03 2016
Return-Path: <owner-freebsd-net@freebsd.org>
Delivered-To: freebsd-net@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9C8FBD8027
 for <freebsd-net@mailman.ysv.freebsd.org>;
 Tue, 13 Sep 2016 01:50:03 +0000 (UTC)
 (envelope-from pyunyh@gmail.com)
Received: from mail-pa0-x22a.google.com (mail-pa0-x22a.google.com
 [IPv6:2607:f8b0:400e:c03::22a])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id A93E6B9D
 for <freebsd-net@freebsd.org>; Tue, 13 Sep 2016 01:50:03 +0000 (UTC)
 (envelope-from pyunyh@gmail.com)
Received: by mail-pa0-x22a.google.com with SMTP id wk8so2367004pab.1
 for <freebsd-net@freebsd.org>; Mon, 12 Sep 2016 18:50:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:date:to:cc:subject:message-id:reply-to:references:mime-version
 :content-disposition:in-reply-to:user-agent;
 bh=xtck9inBVVBLNE9aInI4rieavG98SzREawqbex8HCLs=;
 b=yM+yeYHQG+85I2pSpg/H1Qj1B+pfs8XI5H3X7kcIXfp/KyfRF4FUsIL0jYMK23yfwe
 BY1Mhl47SykS9mo6Fs0xPhW+u7L1mB/3gfC8WaGpsA3dVrZyS/Cgegl/UrmXzcs255mJ
 t8z2YqUY5KuM2ZoHO0whc6v5rAxX1Rvm7Jx917o+/CmauNg2LrZH5hYDFODpB6KpDefP
 ldLPFkfkOJXPGr5BVmGXF/w+tsxWSKwYz6EobqQI/olxFVfwJeXXW7Y+aGhcKKIJqoyu
 YfOChW61P59CMkr9d/EQRVquAxZTGJiT89WBnyGKyWscqz4L9F9Ilx3jjofZ+Ho1GzCU
 aONA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:date:to:cc:subject:message-id:reply-to
 :references:mime-version:content-disposition:in-reply-to:user-agent;
 bh=xtck9inBVVBLNE9aInI4rieavG98SzREawqbex8HCLs=;
 b=IVML4wY5DFNwNGyi0FgwvNtm6AswCOzZjz6teBirvPswcmf9mKe3QYilwQKnxhlD7f
 op+ymTIPsjFofu8LN+GnfoQwjZMx2AnxOOPEEbxSI5pxop/sz9wAICLNGYRgLXcDx3GM
 JcIiG8eTm5cUJr9yz+9ic8vsfFWpi/hDk4I3+c+/6T4T3qS5uSAZTA5xDQV702tiuVCM
 L5hlE4kOoaKurDc5SK3qQpDaPG5gZUUOdqYC/qxihPrEf1BumJc25fPIgoY8rCRBGRyu
 VpLw6IhkQGp+plvQFV1ojhCI/5VLjeqzuvFaICljc9PFtCcJFsb797NmRbAvE45a6JWB
 sNMw==
X-Gm-Message-State: AE9vXwOfQjyJee2hLeURHgVnmeIL1YHcgM5GD6qpcFVPdgUNRjEZ9wuiKOOuiqNDayqAjQ==
X-Received: by 10.66.160.200 with SMTP id xm8mr40060928pab.12.1473731403069;
 Mon, 12 Sep 2016 18:50:03 -0700 (PDT)
Received: from localhost ([106.247.248.2])
 by smtp.gmail.com with ESMTPSA id b64sm27159503pfa.82.2016.09.12.18.50.00
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 12 Sep 2016 18:50:02 -0700 (PDT)
From: YongHyeon PYUN <pyunyh@gmail.com>
X-Google-Original-From: "YongHyeon PYUN" <yongari@gmail.com>
Received: by localhost (sSMTP sendmail emulation);
 Tue, 13 Sep 2016 10:49:56 +0900
Date: Tue, 13 Sep 2016 10:49:56 +0900
To: Emeric POUPON <emeric.poupon@stormshield.eu>
Cc: freebsd-net@FreeBSD.org
Subject: Re: Vlan offloaded checksums
Message-ID: <20160913014956.GA1199@michelle.fasterthan.co.kr>
Reply-To: pyunyh@gmail.com
References: <1628370702.4125956.1473696542873.JavaMail.zimbra@stormshield.eu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1628370702.4125956.1473696542873.JavaMail.zimbra@stormshield.eu>
User-Agent: Mutt/1.4.2.3i
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net/>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Sep 2016 01:50:03 -0000

On Mon, Sep 12, 2016 at 06:09:02PM +0200, Emeric POUPON wrote:
> Hello,
> 
> I have a network driver that supports hardware checksums.
> Thanks to offset parameters, it also supports VLAN checksums.
> However, it does not handle hardware tagging (not sure the underlying network adapter can actually do it)
> 
> Unfortunately, the VLAN hardware checksums seem to be done only if IFCAP_VLAN_HWTAGGING is set [1]
> I do not understand this assertion: if I force the propagation of the hardware checksuming only based on the IFCAP_VLAN_HWCSUM, it works fine with my driver.
> 
> What do you think?
> 

As you said some NICs do not rely on VLAN H/W tagging to make VLAN
checksum offloading work.  But current vlan(4) assumes VLAN H/W
tagging is prerequisite condition to support VLAN checksum
offloading. The same is true for TSO support over VLAN.

I don't know what NIC you're referring to but it's rare to see
controllers that don't support VLAN H/W tagging on PC/Servers.  But
it might be common NIC feature found on SoCs.

If H/W requires offset parameters for checksum offloading you may
already have to parse mbufs in the driver to extract that
information and it would add additional overheads.  If you really
want to enable VLAN H/W checksum offloading in your driver you may
be able to add VLAN tag handling in the parser and announce VLAN
H/W tagging capability to network stack.  You may not notice
performance differences with VLAN H/W checksum offloading though.