Date: Tue, 11 Nov 2014 22:48:36 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Bjoern A. Zeeb" <bz@freebsd.org>, src-committers@freebsd.org Subject: Re: svn commit: r274340 - in head/sys: crypto/rijndael dev/random geom/bde Message-ID: <20141111223756.F3519@besplex.bde.org> In-Reply-To: <86sihq5a2v.fsf@nine.des.no> References: <201411100944.sAA9icnN061962@svn.freebsd.org> <3C962D07-3AAF-42EA-9D3E-D8F6D9A812B0@FreeBSD.org> <86sihq5a2v.fsf@nine.des.no>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 11 Nov 2014, [utf-8] Dag-Erling Sm=C3=B8rgrav wrote: > "Bjoern A. Zeeb" <bz@FreeBSD.org> writes: >> This fails to compile on all gcc platforms. >> >> cc1: warnings being treated as errors >> /scratch/tmp/bz/head.svn/sys/modules/geom/geom_bde/../../../crypto/rijnd= ael/rijndael-api-fst.c: >> In function 'rijndael_padEncrypt': >> /scratch/tmp/bz/head.svn/sys/modules/geom/geom_bde/../../../crypto/rijnd= ael/rijndael-api-fst.c:236: >> warning: cast discards qualifiers from pointer target type >> [...] > > The code is quite clearly wrong. Why doesn't clang complain? -Wcast-qual is broken (has no effect) with clang. This is incompatible with gcc and defeats the reason of existence of -Wcast-qual. -Wcast-qual is not a very good warning option since the official way to remove qualifiers in C is to cast them away. Casting them away is better than using the __DECONST() abomination. The option exists because it is too easy for sloppy code to cast away const without really intending to or when casting away const is done intentionally but is an error. Bruce From owner-svn-src-head@FreeBSD.ORG Tue Nov 11 12:06:01 2014 Return-Path: <owner-svn-src-head@FreeBSD.ORG> Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 673A75F5; Tue, 11 Nov 2014 12:06:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5393BFC9; Tue, 11 Nov 2014 12:06:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sABC61B2044723; Tue, 11 Nov 2014 12:06:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sABC60Z5044716; Tue, 11 Nov 2014 12:06:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201411111206.sABC60Z5044716@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Tue, 11 Nov 2014 12:06:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r274376 - in head/sys: net netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 11 Nov 2014 12:06:01 -0000 Author: hselasky Date: Tue Nov 11 12:05:59 2014 New Revision: 274376 URL: https://svnweb.freebsd.org/changeset/base/274376 Log: Fix some minor TSO issues: - Improve description of TSO limits. - Remove a not needed KASSERT() - Remove some not needed variable casts. Sponsored by: Mellanox Technologies Discussed with: lstewart @ MFC after: 1 week Modified: head/sys/net/if.c head/sys/net/if_var.h head/sys/netinet/tcp_output.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Nov 11 11:06:10 2014 (r274375) +++ head/sys/net/if.c Tue Nov 11 12:05:59 2014 (r274376) @@ -717,13 +717,6 @@ if_attach_internal(struct ifnet *ifp, in ifp->if_hw_tsomaxsegsize); } } - /* - * If the "if_hw_tsomax" limit is set, check if it is - * too small: - */ - KASSERT(ifp->if_hw_tsomax == 0 || - ifp->if_hw_tsomax >= (IP_MAXPACKET / 8), - ("%s: if_hw_tsomax is outside of range", __func__)); #endif } #ifdef VIMAGE Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Tue Nov 11 11:06:10 2014 (r274375) +++ head/sys/net/if_var.h Tue Nov 11 12:05:59 2014 (r274376) @@ -232,16 +232,24 @@ struct ifnet { counter_u64_t if_counters[IFCOUNTERS]; /* Stuff that's only temporary and doesn't belong here. */ - u_int if_hw_tsomax; /* TSO total burst length - * limit in bytes. A value of - * zero means no limit. Have - * to find a better place for - * it eventually. */ /* - * TSO fields for segment limits. If a field below is zero, - * there is no TSO segment limit. + * Network adapter TSO limits: + * =========================== + * + * If the "if_hw_tsomax" field is zero the maximum segment + * length limit does not apply. If the "if_hw_tsomaxsegcount" + * or the "if_hw_tsomaxsegsize" field is zero the TSO segment + * count limit does not apply. If all three fields are zero, + * there is no TSO limit. + * + * NOTE: The TSO limits only apply to the data payload part of + * a TCP/IP packet. That means there is no need to subtract + * space for ethernet-, vlan-, IP- or TCP- headers from the + * TSO limits unless the hardware driver in question requires + * so. */ + u_int if_hw_tsomax; /* TSO maximum size in bytes */ u_int if_hw_tsomaxsegcount; /* TSO maximum segment count */ u_int if_hw_tsomaxsegsize; /* TSO maximum segment size in bytes */ Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Tue Nov 11 11:06:10 2014 (r274375) +++ head/sys/netinet/tcp_output.c Tue Nov 11 12:05:59 2014 (r274376) @@ -802,9 +802,9 @@ send: max_len = (if_hw_tsomax - hdrlen); if (max_len <= 0) { len = 0; - } else if (len > (u_int)max_len) { + } else if (len > max_len) { sendalot = 1; - len = (u_int)max_len; + len = max_len; } } @@ -817,7 +817,7 @@ send: max_len = 0; mb = sbsndmbuf(&so->so_snd, off, &moff); - while (mb != NULL && (u_int)max_len < len) { + while (mb != NULL && max_len < len) { u_int mlen; u_int frags; @@ -851,9 +851,9 @@ send: } if (max_len <= 0) { len = 0; - } else if (len > (u_int)max_len) { + } else if (len > max_len) { sendalot = 1; - len = (u_int)max_len; + len = max_len; } } @@ -864,7 +864,7 @@ send: */ max_len = (tp->t_maxopd - optlen); if ((off + len) < so->so_snd.sb_cc) { - moff = len % (u_int)max_len; + moff = len % max_len; if (moff != 0) { len -= moff; sendalot = 1; @@ -875,8 +875,8 @@ send: * In case there are too many small fragments * don't use TSO: */ - if (len <= (u_int)max_len) { - len = (u_int)max_len; + if (len <= max_len) { + len = max_len; sendalot = 1; tso = 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141111223756.F3519>