cregit-Linux how code gets into the kernel

Release 4.11 net/irda/irlap_frame.c

Directory: net/irda
/*********************************************************************
 *
 * Filename:      irlap_frame.c
 * Version:       1.0
 * Description:   Build and transmit IrLAP frames
 * Status:        Stable
 * Author:        Dag Brattli <dagb@cs.uit.no>
 * Created at:    Tue Aug 19 10:27:26 1997
 * Modified at:   Wed Jan  5 08:59:04 2000
 * Modified by:   Dag Brattli <dagb@cs.uit.no>
 *
 *     Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>,
 *     All Rights Reserved.
 *     Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
 *
 *     This program is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of
 *     the License, or (at your option) any later version.
 *
 *     Neither Dag Brattli nor University of Tromsø admit liability nor
 *     provide warranty for any of this software. This material is
 *     provided "AS-IS" and at no charge.
 *
 ********************************************************************/

#include <linux/skbuff.h>
#include <linux/if.h>
#include <linux/if_ether.h>
#include <linux/netdevice.h>
#include <linux/irda.h>
#include <linux/slab.h>

#include <net/pkt_sched.h>
#include <net/sock.h>

#include <asm/byteorder.h>

#include <net/irda/irda.h>
#include <net/irda/irda_device.h>
#include <net/irda/irlap.h>
#include <net/irda/wrapper.h>
#include <net/irda/timer.h>
#include <net/irda/irlap_frame.h>
#include <net/irda/qos.h>

static void irlap_send_i_frame(struct irlap_cb *self, struct sk_buff *skb,
			       int command);

/*
 * Function irlap_insert_info (self, skb)
 *
 *    Insert minimum turnaround time and speed information into the skb. We
 *    need to do this since it's per packet relevant information. Safe to
 *    have this function inlined since it's only called from one place
 */

static inline void irlap_insert_info(struct irlap_cb *self, struct sk_buff *skb) { struct irda_skb_cb *cb = (struct irda_skb_cb *) skb->cb; /* * Insert MTT (min. turn time) and speed into skb, so that the * device driver knows which settings to use */ cb->magic = LAP_MAGIC; cb->mtt = self->mtt_required; cb->next_speed = self->speed; /* Reset */ self->mtt_required = 0; /* * Delay equals negotiated BOFs count, plus the number of BOFs to * force the negotiated minimum turnaround time */ cb->xbofs = self->bofs_count; cb->next_xbofs = self->next_bofs; cb->xbofs_delay = self->xbofs_delay; /* Reset XBOF's delay (used only for getting min turn time) */ self->xbofs_delay = 0; /* Put the correct xbofs value for the next packet */ self->bofs_count = self->next_bofs; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)8280.39%777.78%
Linus Torvalds1817.65%111.11%
Martin Dalecki21.96%111.11%
Total102100.00%9100.00%

/* * Function irlap_queue_xmit (self, skb) * * A little wrapper for dev_queue_xmit, so we can insert some common * code into it. */
void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb) { /* Some common init stuff */ skb->dev = self->netdev; skb_reset_mac_header(skb); skb_reset_network_header(skb); skb_reset_transport_header(skb); skb->protocol = htons(ETH_P_IRDA); skb->priority = TC_PRIO_BESTEFFORT; irlap_insert_info(self, skb); if (unlikely(self->mode & IRDA_MODE_MONITOR)) { pr_debug("%s(): %s is in monitor mode\n", __func__, self->netdev->name); dev_kfree_skb(skb); return; } dev_queue_xmit(skb); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)5455.10%333.33%
Samuel Ortiz3030.61%111.11%
Arnaldo Carvalho de Melo1212.24%333.33%
Harvey Harrison11.02%111.11%
Joe Perches11.02%111.11%
Total98100.00%9100.00%

