cregit-Linux how code gets into the kernel

Release 4.8 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
pre-gitpre-git8280.39%777.78%
linus torvaldslinus torvalds1817.65%111.11%
martin daleckimartin 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
pre-gitpre-git5455.10%333.33%
samuel ortizsamuel ortiz3030.61%111.11%
arnaldo carvalho de meloarnaldo carvalho de melo1212.24%333.33%
joe perchesjoe perches11.02%111.11%
harvey harrisonharvey harrison11.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
pre-gitpre-git16488.17%550.00%
samuel ortizsamuel ortiz115.91%220.00%
jean tourrilhesjean tourrilhes105.38%220.00%
joe perchesjoe 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
pre-gitpre-git13784.57%444.44%
stephen hemmingerstephen hemminger148.64%111.11%
jean tourrilhesjean tourrilhes74.32%222.22%
harvey harrisonharvey harrison21.23%111.11%
joe perchesjoe perches21.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
pre-gitpre-git14085.89%541.67%
jean tourrilhesjean tourrilhes116.75%325.00%
samuel ortizsamuel ortiz106.13%216.67%
joe perchesjoe perches10.61%18.33%
harvey harrisonharvey harrison10.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
pre-gitpre-git7973.83%342.86%
samuel ortizsamuel ortiz2119.63%228.57%
jean tourrilhesjean 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
pre-gitpre-git6872.34%342.86%
samuel ortizsamuel ortiz1920.21%228.57%
jean tourrilhesjean 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
pre-gitpre-git38289.67%535.71%
jean tourrilhesjean tourrilhes317.28%428.57%
samuel ortizsamuel ortiz102.35%214.29%
martin daleckimartin dalecki10.23%17.14%
harvey harrisonharvey harrison10.23%17.14%
joe perchesjoe 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
pre-gitpre-git31983.51%428.57%
jean tourrilhesjean tourrilhes287.33%321.43%
stephen hemmingerstephen hemminger215.50%17.14%
joe perchesjoe perches51.31%214.29%
harvey harrisonharvey harrison41.05%17.14%
martin daleckimartin dalecki30.79%17.14%
guennadi liakhovetskiguennadi liakhovetski10.26%17.14%
panagiotis issaris*panagiotis issaris*10.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
pre-gitpre-git38686.55%640.00%
stephen hemmingerstephen hemminger265.83%16.67%
jean tourrilhesjean tourrilhes224.93%213.33%
harvey harrisonharvey harrison30.67%16.67%
martin daleckimartin dalecki30.67%16.67%
joe perchesjoe perches30.67%213.33%
guennadi liakhovetskiguennadi liakhovetski20.45%16.67%
chen gangchen gang10.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
pre-gitpre-git7373.74%350.00%
samuel ortizsamuel ortiz2121.21%233.33%
jean tourrilhesjean 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
pre-gitpre-git5268.42%120.00%
samuel ortizsamuel ortiz1823.68%240.00%
jean tourrilhesjean tourrilhes56.58%120.00%
maks naumovmaks 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
pre-gitpre-git66100.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
pre-gitpre-git7394.81%240.00%
jean tourrilhesjean tourrilhes22.60%120.00%
harvey harrisonharvey harrison11.30%120.00%
joe perchesjoe perches11.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
pre-gitpre-git65100.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
pre-gitpre-git65100.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
pre-gitpre-git52100.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
pre-gitpre-git33100.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
pre-gitpre-git13286.27%444.44%
jean tourrilhesjean tourrilhes1811.76%222.22%
joe perchesjoe perches10.65%111.11%
martin daleckimartin dalecki10.65%111.11%
harvey harrisonharvey harrison10.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); } else { pr_debug("%s(), sending unreliable frame\n", __func__); if (self->ack_required) { irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME); irlap_next_state(self, LAP_NRM_P); irlap_send_rr_frame(self, CMD_FRAME); self->ack_required = FALSE; } else { skb->data[1] |= PF_BIT; irlap_next_state(self, LAP_NRM_P); irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME); } } /* How much time we took for transmission of all frames. * We don't know, so let assume we used the full window. Jean II */ transmission_time = self->final_timeout; /* Reset parameter so that we can fill next window */ self->window