All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: akolli@codeaurora.org
Cc: ath10k@lists.infradead.org
Subject: [bug report] ath10k: get the legacy rate index to update the txrate table
Date: Wed, 10 Oct 2018 14:05:01 +0300	[thread overview]
Message-ID: <20181010110501.GA21235@mwanda> (raw)

Hello Anilkumar Kolli,

The patch 0189dbd71cbd: "ath10k: get the legacy rate index to update
the txrate table" from Sep 4, 2018, leads to the following static
checker warning:

	drivers/net/wireless/ath/ath10k/htt_rx.c:2788 ath10k_update_per_peer_tx_stats()
	warn: impossible condition '(rate_idx < 0) => (0-255 < 0)'

drivers/net/wireless/ath/ath10k/htt_rx.c
  2750  static void
  2751  ath10k_update_per_peer_tx_stats(struct ath10k *ar,
  2752                                  struct ieee80211_sta *sta,
  2753                                  struct ath10k_per_peer_tx_stats *peer_stats)
  2754  {
  2755          struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
  2756          u8 rate = 0, rate_idx = 0, sgi;
                ^^           ^^^^^^^^

  2757          struct rate_info txrate;
  2758  
  2759          lockdep_assert_held(&ar->data_lock);
  2760  
  2761          txrate.flags = ATH10K_HW_PREAMBLE(peer_stats->ratecode);
  2762          txrate.bw = ATH10K_HW_BW(peer_stats->flags);
  2763          txrate.nss = ATH10K_HW_NSS(peer_stats->ratecode);
  2764          txrate.mcs = ATH10K_HW_MCS_RATE(peer_stats->ratecode);
  2765          sgi = ATH10K_HW_GI(peer_stats->flags);
  2766  
  2767          if (txrate.flags == WMI_RATE_PREAMBLE_VHT && txrate.mcs > 9) {
  2768                  ath10k_warn(ar, "Invalid VHT mcs %hhd peer stats",  txrate.mcs);
  2769                  return;
  2770          }
  2771  
  2772          if (txrate.flags == WMI_RATE_PREAMBLE_HT &&
  2773              (txrate.mcs > 7 || txrate.nss < 1)) {
  2774                  ath10k_warn(ar, "Invalid HT mcs %hhd nss %hhd peer stats",
  2775                              txrate.mcs, txrate.nss);
  2776                  return;
  2777          }
  2778  
  2779          memset(&arsta->txrate, 0, sizeof(arsta->txrate));
  2780  
  2781          if (txrate.flags == WMI_RATE_PREAMBLE_CCK ||
  2782              txrate.flags == WMI_RATE_PREAMBLE_OFDM) {
  2783                  rate = ATH10K_HW_LEGACY_RATE(peer_stats->ratecode);
  2784                  /* This is hacky, FW sends CCK rate 5.5Mbps as 6 */
  2785                  if (rate == 6 && txrate.flags == WMI_RATE_PREAMBLE_CCK)
  2786                          rate = 5;
  2787                  rate_idx = ath10k_get_legacy_rate_idx(ar, rate);
  2788                  if (rate_idx < 0)
                            ^^^^^^^^^^^^
Impossible

  2789                          return;
  2790                  arsta->txrate.legacy = rate;
  2791          } else if (txrate.flags == WMI_RATE_PREAMBLE_HT) {
  2792                  arsta->txrate.flags = RATE_INFO_FLAGS_MCS;
  2793                  arsta->txrate.mcs = txrate.mcs + 8 * (txrate.nss - 1);

regards,
dan carpenter

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

                 reply	other threads:[~2018-10-10 11:05 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=20181010110501.GA21235@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=akolli@codeaurora.org \
    --cc=ath10k@lists.infradead.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.