Release 4.11 net/irda/irlap_frame.c
/*********************************************************************
*
* 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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 82 | 80.39% | 7 | 77.78% |
Linus Torvalds | 18 | 17.65% | 1 | 11.11% |
Martin Dalecki | 2 | 1.96% | 1 | 11.11% |
Total | 102 | 100.00% | 9 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 54 | 55.10% | 3 | 33.33% |
Samuel Ortiz | 30 | 30.61% | 1 | 11.11% |
Arnaldo Carvalho de Melo | 12 | 12.24% | 3 | 33.33% |
Harvey Harrison | 1 | 1.02% | 1 | 11.11% |
Joe Perches | 1 | 1.02% | 1 | 11.11% |
Total | 98 | 100.00% | 9 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 164 | 88.17% | 5 | 50.00% |
Samuel Ortiz | 11 | 5.91% | 2 | 20.00% |
Jean Tourrilhes | 10 | 5.38% | 2 | 20.00% |
Joe Perches | 1 | 0.54% | 1 | 10.00% |
Total | 186 | 100.00% | 10 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 137 | 84.57% | 4 | 44.44% |
Stephen Hemminger | 14 | 8.64% | 1 | 11.11% |
Jean Tourrilhes | 7 | 4.32% | 2 | 22.22% |
Joe Perches | 2 | 1.23% | 1 | 11.11% |
Harvey Harrison | 2 | 1.23% | 1 | 11.11% |
Total | 162 | 100.00% | 9 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 140 | 85.89% | 5 | 41.67% |
Jean Tourrilhes | 11 | 6.75% | 3 | 25.00% |
Samuel Ortiz | 10 | 6.13% | 2 | 16.67% |
Harvey Harrison | 1 | 0.61% | 1 | 8.33% |
Joe Perches | 1 | 0.61% | 1 | 8.33% |
Total | 163 | 100.00% | 12 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 79 | 73.83% | 3 | 42.86% |
Samuel Ortiz | 21 | 19.63% | 2 | 28.57% |
Jean Tourrilhes | 7 | 6.54% | 2 | 28.57% |
Total | 107 | 100.00% | 7 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 68 | 72.34% | 3 | 42.86% |
Samuel Ortiz | 19 | 20.21% | 2 | 28.57% |
Jean Tourrilhes | 7 | 7.45% | 2 | 28.57% |
Total | 94 | 100.00% | 7 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 382 | 89.67% | 5 | 35.71% |
Jean Tourrilhes | 31 | 7.28% | 4 | 28.57% |
Samuel Ortiz | 10 | 2.35% | 2 | 14.29% |
Martin Dalecki | 1 | 0.23% | 1 | 7.14% |
Harvey Harrison | 1 | 0.23% | 1 | 7.14% |
Joe Perches | 1 | 0.23% | 1 | 7.14% |
Total | 426 | 100.00% | 14 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 319 | 83.51% | 4 | 28.57% |
Jean Tourrilhes | 28 | 7.33% | 3 | 21.43% |
Stephen Hemminger | 21 | 5.50% | 1 | 7.14% |
Joe Perches | 5 | 1.31% | 2 | 14.29% |
Harvey Harrison | 4 | 1.05% | 1 | 7.14% |
Martin Dalecki | 3 | 0.79% | 1 | 7.14% |
Panagiotis Issaris | 1 | 0.26% | 1 | 7.14% |
Guennadi Liakhovetski | 1 | 0.26% | 1 | 7.14% |
Total | 382 | 100.00% | 14 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 386 | 86.55% | 6 | 40.00% |
Stephen Hemminger | 26 | 5.83% | 1 | 6.67% |
Jean Tourrilhes | 22 | 4.93% | 2 | 13.33% |
Harvey Harrison | 3 | 0.67% | 1 | 6.67% |
Joe Perches | 3 | 0.67% | 2 | 13.33% |
Martin Dalecki | 3 | 0.67% | 1 | 6.67% |
Guennadi Liakhovetski | 2 | 0.45% | 1 | 6.67% |
Chen Gang S | 1 | 0.22% | 1 | 6.67% |
Total | 446 | 100.00% | 15 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 73 | 73.74% | 3 | 50.00% |
Samuel Ortiz | 21 | 21.21% | 2 | 33.33% |
Jean Tourrilhes | 5 | 5.05% | 1 | 16.67% |
Total | 99 | 100.00% | 6 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 52 | 68.42% | 1 | 20.00% |
Samuel Ortiz | 18 | 23.68% | 2 | 40.00% |
Jean Tourrilhes | 5 | 6.58% | 1 | 20.00% |
Maks Naumov | 1 | 1.32% | 1 | 20.00% |
Total | 76 | 100.00% | 5 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 66 | 100.00% | 3 | 100.00% |
Total | 66 | 100.00% | 3 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 73 | 94.81% | 2 | 40.00% |
Jean Tourrilhes | 2 | 2.60% | 1 | 20.00% |
Joe Perches | 1 | 1.30% | 1 | 20.00% |
Harvey Harrison | 1 | 1.30% | 1 | 20.00% |
Total | 77 | 100.00% | 5 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 65 | 100.00% | 3 | 100.00% |
Total | 65 | 100.00% | 3 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 65 | 100.00% | 2 | 100.00% |
Total | 65 | 100.00% | 2 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 52 | 100.00% | 2 | 100.00% |
Total | 52 | 100.00% | 2 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 33 | 100.00% | 2 | 100.00% |
Total | 33 | 100.00% | 2 | 100.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
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 132 | 86.27% | 4 | 44.44% |
Jean Tourrilhes | 18 | 11.76% | 2 | 22.22% |
Harvey Harrison | 1 | 0.65% | 1 | 11.11% |
Joe Perches | 1 | 0.65% | 1 | 11.11% |
Martin Dalecki | 1 | 0.65% | 1 | 11.11% |
Total | 153 | 100.00% | 9 | 100.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)