~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/llc/llc_output.c

Version: ~ [ linux-6.3-rc3 ] ~ [ linux-6.2.7 ] ~ [ linux-6.1.20 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.103 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.175 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.237 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.278 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.310 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * llc_output.c - LLC minimal output path
  4  *
  5  * Copyright (c) 1997 by Procom Technology, Inc.
  6  *               2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  7  */
  8 
  9 #include <linux/if_arp.h>
 10 #include <linux/netdevice.h>
 11 #include <linux/skbuff.h>
 12 #include <linux/export.h>
 13 #include <net/llc.h>
 14 #include <net/llc_pdu.h>
 15 
 16 /**
 17  *      llc_mac_hdr_init - fills MAC header fields
 18  *      @skb: Address of the frame to initialize its MAC header
 19  *      @sa: The MAC source address
 20  *      @da: The MAC destination address
 21  *
 22  *      Fills MAC header fields, depending on MAC type. Returns 0, If MAC type
 23  *      is a valid type and initialization completes correctly 1, otherwise.
 24  */
 25 int llc_mac_hdr_init(struct sk_buff *skb,
 26                      const unsigned char *sa, const unsigned char *da)
 27 {
 28         int rc = -EINVAL;
 29 
 30         switch (skb->dev->type) {
 31         case ARPHRD_ETHER:
 32         case ARPHRD_LOOPBACK:
 33                 rc = dev_hard_header(skb, skb->dev, ETH_P_802_2, da, sa,
 34                                      skb->len);
 35                 if (rc > 0)
 36                         rc = 0;
 37                 break;
 38         default:
 39                 break;
 40         }
 41         return rc;
 42 }
 43 
 44 /**
 45  *      llc_build_and_send_ui_pkt - unitdata request interface for upper layers
 46  *      @sap: sap to use
 47  *      @skb: packet to send
 48  *      @dmac: destination mac address
 49  *      @dsap: destination sap
 50  *
 51  *      Upper layers calls this function when upper layer wants to send data
 52  *      using connection-less mode communication (UI pdu).
 53  *
 54  *      Accept data frame from network layer to be sent using connection-
 55  *      less mode communication; timeout/retries handled by network layer;
 56  *      package primitive as an event and send to SAP event handler
 57  */
 58 int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
 59                               unsigned char *dmac, unsigned char dsap)
 60 {
 61         int rc;
 62         llc_pdu_header_init(skb, LLC_PDU_TYPE_U, sap->laddr.lsap,
 63                             dsap, LLC_PDU_CMD);
 64         llc_pdu_init_as_ui_cmd(skb);
 65         rc = llc_mac_hdr_init(skb, skb->dev->dev_addr, dmac);
 66         if (likely(!rc))
 67                 rc = dev_queue_xmit(skb);
 68         else
 69                 kfree_skb(skb);
 70         return rc;
 71 }
 72 
 73 EXPORT_SYMBOL(llc_mac_hdr_init);
 74 EXPORT_SYMBOL(llc_build_and_send_ui_pkt);
 75 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp