Search Linux Wireless

Re: [RFC v2 04/12] rtw88: trx files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 05, 2018 at 09:20:01AM +0000, Tony Chuang wrote:
> > > +	rcu_read_lock();
> > > +
> > > +	bssid = get_hdr_bssid(hdr);
> > > +	rtwvif = get_hdr_vif(rtwdev, hdr);
> > > +	vif = rtwvif ? rtwvif->vif : NULL;
> > > +	pkt_stat->vif = vif;
> > > +	if (unlikely(is_broadcast_ether_addr(hdr->addr1) ||
> > > +		     is_multicast_ether_addr(hdr->addr1)))
> > > +		match_bssid = get_hdr_match_bssid(rtwdev, hdr, bssid);
> > > +	else if (vif)
> > > +		match_bssid = ether_addr_equal(vif->bss_conf.bssid, bssid);
> > > +	si = get_hdr_sta(rtwdev, vif, hdr);
> > > +	macid = si ? si->mac_id : RTW_BC_MC_MACID;
> > > +	pkt_stat->mac_id = macid;
> > > +	pkt_stat->si = si;
> > > +
> > > +	if_addr_match = !!vif;
> > > +	hw_err = pkt_stat->crc_err || pkt_stat->icv_err;
> > > +	ctl = ieee80211_is_ctl(fc);
> > > +	is_packet_match_bssid = !hw_err && !ctl && match_bssid;
> > > +
> > > +	if (((match_bssid && if_addr_match) || ieee80211_is_beacon(fc)) &&
> > > +	    (!hw_err && !ctl) && (pkt_stat->phy_status && pkt_stat->si))
> > > +		ewma_rssi_add(&pkt_stat->si->avg_rssi, pkt_stat->rssi);
> > > +
> > > +	rcu_read_unlock();
> > 
> > What for rcu_read_lock/unlock is here ? Maybe is needed,
> > but perhaps not to protect entire function ?
> > 
> 
> I thought that the entire function uses pointer si and vif, and hence should be
> protected by rcu read lock, am I using the lock in a wrong way?

It's fine, it wasn't clear to me what need to be protected.

Thanks
Stanislaw



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux