mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-10-26 10:57:38 +08:00
Nothing in tree registers the type 1 / type 2 packet handlers or the station handler any more, and nothing looks at the socket hashes hanging off struct llc_sap. The two SAPs opened in tree - SNAP, and STP for the bridge's BPDUs and GARP's PDUs - receive through the per-SAP rcv_func(), so llc_rcv() boils down to a SAP lookup and a call. llc_sap_list becomes static and five exports go away with all this; the llc2 module out of tree has been reworked to open its own SAPs. Frames with a NULL DSAP used to be handed to the station handler before the SAP lookup. They take the normal path now, meaning they get dropped unless something registers SAP 0. struct llc_sap is down to 48 bytes on 64-bit from over a kilobyte, which also moves its GFP_ATOMIC allocation from kmalloc-2k to kmalloc-64. The two 64-entry socket hashes are the bulk of it, and the address it carried is now just the SAP number - nothing has read the MAC half since the socket layer left. llc_pdu.h keeps only what its remaining users need, plus LLC_PDU_RSP to document the one argument which can take it. That takes out the type 2 (I and S format, FRMR) definitions, the XID and TEST builders with their constants - the kernel neither sends nor answers either any more - the SAP address defines, the field accessors, and the prototypes of the llc_pdu.c helpers which went out of tree with the rest of LLC2. With the I and S formats gone llc_pdu_header_init() has one PDU type left, so drop the argument. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20260928190800.2521749-3-kuba@kernel.org Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
66 lines
1.6 KiB
C
66 lines
1.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef LLC_H
|
|
#define LLC_H
|
|
/*
|
|
* Copyright (c) 1997 by Procom Technology, Inc.
|
|
* 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
|
|
*/
|
|
|
|
#include <linux/list.h>
|
|
#include <linux/refcount.h>
|
|
|
|
struct net_device;
|
|
struct packet_type;
|
|
struct sk_buff;
|
|
|
|
/**
|
|
* struct llc_sap - Defines the SAP component
|
|
*
|
|
* @refcnt: reference count
|
|
* @lsap: SAP number
|
|
* @rcv_func: handler for the PDUs addressed to this SAP
|
|
* @node: entry in the SAP list
|
|
* @rcu: for deferred freeing
|
|
*/
|
|
struct llc_sap {
|
|
refcount_t refcnt;
|
|
unsigned char lsap;
|
|
int (*rcv_func)(struct sk_buff *skb,
|
|
struct net_device *dev,
|
|
struct packet_type *pt,
|
|
struct net_device *orig_dev);
|
|
struct list_head node;
|
|
struct rcu_head rcu;
|
|
};
|
|
|
|
int llc_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
|
|
struct net_device *orig_dev);
|
|
|
|
int llc_mac_hdr_init(struct sk_buff *skb, const unsigned char *sa,
|
|
const unsigned char *da);
|
|
|
|
struct llc_sap *llc_sap_open(unsigned char lsap,
|
|
int (*rcv)(struct sk_buff *skb,
|
|
struct net_device *dev,
|
|
struct packet_type *pt,
|
|
struct net_device *orig_dev));
|
|
|
|
static inline bool llc_sap_hold_safe(struct llc_sap *sap)
|
|
{
|
|
return refcount_inc_not_zero(&sap->refcnt);
|
|
}
|
|
|
|
void llc_sap_close(struct llc_sap *sap);
|
|
|
|
static inline void llc_sap_put(struct llc_sap *sap)
|
|
{
|
|
if (refcount_dec_and_test(&sap->refcnt))
|
|
llc_sap_close(sap);
|
|
}
|
|
|
|
struct llc_sap *llc_sap_find(unsigned char sap_value);
|
|
|
|
int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
|
|
const unsigned char *dmac, unsigned char dsap);
|
|
#endif /* LLC_H */
|