/* * Function irlap_send_snrm_cmd (void) * * Transmits a connect SNRM command frame */
void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos) { struct sk_buff *tx_skb; struct snrm_frame *frame; int ret; IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LAP_MAGIC, return;); /* Allocate frame */ tx_skb = alloc_skb(sizeof(struct snrm_frame) + IRLAP_NEGOCIATION_PARAMS_LEN, GFP_ATOMIC); if (!tx_skb) return; frame = (struct snrm_frame *) skb_put(tx_skb, 2); /* Insert connection address field */ if (qos) frame->caddr = CMD_FRAME | CBROADCAST; else frame->caddr = CMD_FRAME | self->caddr; /* Insert control field */ frame->control = SNRM_CMD | PF_BIT; /* * If we are establishing a connection then insert QoS parameters */ if (qos) { skb_put(tx_skb, 9); /* 25 left */ frame->saddr = cpu_to_le32(self->saddr); frame->daddr = cpu_to_le32(self->daddr); frame->ncaddr = self->caddr; ret = irlap_insert_qos_negotiation_params(self, tx_skb); if (ret < 0) { dev_kfree_skb(tx_skb); return; } } irlap_queue_xmit(self, tx_skb); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)16488.17%550.00%
Samuel Ortiz115.91%220.00%
Jean Tourrilhes105.38%220.00%
Joe Perches10.54%110.00%
Total186100.00%10100.00%

/* * Function irlap_recv_snrm_cmd (skb, info) * * Received SNRM (Set Normal Response Mode) command frame * */
static void irlap_recv_snrm_cmd(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info) { struct snrm_frame *frame; if (pskb_may_pull(skb,sizeof(struct snrm_frame))) { frame = (struct snrm_frame *) skb->data; /* Copy the new connection address ignoring the C/R bit */ info->caddr = frame->ncaddr & 0xFE; /* Check if the new connection address is valid */ if ((info->caddr == 0x00) || (info->caddr == 0xfe)) { pr_debug("%s(), invalid connection address!\n", __func__); return; } /* Copy peer device address */ info->daddr = le32_to_cpu(frame->saddr); info->saddr = le32_to_cpu(frame->daddr); /* Only accept if addressed directly to us */ if (info->saddr != self->saddr) { pr_debug("%s(), not addressed to us!\n", __func__); return; } irlap_do_event(self, RECV_SNRM_CMD, skb, info); } else { /* Signal that this SNRM frame does not contain and I-field */ irlap_do_event(self, RECV_SNRM_CMD, skb, NULL); } }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)13784.57%444.44%
Stephen Hemminger148.64%111.11%
Jean Tourrilhes74.32%222.22%
Joe Perches21.23%111.11%
Harvey Harrison21.23%111.11%
Total162100.00%9100.00%

/* * Function irlap_send_ua_response_frame (qos) * * Send UA (Unnumbered Acknowledgement) frame * */
void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos) { struct sk_buff *tx_skb; struct ua_frame *frame; int ret; pr_debug("%s() <%ld>\n", __func__, jiffies); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LAP_MAGIC, return;); /* Allocate frame */ tx_skb = alloc_skb(sizeof(struct ua_frame) + IRLAP_NEGOCIATION_PARAMS_LEN, GFP_ATOMIC); if (!tx_skb) return; frame = (struct ua_frame *) skb_put(tx_skb, 10); /* Build UA response */ frame->caddr = self->caddr; frame->control = UA_RSP | PF_BIT; frame->saddr = cpu_to_le32(self->saddr); frame->daddr = cpu_to_le32(self->daddr); /* Should we send QoS negotiation parameters? */ if (qos) { ret = irlap_insert_qos_negotiation_params(self, tx_skb); if (ret < 0) { dev_kfree_skb(tx_skb); return; } } irlap_queue_xmit(self, tx_skb); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)14085.89%541.67%
Jean Tourrilhes116.75%325.00%
Samuel Ortiz106.13%216.67%
Harvey Harrison10.61%18.33%
Joe Perches10.61%18.33%
Total163100.00%12100.00%

/* * Function irlap_send_dm_frame (void) * * Send disconnected mode (DM) frame * */
void irlap_send_dm_frame( struct irlap_cb *self) { struct sk_buff *tx_skb = NULL; struct dm_frame *frame; IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LAP_MAGIC, return;); tx_skb = alloc_skb(sizeof(struct dm_frame), GFP_ATOMIC); if (!tx_skb) return; frame = (struct dm_frame *)skb_put(tx_skb, 2); if (self->state == LAP_NDM) frame->caddr = CBROADCAST; else frame->caddr = self->caddr; frame->control = DM_RSP | PF_BIT; irlap_queue_xmit(self, tx_skb); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)7973.83%342.86%
Samuel Ortiz2119.63%228.57%
Jean Tourrilhes76.54%228.57%
Total107100.00%7100.00%

/* * Function irlap_send_disc_frame (void) * * Send disconnect (DISC) frame * */
void irlap_send_disc_frame(struct irlap_cb *self) { struct sk_buff *tx_skb = NULL; struct disc_frame *frame; IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LAP_MAGIC, return;); tx_skb = alloc_skb(sizeof(struct disc_frame), GFP_ATOMIC); if (!tx_skb) return; frame = (struct disc_frame *)skb_put(tx_skb, 2); frame->caddr = self->caddr | CMD_FRAME; frame->control = DISC_CMD | PF_BIT; irlap_queue_xmit(self, tx_skb); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)6872.34%342.86%
Samuel Ortiz1920.21%228.57%
Jean Tourrilhes77.45%228.57%
Total94100.00%7100.00%

/* * Function irlap_send_discovery_xid_frame (S, s, command) * * Build and transmit a XID (eXchange station IDentifier) discovery * frame. */
void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s, __u8 command, discovery_t *discovery) { struct sk_buff *tx_skb = NULL; struct xid_frame *frame; __u32 bcast = BROADCAST; __u8 *info; pr_debug("%s(), s=%d, S=%d, command=%d\n", __func__, s, S, command); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LAP_MAGIC, return;); IRDA_ASSERT(discovery != NULL, return;); tx_skb = alloc_skb(sizeof(struct xid_frame) + IRLAP_DISCOVERY_INFO_LEN, GFP_ATOMIC); if (!tx_skb) return; skb_put(tx_skb, 14); frame = (struct xid_frame *) tx_skb->data; if (command) { frame->caddr = CBROADCAST | CMD_FRAME; frame->control = XID_CMD | PF_BIT; } else { frame->caddr = CBROADCAST; frame->control = XID_RSP | PF_BIT; } frame->ident = XID_FORMAT; frame->saddr = cpu_to_le32(self->saddr); if (command) frame->daddr = cpu_to_le32(bcast); else frame->daddr = cpu_to_le32(discovery->data.daddr); switch (S) { case 1: frame->flags = 0x00; break; case 6: frame->flags = 0x01; break; case 8: frame->flags = 0x02; break; case 16: frame->flags = 0x03; break; default: frame->flags = 0x02; break; } frame->slotnr = s; frame->version = 0x00; /* * Provide info for final slot only in commands, and for all * responses. Send the second byte of the hint only if the * EXTENSION bit is set in the first byte. */ if (!command || (frame->slotnr == 0xff)) { int len; if (discovery->data.hints[0] & HINT_EXTENSION) { info = skb_put(tx_skb, 2); info[0] = discovery->data.hints[0]; info[1] = discovery->data.hints[1]; } else { info = skb_put(tx_skb, 1); info[0] = discovery->data.hints[0]; } info = skb_put(tx_skb, 1); info[0] = discovery->data.charset; len = IRDA_MIN(discovery->name_len, skb_tailroom(tx_skb)); info = skb_put(tx_skb, len); memcpy(info, discovery->data.info, len); } irlap_queue_xmit(self, tx_skb); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)38289.67%535.71%
Jean Tourrilhes317.28%428.57%
Samuel Ortiz102.35%214.29%
Martin Dalecki10.23%17.14%
Harvey Harrison10.23%17.14%
Joe Perches10.23%17.14%
Total426100.00%14100.00%

/* * Function irlap_recv_discovery_xid_rsp (skb, info) * * Received a XID discovery response * */
static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info) { struct xid_frame *xid; discovery_t *discovery = NULL; __u8 *discovery_info; char *text; IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == LAP_MAGIC, return;); if (!pskb_may_pull(skb, sizeof(struct xid_frame))) { net_err_ratelimited("%s: frame too short!\n", __func__); return; } xid = (struct xid_frame *) skb->data; info->daddr = le32_to_cpu(xid->saddr); info->saddr = le32_to_cpu(xid->daddr); /* Make sure frame is addressed to us */ if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) { pr_debug("%s(), frame is not addressed to us!\n", __func__); return; } if ((discovery = kzalloc(sizeof(discovery_t), GFP_ATOMIC)) == NULL) { net_warn_ratelimited("%s: kmalloc failed!\n", __func__); return; } discovery->data.daddr = info->daddr; discovery->data.saddr = self->saddr; discovery->timestamp = jiffies; pr_debug("%s(), daddr=%08x\n", __func__, discovery->data.daddr); discovery_info = skb_pull(skb, sizeof(struct xid_frame)); /* Get info returned from peer */ discovery->data.hints[0] = discovery_info[0]; if (discovery_info[0] & HINT_EXTENSION) { pr_debug("EXTENSION\n"); discovery->data.hints[1] = discovery_info[1]; discovery->data.charset = discovery_info[2]; text = (char *) &discovery_info[3]; } else { discovery->data.hints[1] = 0; discovery->data.charset = discovery_info[1]; text = (char *) &discovery_info[2]; } /* * Terminate info string, should be safe since this is where the * FCS bytes resides. */ skb->data[skb->len] = '\0'; strncpy(discovery->data.info, text, NICKNAME_MAX_LEN); discovery->name_len = strlen(discovery->data.info); info->discovery = discovery; irlap_do_event(self, RECV_DISCOVERY_XID_RSP, skb, info); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)31983.51%428.57%
Jean Tourrilhes287.33%321.43%
Stephen Hemminger215.50%17.14%
Joe Perches51.31%214.29%
Harvey Harrison41.05%17.14%
Martin Dalecki30.79%17.14%
Panagiotis Issaris10.26%17.14%
Guennadi Liakhovetski10.26%17.14%
Total382100.00%14100.00%

/* * Function irlap_recv_discovery_xid_cmd (skb, info) * * Received a XID discovery command * */
static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info) { struct xid_frame *xid; discovery_t *discovery = NULL; __u8 *discovery_info; char *text; if (!pskb_may_pull(skb, sizeof(struct xid_frame))) { net_err_ratelimited("%s: frame too short!\n", __func__); return; } xid = (struct xid_frame *) skb->data; info->daddr = le32_to_cpu(xid->saddr); info->saddr = le32_to_cpu(xid->daddr); /* Make sure frame is addressed to us */ if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) { pr_debug("%s(), frame is not addressed to us!\n", __func__); return; } switch (xid->flags & 0x03) { case 0x00: info->S = 1; break; case 0x01: info->S = 6; break; case 0x02: info->S = 8; break; case 0x03: info->S = 16; break; default: /* Error!! */ return; } info->s = xid->slotnr; discovery_info = skb_pull(skb, sizeof(struct xid_frame)); /* * Check if last frame */ if (info->s == 0xff) { /* Check if things are sane at this point... */ if((discovery_info == NULL) || !pskb_may_pull(skb, 3)) { net_err_ratelimited("%s: discovery frame too short!\n", __func__); return; } /* * We now have some discovery info to deliver! */ discovery = kzalloc(sizeof(discovery_t), GFP_ATOMIC); if (!discovery) return; discovery->data.daddr = info->daddr; discovery->data.saddr = self->saddr; discovery->timestamp = jiffies; discovery->data.hints[0] = discovery_info[0]; if (discovery_info[0] & HINT_EXTENSION) { discovery->data.hints[1] = discovery_info[1]; discovery->data.charset = discovery_info[2]; text = (char *) &discovery_info[3]; } else { discovery->data.hints[1] = 0; discovery->data.charset = discovery_info[1]; text = (char *) &discovery_info[2]; } /* * Terminate string, should be safe since this is where the * FCS bytes resides. */ skb->data[skb->len] = '\0'; strncpy(discovery->data.info, text, NICKNAME_MAX_LEN); discovery->name_len = strlen(discovery->data.info); info->discovery = discovery; } else info->discovery = NULL; irlap_do_event(self, RECV_DISCOVERY_XID_CMD, skb, info); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)38686.55%640.00%
Stephen Hemminger265.83%16.67%
Jean Tourrilhes224.93%213.33%
Harvey Harrison30.67%16.67%
Joe Perches30.67%213.33%
Martin Dalecki30.67%16.67%
Guennadi Liakhovetski20.45%16.67%
Chen Gang S10.22%16.67%
Total446100.00%15100.00%

/* * Function irlap_send_rr_frame (self, command) * * Build and transmit RR (Receive Ready) frame. Notice that it is currently * only possible to send RR frames with the poll bit set. */
void irlap_send_rr_frame(struct irlap_cb *self, int command) { struct sk_buff *tx_skb; struct rr_frame *frame; tx_skb = alloc_skb(sizeof(struct rr_frame), GFP_ATOMIC); if (!tx_skb) return; frame = (struct rr_frame *)skb_put(tx_skb, 2); frame->caddr = self->caddr; frame->caddr |= (command) ? CMD_FRAME : 0; frame->control = RR | PF_BIT | (self->vr << 5); irlap_queue_xmit(self, tx_skb); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)7373.74%350.00%
Samuel Ortiz2121.21%233.33%
Jean Tourrilhes55.05%116.67%
Total99100.00%6100.00%

/* * Function irlap_send_rd_frame (self) * * Request disconnect. Used by a secondary station to request the * disconnection of the link. */
void irlap_send_rd_frame(struct irlap_cb *self) { struct sk_buff *tx_skb; struct rd_frame *frame; tx_skb = alloc_skb(sizeof(struct rd_frame), GFP_ATOMIC); if (!tx_skb) return; frame = (struct rd_frame *)skb_put(tx_skb, 2); frame->caddr = self->caddr; frame->control = RD_RSP | PF_BIT; irlap_queue_xmit(self, tx_skb); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)5268.42%120.00%
Samuel Ortiz1823.68%240.00%
Jean Tourrilhes56.58%120.00%
Maks Naumov11.32%120.00%
Total76100.00%5100.00%

/* * Function irlap_recv_rr_frame (skb, info) * * Received RR (Receive Ready) frame from peer station, no harm in * making it inline since its called only from one single place * (irlap_driver_rcv). */
static inline void irlap_recv_rr_frame(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info, int command) { info->nr = skb->data[1] >> 5; /* Check if this is a command or a response frame */ if (command) irlap_do_event(self, RECV_RR_CMD, skb, info); else irlap_do_event(self, RECV_RR_RSP, skb, info); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)66100.00%3100.00%
Total66100.00%3100.00%

/* * Function irlap_recv_rnr_frame (self, skb, info) * * Received RNR (Receive Not Ready) frame from peer station * */
static void irlap_recv_rnr_frame(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info, int command) { info->nr = skb->data[1] >> 5; pr_debug("%s(), nr=%d, %ld\n", __func__, info->nr, jiffies); if (command) irlap_do_event(self, RECV_RNR_CMD, skb, info); else irlap_do_event(self, RECV_RNR_RSP, skb, info); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)7394.81%240.00%
Jean Tourrilhes22.60%120.00%
Joe Perches11.30%120.00%
Harvey Harrison11.30%120.00%
Total77100.00%5100.00%


static void irlap_recv_rej_frame(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info, int command) { info->nr = skb->data[1] >> 5; /* Check if this is a command or a response frame */ if (command) irlap_do_event(self, RECV_REJ_CMD, skb, info); else irlap_do_event(self, RECV_REJ_RSP, skb, info); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)65100.00%3100.00%
Total65100.00%3100.00%


static void irlap_recv_srej_frame(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info, int command) { info->nr = skb->data[1] >> 5; /* Check if this is a command or a response frame */ if (command) irlap_do_event(self, RECV_SREJ_CMD, skb, info); else irlap_do_event(self, RECV_SREJ_RSP, skb, info); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)65100.00%2100.00%
Total65100.00%2100.00%


static void irlap_recv_disc_frame(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info, int command) { /* Check if this is a command or a response frame */ if (command) irlap_do_event(self, RECV_DISC_CMD, skb, info); else irlap_do_event(self, RECV_RD_RSP, skb, info); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)52100.00%2100.00%
Total52100.00%2100.00%

/* * Function irlap_recv_ua_frame (skb, frame) * * Received UA (Unnumbered Acknowledgement) frame * */
static inline void irlap_recv_ua_frame(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info) { irlap_do_event(self, RECV_UA_RSP, skb, info); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)33100.00%2100.00%
Total33100.00%2100.00%

/* * Function irlap_send_data_primary(self, skb) * * Send I-frames as the primary station but without the poll bit set * */
void irlap_send_data_primary(struct irlap_cb *self, struct sk_buff *skb) { struct sk_buff *tx_skb; if (skb->data[1] == I_FRAME) { /* * Insert frame sequence number (Vs) in control field before * inserting into transmit window queue. */ skb->data[1] = I_FRAME | (self->vs << 1); /* * Insert frame in store, in case of retransmissions * Increase skb reference count, see irlap_do_event() */ skb_get(skb); skb_queue_tail(&self->wx_list, skb); /* Copy buffer */ tx_skb = skb_clone(skb, GFP_ATOMIC); if (tx_skb == NULL) { return; } self->vs = (self->vs + 1) % 8; self->ack_required = FALSE; self->window -= 1; irlap_send_i_frame( self, tx_skb, CMD_FRAME); } else { pr_debug("%s(), sending unreliable frame\n", __func__); irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME); self->window -= 1; } }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)13286.27%444.44%
Jean Tourrilhes1811.76%222.22%
Harvey Harrison10.65%111.11%
Joe Perches10.65%111.11%
Martin Dalecki10.65%111.11%
Total153100.00%9100.00%

/* * Function irlap_send_data_primary_poll (self, skb) * * Send I(nformation) frame as primary with poll bit set */
void irlap_send_data_primary_poll(struct irlap_cb *self, struct sk_buff *skb) { struct sk_buff *tx_skb; int transmission_time; /* Stop P timer */ del_timer(&self->poll_timer); /* Is this reliable or unreliable data? */ if (skb->data[1] == I_FRAME) { /* * Insert frame sequence number (Vs) in control field before * inserting into transmit window queue. */ skb->data[1] = I_FRAME | (self->vs << 1); /* * Insert frame in store, in case of retransmissions * Increase skb reference count, see irlap_do_event() */ skb_get(skb); skb_queue_tail(&self->wx_list, skb); /* Copy buffer */ tx_skb = skb_clone(skb, GFP_ATOMIC); if (tx_skb == NULL) { return; } /* * Set poll bit if necessary. We do this to the copied * skb, since retransmitted need to set or clear the poll * bit depending on when they are sent. */ tx_skb->data[1] |= PF_BIT; self->vs = (self->vs + 1) % 8; self->ack_required = FALSE; irlap_next_state(self, LAP_NRM_P); irlap_send_i_frame(self, tx_skb, CMD_FRAME)