From: Gerhard Engleder <gerhard@engleder-embedded.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, edumazet@google.com,
pabeni@redhat.com,
Gerhard Engleder <gerhard@engleder-embedded.com>
Subject: [PATCH net-next v3 1/9] tsnep: Use spin_lock_bh for TX
Date: Wed, 4 Jan 2023 20:41:24 +0100 [thread overview]
Message-ID: <20230104194132.24637-2-gerhard@engleder-embedded.com> (raw)
In-Reply-To: <20230104194132.24637-1-gerhard@engleder-embedded.com>
TX processing is done only within process or BH context. Therefore,
_irqsafe variant is not necessary.
Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
---
drivers/net/ethernet/engleder/tsnep_main.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
index bf0190e1d2ea..7cc5e2407809 100644
--- a/drivers/net/ethernet/engleder/tsnep_main.c
+++ b/drivers/net/ethernet/engleder/tsnep_main.c
@@ -434,7 +434,6 @@ static int tsnep_tx_unmap(struct tsnep_tx *tx, int index, int count)
static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb,
struct tsnep_tx *tx)
{
- unsigned long flags;
int count = 1;
struct tsnep_tx_entry *entry;
int length;
@@ -444,7 +443,7 @@ static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb,
if (skb_shinfo(skb)->nr_frags > 0)
count += skb_shinfo(skb)->nr_frags;
- spin_lock_irqsave(&tx->lock, flags);
+ spin_lock_bh(&tx->lock);
if (tsnep_tx_desc_available(tx) < count) {
/* ring full, shall not happen because queue is stopped if full
@@ -452,7 +451,7 @@ static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb,
*/
netif_stop_queue(tx->adapter->netdev);
- spin_unlock_irqrestore(&tx->lock, flags);
+ spin_unlock_bh(&tx->lock);
return NETDEV_TX_BUSY;
}
@@ -468,7 +467,7 @@ static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb,
tx->dropped++;
- spin_unlock_irqrestore(&tx->lock, flags);
+ spin_unlock_bh(&tx->lock);
netdev_err(tx->adapter->netdev, "TX DMA map failed\n");
@@ -496,20 +495,19 @@ static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb,
netif_stop_queue(tx->adapter->netdev);
}
- spin_unlock_irqrestore(&tx->lock, flags);
+ spin_unlock_bh(&tx->lock);
return NETDEV_TX_OK;
}
static bool tsnep_tx_poll(struct tsnep_tx *tx, int napi_budget)
{
- unsigned long flags;
int budget = 128;
struct tsnep_tx_entry *entry;
int count;
int length;
- spin_lock_irqsave(&tx->lock, flags);
+ spin_lock_bh(&tx->lock);
do {
if (tx->read == tx->write)
@@ -568,18 +566,17 @@ static bool tsnep_tx_poll(struct tsnep_tx *tx, int napi_budget)
netif_wake_queue(tx->adapter->netdev);
}
- spin_unlock_irqrestore(&tx->lock, flags);
+ spin_unlock_bh(&tx->lock);
return (budget != 0);
}
static bool tsnep_tx_pending(struct tsnep_tx *tx)
{
- unsigned long flags;
struct tsnep_tx_entry *entry;
bool pending = false;
- spin_lock_irqsave(&tx->lock, flags);
+ spin_lock_bh(&tx->lock);
if (tx->read != tx->write) {
entry = &tx->entry[tx->read];
@@ -589,7 +586,7 @@ static bool tsnep_tx_pending(struct tsnep_tx *tx)
pending = true;
}
- spin_unlock_irqrestore(&tx->lock, flags);
+ spin_unlock_bh(&tx->lock);
return pending;
}
--
2.30.2
next prev parent reply other threads:[~2023-01-04 19:41 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-04 19:41 [PATCH net-next v3 0/9] tsnep: XDP support Gerhard Engleder
2023-01-04 19:41 ` Gerhard Engleder [this message]
2023-01-05 12:40 ` [PATCH net-next v3 1/9] tsnep: Use spin_lock_bh for TX Alexander Lobakin
2023-01-05 19:48 ` Gerhard Engleder
2023-01-04 19:41 ` [PATCH net-next v3 2/9] tsnep: Do not print DMA mapping error Gerhard Engleder
2023-01-04 19:41 ` [PATCH net-next v3 3/9] tsnep: Add adapter down state Gerhard Engleder
2023-01-05 12:44 ` Alexander Lobakin
2023-01-05 19:54 ` Gerhard Engleder
2023-01-04 19:41 ` [PATCH net-next v3 4/9] tsnep: Add XDP TX support Gerhard Engleder
2023-01-05 13:01 ` Alexander Lobakin
2023-01-05 21:13 ` Gerhard Engleder
2023-01-06 22:13 ` Jakub Kicinski
2023-01-06 23:34 ` Gerhard Engleder
2023-01-04 19:41 ` [PATCH net-next v3 5/9] tsnep: Substract TSNEP_RX_INLINE_METADATA_SIZE once Gerhard Engleder
2023-01-04 19:41 ` [PATCH net-next v3 6/9] tsnep: Support XDP BPF program setup Gerhard Engleder
2023-01-05 17:24 ` Alexander Lobakin
2023-01-05 22:09 ` Gerhard Engleder
2023-01-04 19:41 ` [PATCH net-next v3 7/9] tsnep: Prepare RX buffer for XDP support Gerhard Engleder
2023-01-04 19:41 ` [PATCH net-next v3 8/9] tsnep: Add RX queue info " Gerhard Engleder
2023-01-05 17:35 ` Alexander Lobakin
2023-01-05 22:28 ` Gerhard Engleder
2023-01-04 19:41 ` [PATCH net-next v3 9/9] tsnep: Add XDP RX support Gerhard Engleder
2023-01-05 17:52 ` Alexander Lobakin
2023-01-05 23:22 ` Gerhard Engleder
2023-01-07 8:46 ` Dan Carpenter
2023-01-07 20:12 ` Gerhard Engleder
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=20230104194132.24637-2-gerhard@engleder-embedded.com \
--to=gerhard@engleder-embedded.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).