net/llc/llc_s_ac.c
Source file repositories/reference/linux-study-clean/net/llc/llc_s_ac.c
File Facts
- System
- Linux kernel
- Corpus path
net/llc/llc_s_ac.c- Extension
.c- Size
- 5865 bytes
- Lines
- 217
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/netdevice.hnet/llc.hnet/llc_pdu.hnet/llc_s_ac.hnet/llc_s_ev.hnet/llc_sap.hnet/sock.h
Detected Declarations
function llc_sap_action_unitdata_indfunction llc_prepare_and_xmitfunction llc_sap_action_send_uifunction llc_sap_action_send_xid_cfunction llc_sap_action_send_xid_rfunction llc_sap_action_send_test_cfunction llc_sap_action_send_test_rfunction llc_sap_action_report_statusfunction llc_sap_action_xid_indfunction llc_sap_action_test_ind
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* llc_s_ac.c - actions performed during sap state transition.
*
* Description :
* Functions in this module are implementation of sap component actions.
* Details of actions can be found in IEEE-802.2 standard document.
* All functions have one sap and one event as input argument. All of
* them return 0 On success and 1 otherwise.
*
* Copyright (c) 1997 by Procom Technology, Inc.
* 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*/
#include <linux/netdevice.h>
#include <net/llc.h>
#include <net/llc_pdu.h>
#include <net/llc_s_ac.h>
#include <net/llc_s_ev.h>
#include <net/llc_sap.h>
#include <net/sock.h>
/**
* llc_sap_action_unitdata_ind - forward UI PDU to network layer
* @sap: SAP
* @skb: the event to forward
*
* Received a UI PDU from MAC layer; forward to network layer as a
* UNITDATA INDICATION; verify our event is the kind we expect
*/
int llc_sap_action_unitdata_ind(struct llc_sap *sap, struct sk_buff *skb)
{
llc_sap_rtn_pdu(sap, skb);
return 0;
}
static int llc_prepare_and_xmit(struct sk_buff *skb)
{
struct llc_sap_state_ev *ev = llc_sap_ev(skb);
struct sk_buff *nskb;
int rc;
rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac);
if (rc)
return rc;
nskb = skb_clone(skb, GFP_ATOMIC);
if (!nskb)
return -ENOMEM;
if (skb->sk)
skb_set_owner_w(nskb, skb->sk);
return dev_queue_xmit(nskb);
}
/**
* llc_sap_action_send_ui - sends UI PDU resp to UNITDATA REQ to MAC layer
* @sap: SAP
* @skb: the event to send
*
* Sends a UI PDU to the MAC layer in response to a UNITDATA REQUEST
* primitive from the network layer. Verifies event is a primitive type of
* event. Verify the primitive is a UNITDATA REQUEST.
*/
int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb)
{
struct llc_sap_state_ev *ev = llc_sap_ev(skb);
llc_pdu_header_init(skb, LLC_PDU_TYPE_U, ev->saddr.lsap,
ev->daddr.lsap, LLC_PDU_CMD);
llc_pdu_init_as_ui_cmd(skb);
return llc_prepare_and_xmit(skb);
}
/**
* llc_sap_action_send_xid_c - send XID PDU as response to XID REQ
* @sap: SAP
* @skb: the event to send
*
* Send a XID command PDU to MAC layer in response to a XID REQUEST
* primitive from the network layer. Verify event is a primitive type
* event. Verify the primitive is a XID REQUEST.
*/
int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb)
{
struct llc_sap_state_ev *ev = llc_sap_ev(skb);
llc_pdu_header_init(skb, LLC_PDU_TYPE_U_XID, ev->saddr.lsap,
Annotation
- Immediate include surface: `linux/netdevice.h`, `net/llc.h`, `net/llc_pdu.h`, `net/llc_s_ac.h`, `net/llc_s_ev.h`, `net/llc_sap.h`, `net/sock.h`.
- Detected declarations: `function llc_sap_action_unitdata_ind`, `function llc_prepare_and_xmit`, `function llc_sap_action_send_ui`, `function llc_sap_action_send_xid_c`, `function llc_sap_action_send_xid_r`, `function llc_sap_action_send_test_c`, `function llc_sap_action_send_test_r`, `function llc_sap_action_report_status`, `function llc_sap_action_xid_ind`, `function llc_sap_action_test_ind`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.