* [PATCH 02/10] mt76: move mt76x02_rx_get_sta and mt76x02_rx_get_sta_wcid in mt76x02_util.c
@ 2018-10-01 22:19 Lorenzo Bianconi
2018-10-02 5:27 ` Felix Fietkau
0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Bianconi @ 2018-10-01 22:19 UTC (permalink / raw)
To: nbd; +Cc: sgruszka, linux-wireless
Move mt76x02_rx_get_sta and mt76x02_rx_get_sta_wcid utility routines in
mt76x02-lib module since it will be used by mt76x0 driver in order to
unify rxwi parsing
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
.../net/wireless/mediatek/mt76/mt76x02_util.c | 29 +++++++++++++++++
.../net/wireless/mediatek/mt76/mt76x02_util.h | 3 ++
.../net/wireless/mediatek/mt76/mt76x2/mac.c | 32 ++-----------------
3 files changed, 34 insertions(+), 30 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
index b12db0a108d3..496be05e59a6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
@@ -531,4 +531,33 @@ void mt76x02_set_beacon_offsets(struct mt76_dev *dev)
}
EXPORT_SYMBOL_GPL(mt76x02_set_beacon_offsets);
+struct mt76x02_sta *
+mt76x02_rx_get_sta(struct mt76_dev *dev, u8 idx)
+{
+ struct mt76_wcid *wcid;
+
+ if (idx >= ARRAY_SIZE(dev->wcid))
+ return NULL;
+
+ wcid = rcu_dereference(dev->wcid[idx]);
+ if (!wcid)
+ return NULL;
+
+ return container_of(wcid, struct mt76x02_sta, wcid);
+}
+EXPORT_SYMBOL_GPL(mt76x02_rx_get_sta);
+
+struct mt76_wcid *
+mt76x02_rx_get_sta_wcid(struct mt76x02_sta *sta, bool unicast)
+{
+ if (!sta)
+ return NULL;
+
+ if (unicast)
+ return &sta->wcid;
+ else
+ return &sta->vif->group_wcid;
+}
+EXPORT_SYMBOL_GPL(mt76x02_rx_get_sta_wcid);
+
MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.h b/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
index 54cec0cbf645..5ad8f5c458c4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
@@ -53,6 +53,9 @@ void mt76x02_tx_complete(struct mt76_dev *dev, struct sk_buff *skb);
void mt76x02_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
struct mt76_queue_entry *e, bool flush);
bool mt76x02_tx_status_data(struct mt76_dev *dev, u8 *update);
+struct mt76x02_sta *mt76x02_rx_get_sta(struct mt76_dev *dev, u8 idx);
+struct mt76_wcid *
+mt76x02_rx_get_sta_wcid(struct mt76x02_sta *sta, bool unicast);
extern const u16 mt76x02_beacon_offsets[16];
void mt76x02_set_beacon_offsets(struct mt76_dev *dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2/mac.c
index c98ce1582aec..93bf8a9404b1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/mac.c
@@ -64,34 +64,6 @@ int mt76x2_mac_get_rssi(struct mt76x2_dev *dev, s8 rssi, int chain)
return rssi;
}
-static struct mt76x02_sta *
-mt76x2_rx_get_sta(struct mt76x2_dev *dev, u8 idx)
-{
- struct mt76_wcid *wcid;
-
- if (idx >= ARRAY_SIZE(dev->mt76.wcid))
- return NULL;
-
- wcid = rcu_dereference(dev->mt76.wcid[idx]);
- if (!wcid)
- return NULL;
-
- return container_of(wcid, struct mt76x02_sta, wcid);
-}
-
-static struct mt76_wcid *
-mt76x2_rx_get_sta_wcid(struct mt76x2_dev *dev, struct mt76x02_sta *sta,
- bool unicast)
-{
- if (!sta)
- return NULL;
-
- if (unicast)
- return &sta->wcid;
- else
- return &sta->vif->group_wcid;
-}
-
int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb,
void *rxi)
{
@@ -122,8 +94,8 @@ int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb,
}
wcid = FIELD_GET(MT_RXWI_CTL_WCID, ctl);
- sta = mt76x2_rx_get_sta(dev, wcid);
- status->wcid = mt76x2_rx_get_sta_wcid(dev, sta, unicast);
+ sta = mt76x02_rx_get_sta(&dev->mt76, wcid);
+ status->wcid = mt76x02_rx_get_sta_wcid(sta, unicast);
len = FIELD_GET(MT_RXWI_CTL_MPDU_LEN, ctl);
pn_len = FIELD_GET(MT_RXINFO_PN_LEN, rxinfo);
--
2.19.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 02/10] mt76: move mt76x02_rx_get_sta and mt76x02_rx_get_sta_wcid in mt76x02_util.c
2018-10-01 22:19 [PATCH 02/10] mt76: move mt76x02_rx_get_sta and mt76x02_rx_get_sta_wcid in mt76x02_util.c Lorenzo Bianconi
@ 2018-10-02 5:27 ` Felix Fietkau
2018-10-02 8:20 ` Lorenzo Bianconi
0 siblings, 1 reply; 3+ messages in thread
From: Felix Fietkau @ 2018-10-02 5:27 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: sgruszka, linux-wireless
On 2018-10-02 00:19, Lorenzo Bianconi wrote:
> Move mt76x02_rx_get_sta and mt76x02_rx_get_sta_wcid utility routines in
> mt76x02-lib module since it will be used by mt76x0 driver in order to
> unify rxwi parsing
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> ---
> .../net/wireless/mediatek/mt76/mt76x02_util.c | 29 +++++++++++++++++
> .../net/wireless/mediatek/mt76/mt76x02_util.h | 3 ++
> .../net/wireless/mediatek/mt76/mt76x2/mac.c | 32 ++-----------------
> 3 files changed, 34 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> index b12db0a108d3..496be05e59a6 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> @@ -531,4 +531,33 @@ void mt76x02_set_beacon_offsets(struct mt76_dev *dev)
> }
> EXPORT_SYMBOL_GPL(mt76x02_set_beacon_offsets);
>
> +struct mt76x02_sta *
> +mt76x02_rx_get_sta(struct mt76_dev *dev, u8 idx)
> +{
> + struct mt76_wcid *wcid;
> +
> + if (idx >= ARRAY_SIZE(dev->wcid))
> + return NULL;
> +
> + wcid = rcu_dereference(dev->wcid[idx]);
> + if (!wcid)
> + return NULL;
> +
> + return container_of(wcid, struct mt76x02_sta, wcid);
> +}
> +EXPORT_SYMBOL_GPL(mt76x02_rx_get_sta);
> +
> +struct mt76_wcid *
> +mt76x02_rx_get_sta_wcid(struct mt76x02_sta *sta, bool unicast)
> +{
> + if (!sta)
> + return NULL;
> +
> + if (unicast)
> + return &sta->wcid;
> + else
> + return &sta->vif->group_wcid;
> +}
> +EXPORT_SYMBOL_GPL(mt76x02_rx_get_sta_wcid);
Both of these functions are trivial and should be inline.
- Felix
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 02/10] mt76: move mt76x02_rx_get_sta and mt76x02_rx_get_sta_wcid in mt76x02_util.c
2018-10-02 5:27 ` Felix Fietkau
@ 2018-10-02 8:20 ` Lorenzo Bianconi
0 siblings, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2018-10-02 8:20 UTC (permalink / raw)
To: Felix Fietkau; +Cc: sgruszka, linux-wireless
> > EXPORT_SYMBOL_GPL(mt76x02_set_beacon_offsets);
> >
> > +struct mt76x02_sta *
> > +mt76x02_rx_get_sta(struct mt76_dev *dev, u8 idx)
> > +{
> > + struct mt76_wcid *wcid;
> > +
> > + if (idx >= ARRAY_SIZE(dev->wcid))
> > + return NULL;
> > +
> > + wcid = rcu_dereference(dev->wcid[idx]);
> > + if (!wcid)
> > + return NULL;
> > +
> > + return container_of(wcid, struct mt76x02_sta, wcid);
> > +}
> > +EXPORT_SYMBOL_GPL(mt76x02_rx_get_sta);
> > +
> > +struct mt76_wcid *
> > +mt76x02_rx_get_sta_wcid(struct mt76x02_sta *sta, bool unicast)
> > +{
> > + if (!sta)
> > + return NULL;
> > +
> > + if (unicast)
> > + return &sta->wcid;
> > + else
> > + return &sta->vif->group_wcid;
> > +}
> > +EXPORT_SYMBOL_GPL(mt76x02_rx_get_sta_wcid);
> Both of these functions are trivial and should be inline.
ack, will do in v2.
Regards,
Lorenzo
>
> - Felix
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-02 8:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01 22:19 [PATCH 02/10] mt76: move mt76x02_rx_get_sta and mt76x02_rx_get_sta_wcid in mt76x02_util.c Lorenzo Bianconi
2018-10-02 5:27 ` Felix Fietkau
2018-10-02 8:20 ` Lorenzo Bianconi
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.