From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: re: cxgb4/cxgb4vf: Add code to calculate T5 BAR2 Offsets for SGE Queue Registers
Date: Fri, 29 May 2015 15:02:39 +0000 [thread overview]
Message-ID: <20150529150239.GC10313@mwanda> (raw)
Hello Hariprasad Shenai,
The patch e85c9a7abfa4: "cxgb4/cxgb4vf: Add code to calculate T5 BAR2
Offsets for SGE Queue Registers" from Dec 3, 2014, leads to the
following static checker warning:
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c:5358 t4_bar2_sge_qregs()
warn: should '(qid >> qpp_shift) << page_shift' be a 64 bit type?
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
5326 int t4_bar2_sge_qregs(struct adapter *adapter,
5327 unsigned int qid,
5328 enum t4_bar2_qtype qtype,
5329 u64 *pbar2_qoffset,
5330 unsigned int *pbar2_qid)
5331 {
5332 unsigned int page_shift, page_size, qpp_shift, qpp_mask;
5333 u64 bar2_page_offset, bar2_qoffset;
5334 unsigned int bar2_qid, bar2_qid_offset, bar2_qinferred;
5335
5336 /* T4 doesn't support BAR2 SGE Queue registers.
5337 */
5338 if (is_t4(adapter->params.chip))
5339 return -EINVAL;
5340
5341 /* Get our SGE Page Size parameters.
5342 */
5343 page_shift = adapter->params.sge.hps + 10;
5344 page_size = 1 << page_shift;
5345
5346 /* Get the right Queues per Page parameters for our Queue.
5347 */
5348 qpp_shift = (qtype = T4_BAR2_QTYPE_EGRESS
5349 ? adapter->params.sge.eq_qpp
5350 : adapter->params.sge.iq_qpp);
5351 qpp_mask = (1 << qpp_shift) - 1;
5352
5353 /* Calculate the basics of the BAR2 SGE Queue register area:
5354 * o The BAR2 page the Queue registers will be in.
5355 * o The BAR2 Queue ID.
5356 * o The BAR2 Queue ID Offset into the BAR2 page.
5357 */
5358 bar2_page_offset = ((qid >> qpp_shift) << page_shift);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The static checker is complaining that it can not use the high 32 bytes
unless we add a cast. This is using custom page sizes here so I'm not
sure exactly what's going on or if declaring this as u64 was necessary.
5359 bar2_qid = qid & qpp_mask;
5360 bar2_qid_offset = bar2_qid * SGE_UDB_SIZE;
regards,
dan carpenter
reply other threads:[~2015-05-29 15:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20150529150239.GC10313@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.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.