tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   5e857ce6eae7ca21b2055cca4885545e29228fe2
commit: 9c29da3f4e7ef9810bdfaf3d8aa5e6d2e33136f8 brcmfmac: Fix P2P Group 
Formation failure via Go-neg method
date:   6 weeks ago
config: riscv-randconfig-s032-20200618 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-rc1-10-gc17b1b06-dirty
        git checkout 9c29da3f4e7ef9810bdfaf3d8aa5e6d2e33136f8
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=riscv CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>


sparse warnings: (new ones prefixed by >>)

>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c:1710:40: sparse: 
>> sparse: incorrect type in initializer (different base types) @@     expected 
>> signed int [usertype] requested_dwell @@     got restricted __le32 
>> [usertype] dwell_time @@
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c:1710:40: sparse:     
>> expected signed int [usertype] requested_dwell
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c:1710:40: sparse:     
>> got restricted __le32 [usertype] dwell_time
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c:2202:5: sparse: 
sparse: symbol 'brcmf_p2p_get_conn_idx' was not declared. Should it be static?

vim +1710 drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c

  1671  
  1672  static bool brcmf_p2p_check_dwell_overflow(s32 requested_dwell,
  1673                                             unsigned long dwell_jiffies)
  1674  {
  1675          if ((requested_dwell & CUSTOM_RETRY_MASK) &&
  1676              (jiffies_to_msecs(jiffies - dwell_jiffies) >
  1677              (requested_dwell & ~CUSTOM_RETRY_MASK))) {
  1678                  brcmf_err("Action frame TX retry time over dwell 
time!\n");
  1679                  return true;
  1680          }
  1681          return false;
  1682  }
  1683  /**
  1684   * brcmf_p2p_send_action_frame() - send action frame .
  1685   *
  1686   * @cfg: driver private data for cfg80211 interface.
  1687   * @ndev: net device to transmit on.
  1688   * @af_params: configuration data for action frame.
  1689   */
  1690  bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
  1691                                   struct net_device *ndev,
  1692                                   struct brcmf_fil_af_params_le 
*af_params)
  1693  {
  1694          struct brcmf_p2p_info *p2p = &cfg->p2p;
  1695          struct brcmf_if *ifp = netdev_priv(ndev);
  1696          struct brcmf_fil_action_frame_le *action_frame;
  1697          struct brcmf_config_af_params config_af_params;
  1698          struct afx_hdl *afx_hdl = &p2p->afx_hdl;
  1699          struct brcmf_pub *drvr = cfg->pub;
  1700          u16 action_frame_len;
  1701          bool ack = false;
  1702          u8 category;
  1703          u8 action;
  1704          s32 tx_retry;
  1705          s32 extra_listen_time;
  1706          uint delta_ms;
  1707          unsigned long dwell_jiffies = 0;
  1708          bool dwell_overflow = false;
  1709  
> 1710          s32 requested_dwell = af_params->dwell_time;
  1711  
  1712          action_frame = &af_params->action_frame;
  1713          action_frame_len = le16_to_cpu(action_frame->len);
  1714  
  1715          brcmf_p2p_print_actframe(true, action_frame->data, 
action_frame_len);
  1716  
  1717          /* Add the default dwell time. Dwell time to stay off-channel */
  1718          /* to wait for a response action frame after transmitting an  */
  1719          /* GO Negotiation action frame                                */
  1720          af_params->dwell_time = cpu_to_le32(P2P_AF_DWELL_TIME);
  1721  
  1722          category = action_frame->data[DOT11_ACTION_CAT_OFF];
  1723          action = action_frame->data[DOT11_ACTION_ACT_OFF];
  1724  
  1725          /* initialize variables */
  1726          p2p->next_af_subtype = P2P_PAF_SUBTYPE_INVALID;
  1727          p2p->gon_req_action = false;
  1728  
  1729          /* config parameters */
  1730          config_af_params.mpc_onoff = -1;
  1731          config_af_params.search_channel = false;
  1732          config_af_params.extra_listen = false;
  1733  
  1734          if (brcmf_p2p_is_pub_action(action_frame->data, 
action_frame_len)) {
  1735                  /* p2p public action frame process */
  1736                  if (brcmf_p2p_pub_af_tx(cfg, af_params, 
&config_af_params)) {
  1737                          /* Just send unknown subtype frame with */
  1738                          /* default parameters.                  */
  1739                          bphy_err(drvr, "P2P Public action frame, 
unknown subtype.\n");
  1740                  }
  1741          } else if (brcmf_p2p_is_gas_action(action_frame->data,
  1742                                             action_frame_len)) {
  1743                  /* service discovery process */
  1744                  if (action == P2PSD_ACTION_ID_GAS_IREQ ||
  1745                      action == P2PSD_ACTION_ID_GAS_CREQ) {
  1746                          /* configure service discovery query frame */
  1747                          config_af_params.search_channel = true;
  1748  
  1749                          /* save next af suptype to cancel */
  1750                          /* remaining dwell time           */
  1751                          p2p->next_af_subtype = action + 1;
  1752  
  1753                          af_params->dwell_time =
  1754                                  cpu_to_le32(P2P_AF_MED_DWELL_TIME);
  1755                  } else if (action == P2PSD_ACTION_ID_GAS_IRESP ||
  1756                             action == P2PSD_ACTION_ID_GAS_CRESP) {
  1757                          /* configure service discovery response frame */
  1758                          af_params->dwell_time =
  1759                                  cpu_to_le32(P2P_AF_MIN_DWELL_TIME);
  1760                  } else {
  1761                          bphy_err(drvr, "Unknown action type: %d\n", 
action);
  1762                          goto exit;
  1763                  }
  1764          } else if (brcmf_p2p_is_p2p_action(action_frame->data,
  1765                                             action_frame_len)) {
  1766                  /* do not configure anything. it will be */
  1767                  /* sent with a default configuration     */
  1768          } else {
  1769                  bphy_err(drvr, "Unknown Frame: category 0x%x, action 
0x%x\n",
  1770                           category, action);
  1771                  return false;
  1772          }
  1773  
  1774          /* if connecting on primary iface, sleep for a while before 
sending
  1775           * af tx for VSDB
  1776           */
  1777          if (test_bit(BRCMF_VIF_STATUS_CONNECTING,
  1778                       
&p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->sme_state))
  1779                  msleep(50);
  1780  
  1781          /* if scan is ongoing, abort current scan. */
  1782          if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status))
  1783                  brcmf_abort_scanning(cfg);
  1784  
  1785          memcpy(afx_hdl->tx_dst_addr, action_frame->da, ETH_ALEN);
  1786  
  1787          /* To make sure to send successfully action frame, turn off mpc 
*/
  1788          if (config_af_params.mpc_onoff == 0)
  1789                  brcmf_set_mpc(ifp, 0);
  1790  
  1791          /* set status and destination address before sending af */
  1792          if (p2p->next_af_subtype != P2P_PAF_SUBTYPE_INVALID) {
  1793                  /* set status to cancel the remained dwell time in rx 
process */
  1794                  set_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, 
&p2p->status);
  1795          }
  1796  
  1797          p2p->af_sent_channel = 0;
  1798          set_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status);
  1799          /* validate channel and p2p ies */
  1800          if (config_af_params.search_channel &&
  1801              IS_P2P_SOCIAL_CHANNEL(le32_to_cpu(af_params->channel)) &&
  1802              
p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif->saved_ie.probe_req_ie_len) {
  1803                  afx_hdl = &p2p->afx_hdl;
  1804                  afx_hdl->peer_listen_chan = 
le32_to_cpu(af_params->channel);
  1805  
  1806                  if (brcmf_p2p_af_searching_channel(p2p) ==
  1807                                                          
P2P_INVALID_CHANNEL) {
  1808                          bphy_err(drvr, "Couldn't find peer's 
channel.\n");
  1809                          goto exit;
  1810                  }
  1811  
  1812                  /* Abort scan even for VSDB scenarios. Scan gets 
aborted in
  1813                   * firmware but after the check of piggyback algorithm. 
To take
  1814                   * care of current piggback algo, lets abort the scan 
here
  1815                   * itself.
  1816                   */
  1817                  brcmf_notify_escan_complete(cfg, ifp, true, true);
  1818  
  1819                  /* update channel */
  1820                  af_params->channel = cpu_to_le32(afx_hdl->peer_chan);
  1821          }
  1822          dwell_jiffies = jiffies;
  1823          dwell_overflow = brcmf_p2p_check_dwell_overflow(requested_dwell,
  1824                                                          dwell_jiffies);
  1825  
  1826          tx_retry = 0;
  1827          while (!p2p->block_gon_req_tx &&
  1828                 (!ack) && (tx_retry < P2P_AF_TX_MAX_RETRY) &&
  1829                  !dwell_overflow) {
  1830                  ack = !brcmf_p2p_tx_action_frame(p2p, af_params);
  1831                  tx_retry++;
  1832                  dwell_overflow = 
brcmf_p2p_check_dwell_overflow(requested_dwell,
  1833                                                                  
dwell_jiffies);
  1834          }
  1835          if (ack == false) {
  1836                  bphy_err(drvr, "Failed to send Action Frame(retry 
%d)\n",
  1837                           tx_retry);
  1838                  clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status);
  1839          }
  1840  
  1841  exit:
  1842          clear_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status);
  1843  
  1844          /* WAR: sometimes dongle does not keep the dwell time of 
'actframe'.
  1845           * if we coundn't get the next action response frame and dongle 
does
  1846           * not keep the dwell time, go to listen state again to get 
next action
  1847           * response frame.
  1848           */
  1849          if (ack && config_af_params.extra_listen && 
!p2p->block_gon_req_tx &&
  1850              test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, 
&p2p->status) &&
  1851              p2p->af_sent_channel == afx_hdl->my_listen_chan) {
  1852                  delta_ms = jiffies_to_msecs(jiffies - 
p2p->af_tx_sent_jiffies);
  1853                  if (le32_to_cpu(af_params->dwell_time) > delta_ms)
  1854                          extra_listen_time = 
le32_to_cpu(af_params->dwell_time) -
  1855                                              delta_ms;
  1856                  else
  1857                          extra_listen_time = 0;
  1858                  if (extra_listen_time > 50) {
  1859                          set_bit(BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN,
  1860                                  &p2p->status);
  1861                          brcmf_dbg(INFO, "Wait more time! actual af 
time:%d, calculated extra listen:%d\n",
  1862                                    le32_to_cpu(af_params->dwell_time),
  1863                                    extra_listen_time);
  1864                          extra_listen_time += 100;
  1865                          if (!brcmf_p2p_discover_listen(p2p,
  1866                                                         
p2p->af_sent_channel,
  1867                                                         
extra_listen_time)) {
  1868                                  unsigned long duration;
  1869  
  1870                                  extra_listen_time += 100;
  1871                                  duration = 
msecs_to_jiffies(extra_listen_time);
  1872                                  
wait_for_completion_timeout(&p2p->wait_next_af,
  1873                                                              duration);
  1874                          }
  1875                          
clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN,
  1876                                    &p2p->status);
  1877                  }
  1878          }
  1879  
  1880          if (p2p->block_gon_req_tx) {
  1881                  /* if ack is true, supplicant will wait more 
time(100ms).
  1882                   * so we will return it as a success to get more time .
  1883                   */
  1884                  p2p->block_gon_req_tx = false;
  1885                  ack = true;
  1886          }
  1887  
  1888          clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, 
&p2p->status);
  1889          /* if all done, turn mpc on again */
  1890          if (config_af_params.mpc_onoff == 1)
  1891                  brcmf_set_mpc(ifp, 1);
  1892  
  1893          return ack;
  1894  }
  1895  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to