From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH] ethernet: e1000e: define lat_ns as u64 instead of s64
Date: Wed, 08 Apr 2015 11:13:02 -0700 [thread overview]
Message-ID: <1428516782.2579.2.camel@jtkirshe-mobl> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CB166B0@AcuExch.aculab.com>
On Wed, 2015-04-08 at 09:40 +0000, David Laight wrote:
> From: yanjiang.jin at windriver.com
> > Sent: 03 April 2015 10:18
> > From: Yanjiang Jin <yanjiang.jin@windriver.com>
> >
> > do_div() expects the type of "n" to be uint64_t, define "lat_ns" as u64 to
> > avoid the below warning, also update its correlative operations and data.
> >
> > In file included from ./arch/powerpc/include/asm/div64.h:1:0,
> > from include/linux/kernel.h:124,
> > from include/linux/list.h:8,
> > from include/linux/timer.h:4,
> > from drivers/net/ethernet/intel/e1000e/e1000.h:29,
> > from drivers/net/ethernet/intel/e1000e/ich8lan.c:59:
> > drivers/net/ethernet/intel/e1000e/ich8lan.c: In function 'e1000_platform_pm_pch_lpt':
> > include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled
> > by default]
> > (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
> > ^
> > drivers/net/ethernet/intel/e1000e/ich8lan.c:1016:4: note: in expansion of macro 'do_div'
> > do_div(lat_ns, speed);
> >
> > Signed-off-by: Yanjiang Jin <yanjiang.jin@windriver.com>
> > ---
> > drivers/net/ethernet/intel/e1000e/ich8lan.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
> > index 48b74a5..baab58b 100644
> > --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
> > +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
> > @@ -982,8 +982,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
> > u16 speed, duplex, scale = 0;
> > u16 max_snoop, max_nosnoop;
> > u16 max_ltr_enc; /* max LTR latency encoded */
> > - s64 lat_ns; /* latency (ns) */
> > - s64 value;
> > + u64 lat_ns; /* latency (ns) */
> > + u64 value;
> > u32 rxa;
> >
> > if (!hw->adapter->max_frame_size) {
> > @@ -1008,8 +1008,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
> > * 2^25*(2^10-1) ns. The scale is encoded as 0=2^0ns,
> > * 1=2^5ns, 2=2^10ns,...5=2^25ns.
> > */
> > - lat_ns = ((s64)rxa * 1024 -
> > - (2 * (s64)hw->adapter->max_frame_size)) * 8 * 1000;
> > + lat_ns = ((u64)rxa * 1024 -
> > + (2 * (u64)hw->adapter->max_frame_size)) * 8 * 1000;
> > if (lat_ns < 0)
> > lat_ns = 0;
>
> The above change cannot be correct.
> You should be getting another error for testing an unsigned value be less than 0.
>
> So I presume this wasn't even tested.
>
I found the same issue and I am putting together another patch to
resolve the issue that Yanjiang saw.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20150408/4b70821b/attachment.asc>
WARNING: multiple messages have this Message-ID (diff)
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "'yanjiang.jin@windriver.com'" <yanjiang.jin@windriver.com>,
"bruce.w.allan@intel.com" <bruce.w.allan@intel.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jinyanjiang@gmail.com" <jinyanjiang@gmail.com>,
intel-wired-lan <intel-wired-lan@lists.osuosl.org>
Subject: Re: [PATCH] ethernet: e1000e: define lat_ns as u64 instead of s64
Date: Wed, 08 Apr 2015 11:13:02 -0700 [thread overview]
Message-ID: <1428516782.2579.2.camel@jtkirshe-mobl> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CB166B0@AcuExch.aculab.com>
[-- Attachment #1: Type: text/plain, Size: 2752 bytes --]
On Wed, 2015-04-08 at 09:40 +0000, David Laight wrote:
> From: yanjiang.jin@windriver.com
> > Sent: 03 April 2015 10:18
> > From: Yanjiang Jin <yanjiang.jin@windriver.com>
> >
> > do_div() expects the type of "n" to be uint64_t, define "lat_ns" as u64 to
> > avoid the below warning, also update its correlative operations and data.
> >
> > In file included from ./arch/powerpc/include/asm/div64.h:1:0,
> > from include/linux/kernel.h:124,
> > from include/linux/list.h:8,
> > from include/linux/timer.h:4,
> > from drivers/net/ethernet/intel/e1000e/e1000.h:29,
> > from drivers/net/ethernet/intel/e1000e/ich8lan.c:59:
> > drivers/net/ethernet/intel/e1000e/ich8lan.c: In function 'e1000_platform_pm_pch_lpt':
> > include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled
> > by default]
> > (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
> > ^
> > drivers/net/ethernet/intel/e1000e/ich8lan.c:1016:4: note: in expansion of macro 'do_div'
> > do_div(lat_ns, speed);
> >
> > Signed-off-by: Yanjiang Jin <yanjiang.jin@windriver.com>
> > ---
> > drivers/net/ethernet/intel/e1000e/ich8lan.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
> > index 48b74a5..baab58b 100644
> > --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
> > +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
> > @@ -982,8 +982,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
> > u16 speed, duplex, scale = 0;
> > u16 max_snoop, max_nosnoop;
> > u16 max_ltr_enc; /* max LTR latency encoded */
> > - s64 lat_ns; /* latency (ns) */
> > - s64 value;
> > + u64 lat_ns; /* latency (ns) */
> > + u64 value;
> > u32 rxa;
> >
> > if (!hw->adapter->max_frame_size) {
> > @@ -1008,8 +1008,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
> > * 2^25*(2^10-1) ns. The scale is encoded as 0=2^0ns,
> > * 1=2^5ns, 2=2^10ns,...5=2^25ns.
> > */
> > - lat_ns = ((s64)rxa * 1024 -
> > - (2 * (s64)hw->adapter->max_frame_size)) * 8 * 1000;
> > + lat_ns = ((u64)rxa * 1024 -
> > + (2 * (u64)hw->adapter->max_frame_size)) * 8 * 1000;
> > if (lat_ns < 0)
> > lat_ns = 0;
>
> The above change cannot be correct.
> You should be getting another error for testing an unsigned value be less than 0.
>
> So I presume this wasn't even tested.
>
I found the same issue and I am putting together another patch to
resolve the issue that Yanjiang saw.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-04-08 18:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-03 9:17 [PATCH] ethernet: e1000e: define lat_ns as u64 instead of s64 yanjiang.jin
2015-04-03 9:42 ` Jeff Kirsher
2015-04-07 2:35 ` yjin
2015-04-08 9:40 ` David Laight
2015-04-08 18:13 ` Jeff Kirsher [this message]
2015-04-08 18:13 ` Jeff Kirsher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428516782.2579.2.camel@jtkirshe-mobl \
--to=jeffrey.t.kirsher@intel.com \
--cc=intel-wired-lan@osuosl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.