mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
net: strparser: remove unused abort_parser/lock/unlock callbacks
The lock/unlock callbacks were introduced in
2017 (bbb03029a8 ("strparser: Generalize strparser")) and haven't
been used. The abort_parser callback has existed since strp was
committed (2016) and has also never been used.
This patch replaces those indirections with the only possible direct
call.
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Link: https://patch.msgid.link/e55bcc033317dddd47a6dfda6575c755ae7175f7.1790702233.git.sd@queasysnail.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
6e08f7c73c
commit
ed0e5b924d
|
|
@ -46,9 +46,6 @@ struct strp_callbacks {
|
|||
int (*read_sock)(struct strparser *strp, read_descriptor_t *desc,
|
||||
sk_read_actor_t recv_actor);
|
||||
int (*read_sock_done)(struct strparser *strp, int err);
|
||||
void (*abort_parser)(struct strparser *strp, int err);
|
||||
void (*lock)(struct strparser *strp);
|
||||
void (*unlock)(struct strparser *strp);
|
||||
};
|
||||
|
||||
struct strp_msg {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ static void strp_parser_err(struct strparser *strp, int err,
|
|||
desc->error = err;
|
||||
kfree_skb(strp->skb_head);
|
||||
strp->skb_head = NULL;
|
||||
strp->cb.abort_parser(strp, err);
|
||||
strp_abort_strp(strp, err);
|
||||
}
|
||||
|
||||
static inline int strp_peek_len(struct strparser *strp)
|
||||
|
|
@ -409,7 +409,7 @@ static void do_strp_work(struct strparser *strp)
|
|||
/* We need the read lock to synchronize with strp_data_ready. We
|
||||
* need the socket lock for calling strp_read_sock.
|
||||
*/
|
||||
strp->cb.lock(strp);
|
||||
lock_sock(strp->sk);
|
||||
|
||||
if (unlikely(strp->stopped))
|
||||
goto out;
|
||||
|
|
@ -421,7 +421,7 @@ static void do_strp_work(struct strparser *strp)
|
|||
queue_work(strp_wq, &strp->work);
|
||||
|
||||
out:
|
||||
strp->cb.unlock(strp);
|
||||
release_sock(strp->sk);
|
||||
}
|
||||
|
||||
static void strp_work(struct work_struct *w)
|
||||
|
|
@ -436,18 +436,8 @@ static void strp_msg_timeout(struct work_struct *w)
|
|||
|
||||
/* Message assembly timed out */
|
||||
STRP_STATS_INCR(strp->stats.msg_timeouts);
|
||||
strp->cb.lock(strp);
|
||||
strp->cb.abort_parser(strp, -ETIMEDOUT);
|
||||
strp->cb.unlock(strp);
|
||||
}
|
||||
|
||||
static void strp_sock_lock(struct strparser *strp)
|
||||
{
|
||||
lock_sock(strp->sk);
|
||||
}
|
||||
|
||||
static void strp_sock_unlock(struct strparser *strp)
|
||||
{
|
||||
strp_abort_strp(strp, -ETIMEDOUT);
|
||||
release_sock(strp->sk);
|
||||
}
|
||||
|
||||
|
|
@ -455,36 +445,17 @@ int strp_init(struct strparser *strp, struct sock *sk,
|
|||
const struct strp_callbacks *cb)
|
||||
{
|
||||
|
||||
if (!cb || !cb->rcv_msg || !cb->parse_msg)
|
||||
if (!cb || !cb->rcv_msg || !cb->parse_msg || !sk)
|
||||
return -EINVAL;
|
||||
|
||||
/* The sk (sock) arg determines the mode of the stream parser.
|
||||
*
|
||||
* If the sock is set then the strparser is in receive callback mode.
|
||||
* The upper layer calls strp_data_ready to kick receive processing
|
||||
* and strparser calls the read_sock function on the socket to
|
||||
* get packets.
|
||||
*
|
||||
* If the sock is not set then the strparser is in general mode.
|
||||
* The upper layer calls strp_process for each skb to be parsed.
|
||||
*/
|
||||
|
||||
if (!sk) {
|
||||
if (!cb->lock || !cb->unlock)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
memset(strp, 0, sizeof(*strp));
|
||||
|
||||
strp->sk = sk;
|
||||
|
||||
strp->cb.lock = cb->lock ? : strp_sock_lock;
|
||||
strp->cb.unlock = cb->unlock ? : strp_sock_unlock;
|
||||
strp->cb.rcv_msg = cb->rcv_msg;
|
||||
strp->cb.parse_msg = cb->parse_msg;
|
||||
strp->cb.read_sock = cb->read_sock;
|
||||
strp->cb.read_sock_done = cb->read_sock_done ? : default_read_sock_done;
|
||||
strp->cb.abort_parser = cb->abort_parser ? : strp_abort_strp;
|
||||
|
||||
INIT_DELAYED_WORK(&strp->msg_timer_work, strp_msg_timeout);
|
||||
INIT_WORK(&strp->work, strp_work);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user