o net/llc: simple cleanups

. align switch with its cases
. fit some lines in 80 columns
parent d1f880ab
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* connections. * connections.
* *
* Copyright (c) 2001 by Jay Schulist <jschlst@samba.org> * Copyright (c) 2001 by Jay Schulist <jschlst@samba.org>
* 2002 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2002-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
...@@ -623,7 +623,8 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags) ...@@ -623,7 +623,8 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags)
struct sk_buff *skb; struct sk_buff *skb;
int rc = -EOPNOTSUPP; int rc = -EOPNOTSUPP;
dprintk("%s: accepting on %02X\n", __FUNCTION__, llc_sk(sk)->addr.sllc_ssap); dprintk("%s: accepting on %02X\n", __FUNCTION__,
llc_sk(sk)->addr.sllc_ssap);
lock_sock(sk); lock_sock(sk);
if (sk->type != SOCK_STREAM) if (sk->type != SOCK_STREAM)
goto out; goto out;
...@@ -634,7 +635,8 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags) ...@@ -634,7 +635,8 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags)
rc = llc_ui_wait_for_data(sk, sk->rcvtimeo); rc = llc_ui_wait_for_data(sk, sk->rcvtimeo);
if (rc) if (rc)
goto out; goto out;
dprintk("%s: got a new connection on %02X\n", __FUNCTION__, llc_sk(sk)->addr.sllc_ssap); dprintk("%s: got a new connection on %02X\n", __FUNCTION__,
llc_sk(sk)->addr.sllc_ssap);
skb = skb_dequeue(&sk->receive_queue); skb = skb_dequeue(&sk->receive_queue);
rc = -EINVAL; rc = -EINVAL;
if (!skb->sk) if (!skb->sk)
...@@ -692,8 +694,9 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -692,8 +694,9 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
timeout = sock_rcvtimeo(sk, noblock); timeout = sock_rcvtimeo(sk, noblock);
rc = llc_ui_wait_for_data(sk, timeout); rc = llc_ui_wait_for_data(sk, timeout);
if (rc) { if (rc) {
dprintk("%s: llc_ui_wait_for_data failed recv in %02X from %02X\n", dprintk("%s: llc_ui_wait_for_data failed recv "
__FUNCTION__, llc_sk(sk)->laddr.lsap, llc_sk(sk)->daddr.lsap); "in %02X from %02X\n", __FUNCTION__,
llc_sk(sk)->laddr.lsap, llc_sk(sk)->daddr.lsap);
goto out; goto out;
} }
skb = skb_dequeue(&sk->receive_queue); skb = skb_dequeue(&sk->receive_queue);
...@@ -742,7 +745,8 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -742,7 +745,8 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock,
struct sk_buff *skb; struct sk_buff *skb;
int rc = -EINVAL, size = 0, copied = 0, hdrlen; int rc = -EINVAL, size = 0, copied = 0, hdrlen;
dprintk("%s: sending from %02X to %02X\n", __FUNCTION__, llc->laddr.lsap, llc->daddr.lsap); dprintk("%s: sending from %02X to %02X\n", __FUNCTION__,
llc->laddr.lsap, llc->daddr.lsap);
lock_sock(sk); lock_sock(sk);
if (addr) { if (addr) {
if (msg->msg_namelen < sizeof(*addr)) if (msg->msg_namelen < sizeof(*addr))
...@@ -906,49 +910,49 @@ static int llc_ui_setsockopt(struct socket *sock, int level, int optname, ...@@ -906,49 +910,49 @@ static int llc_ui_setsockopt(struct socket *sock, int level, int optname,
goto out; goto out;
rc = -EINVAL; rc = -EINVAL;
switch (optname) { switch (optname) {
case LLC_OPT_RETRY: case LLC_OPT_RETRY:
if (opt > LLC_OPT_MAX_RETRY) if (opt > LLC_OPT_MAX_RETRY)
goto out; goto out;
llc->n2 = opt; llc->n2 = opt;
break; break;
case LLC_OPT_SIZE: case LLC_OPT_SIZE:
if (opt > LLC_OPT_MAX_SIZE) if (opt > LLC_OPT_MAX_SIZE)
goto out; goto out;
llc->n1 = opt; llc->n1 = opt;
break; break;
case LLC_OPT_ACK_TMR_EXP: case LLC_OPT_ACK_TMR_EXP:
if (opt > LLC_OPT_MAX_ACK_TMR_EXP) if (opt > LLC_OPT_MAX_ACK_TMR_EXP)
goto out; goto out;
llc->ack_timer.expire = opt; llc->ack_timer.expire = opt;
break; break;
case LLC_OPT_P_TMR_EXP: case LLC_OPT_P_TMR_EXP:
if (opt > LLC_OPT_MAX_P_TMR_EXP) if (opt > LLC_OPT_MAX_P_TMR_EXP)
goto out; goto out;
llc->pf_cycle_timer.expire = opt; llc->pf_cycle_timer.expire = opt;
break; break;
case LLC_OPT_REJ_TMR_EXP: case LLC_OPT_REJ_TMR_EXP:
if (opt > LLC_OPT_MAX_REJ_TMR_EXP) if (opt > LLC_OPT_MAX_REJ_TMR_EXP)
goto out;
llc->rej_sent_timer.expire = opt;
break;
case LLC_OPT_BUSY_TMR_EXP:
if (opt > LLC_OPT_MAX_BUSY_TMR_EXP)
goto out;
llc->busy_state_timer.expire = opt;
break;
case LLC_OPT_TX_WIN:
if (opt > LLC_OPT_MAX_WIN)
goto out;
llc->k = opt;
break;
case LLC_OPT_RX_WIN:
if (opt > LLC_OPT_MAX_WIN)
goto out;
llc->rw = opt;
break;
default:
rc = -ENOPROTOOPT;
goto out; goto out;
llc->rej_sent_timer.expire = opt;
break;
case LLC_OPT_BUSY_TMR_EXP:
if (opt > LLC_OPT_MAX_BUSY_TMR_EXP)
goto out;
llc->busy_state_timer.expire = opt;
break;
case LLC_OPT_TX_WIN:
if (opt > LLC_OPT_MAX_WIN)
goto out;
llc->k = opt;
break;
case LLC_OPT_RX_WIN:
if (opt > LLC_OPT_MAX_WIN)
goto out;
llc->rw = opt;
break;
default:
rc = -ENOPROTOOPT;
goto out;
} }
rc = 0; rc = 0;
out: out:
...@@ -983,25 +987,25 @@ static int llc_ui_getsockopt(struct socket *sock, int level, int optname, ...@@ -983,25 +987,25 @@ static int llc_ui_getsockopt(struct socket *sock, int level, int optname,
if (len != sizeof(int)) if (len != sizeof(int))
goto out; goto out;
switch (optname) { switch (optname) {
case LLC_OPT_RETRY: case LLC_OPT_RETRY:
val = llc->n2; break; val = llc->n2; break;
case LLC_OPT_SIZE: case LLC_OPT_SIZE:
val = llc->n1; break; val = llc->n1; break;
case LLC_OPT_ACK_TMR_EXP: case LLC_OPT_ACK_TMR_EXP:
val = llc->ack_timer.expire; break; val = llc->ack_timer.expire; break;
case LLC_OPT_P_TMR_EXP: case LLC_OPT_P_TMR_EXP:
val = llc->pf_cycle_timer.expire; break; val = llc->pf_cycle_timer.expire; break;
case LLC_OPT_REJ_TMR_EXP: case LLC_OPT_REJ_TMR_EXP:
val = llc->rej_sent_timer.expire; break; val = llc->rej_sent_timer.expire; break;
case LLC_OPT_BUSY_TMR_EXP: case LLC_OPT_BUSY_TMR_EXP:
val = llc->busy_state_timer.expire; break; val = llc->busy_state_timer.expire; break;
case LLC_OPT_TX_WIN: case LLC_OPT_TX_WIN:
val = llc->k; break; val = llc->k; break;
case LLC_OPT_RX_WIN: case LLC_OPT_RX_WIN:
val = llc->rw; break; val = llc->rw; break;
default: default:
rc = -ENOPROTOOPT; rc = -ENOPROTOOPT;
goto out; goto out;
} }
rc = 0; rc = 0;
if (put_user(len, optlen) || copy_to_user(optval, &val, len)) if (put_user(len, optlen) || copy_to_user(optval, &val, len))
...@@ -1038,7 +1042,8 @@ static struct proto_ops llc_ui_ops = { ...@@ -1038,7 +1042,8 @@ static struct proto_ops llc_ui_ops = {
}; };
static char llc_ui_banner[] __initdata = static char llc_ui_banner[] __initdata =
KERN_INFO "NET4.0 IEEE 802.2 BSD sockets, Jay Schulist, 2001, Arnaldo C. Melo, 2002\n"; KERN_INFO "NET4.0 IEEE 802.2 BSD sockets, Jay Schulist, 2001, "
"Arnaldo C. Melo, 2002-2003\n";
int __init llc_ui_init(void) int __init llc_ui_init(void)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* them return 0 On success and 1 otherwise. * them return 0 On success and 1 otherwise.
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* them return 0 On success and 1 otherwise. * them return 0 On success and 1 otherwise.
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
...@@ -145,33 +145,32 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct sk_buff *skb) ...@@ -145,33 +145,32 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct sk_buff *skb)
struct llc_opt *llc = llc_sk(sk); struct llc_opt *llc = llc_sk(sk);
switch (ev->type) { switch (ev->type) {
case LLC_CONN_EV_TYPE_PDU: case LLC_CONN_EV_TYPE_PDU:
if (!LLC_PDU_IS_RSP(pdu) && if (!LLC_PDU_IS_RSP(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_FRMR) { LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_FRMR) {
reason = LLC_RESET_REASON_LOCAL; reason = LLC_RESET_REASON_LOCAL;
rc = 0; rc = 0;
} else if (!LLC_PDU_IS_CMD(pdu) && } else if (!LLC_PDU_IS_CMD(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_CMD(pdu) == LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_SABME) {
LLC_2_PDU_CMD_SABME) { reason = LLC_RESET_REASON_REMOTE;
reason = LLC_RESET_REASON_REMOTE; rc = 0;
rc = 0; } else {
} else { reason = 0;
reason = 0; rc = 1;
rc = 1; }
} break;
break; case LLC_CONN_EV_TYPE_ACK_TMR:
case LLC_CONN_EV_TYPE_ACK_TMR: case LLC_CONN_EV_TYPE_P_TMR:
case LLC_CONN_EV_TYPE_P_TMR: case LLC_CONN_EV_TYPE_REJ_TMR:
case LLC_CONN_EV_TYPE_REJ_TMR: case LLC_CONN_EV_TYPE_BUSY_TMR:
case LLC_CONN_EV_TYPE_BUSY_TMR: if (llc->retry_count > llc->n2) {
if (llc->retry_count > llc->n2) { reason = LLC_RESET_REASON_LOCAL;
reason = LLC_RESET_REASON_LOCAL; rc = 0;
rc = 0; } else
} else rc = 1;
rc = 1; break;
break;
} }
if (!rc) { if (!rc) {
ev->reason = reason; ev->reason = reason;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* in their comments, at below. * in their comments, at below.
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
...@@ -485,11 +485,11 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb) ...@@ -485,11 +485,11 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb)
rc = 0; rc = 0;
} else if (!LLC_PDU_TYPE_IS_U(pdu)) } else if (!LLC_PDU_TYPE_IS_U(pdu))
switch (LLC_U_PDU_CMD(pdu)) { switch (LLC_U_PDU_CMD(pdu)) {
case LLC_2_PDU_CMD_SABME: case LLC_2_PDU_CMD_SABME:
case LLC_2_PDU_CMD_DISC: case LLC_2_PDU_CMD_DISC:
if (!LLC_U_PF_IS_0(pdu)) if (!LLC_U_PF_IS_0(pdu))
rc = 0; rc = 0;
break; break;
} }
} }
return rc; return rc;
...@@ -505,10 +505,10 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb) ...@@ -505,10 +505,10 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb)
rc = 0; rc = 0;
else if (!LLC_PDU_TYPE_IS_U(pdu)) else if (!LLC_PDU_TYPE_IS_U(pdu))
switch (LLC_U_PDU_CMD(pdu)) { switch (LLC_U_PDU_CMD(pdu)) {
case LLC_2_PDU_CMD_SABME: case LLC_2_PDU_CMD_SABME:
case LLC_2_PDU_CMD_DISC: case LLC_2_PDU_CMD_DISC:
rc = 0; rc = 0;
break; break;
} }
} }
return rc; return rc;
...@@ -525,12 +525,12 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb) ...@@ -525,12 +525,12 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb)
rc = 0; rc = 0;
} else if (!LLC_PDU_TYPE_IS_U(pdu)) } else if (!LLC_PDU_TYPE_IS_U(pdu))
switch (LLC_U_PDU_RSP(pdu)) { switch (LLC_U_PDU_RSP(pdu)) {
case LLC_2_PDU_RSP_UA: case LLC_2_PDU_RSP_UA:
case LLC_2_PDU_RSP_DM: case LLC_2_PDU_RSP_DM:
case LLC_2_PDU_RSP_FRMR: case LLC_2_PDU_RSP_FRMR:
if (!LLC_U_PF_IS_1(pdu)) if (!LLC_U_PF_IS_1(pdu))
rc = 0; rc = 0;
break; break;
} }
} }
return rc; return rc;
...@@ -546,11 +546,11 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb) ...@@ -546,11 +546,11 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb)
rc = 0; rc = 0;
else if (!LLC_PDU_TYPE_IS_U(pdu)) else if (!LLC_PDU_TYPE_IS_U(pdu))
switch (LLC_U_PDU_RSP(pdu)) { switch (LLC_U_PDU_RSP(pdu)) {
case LLC_2_PDU_RSP_UA: case LLC_2_PDU_RSP_UA:
case LLC_2_PDU_RSP_DM: case LLC_2_PDU_RSP_DM:
case LLC_2_PDU_RSP_FRMR: case LLC_2_PDU_RSP_FRMR:
rc = 0; rc = 0;
break; break;
} }
} }
...@@ -566,13 +566,13 @@ int llc_conn_ev_rx_xxx_yyy(struct sock *sk, struct sk_buff *skb) ...@@ -566,13 +566,13 @@ int llc_conn_ev_rx_xxx_yyy(struct sock *sk, struct sk_buff *skb)
rc = 0; rc = 0;
else if (!LLC_PDU_TYPE_IS_U(pdu)) else if (!LLC_PDU_TYPE_IS_U(pdu))
switch (LLC_U_PDU_CMD(pdu)) { switch (LLC_U_PDU_CMD(pdu)) {
case LLC_2_PDU_CMD_SABME: case LLC_2_PDU_CMD_SABME:
case LLC_2_PDU_CMD_DISC: case LLC_2_PDU_CMD_DISC:
case LLC_2_PDU_RSP_UA: case LLC_2_PDU_RSP_UA:
case LLC_2_PDU_RSP_DM: case LLC_2_PDU_RSP_DM:
case LLC_2_PDU_RSP_FRMR: case LLC_2_PDU_RSP_FRMR:
rc = 0; rc = 0;
break; break;
} }
return rc; return rc;
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* or in "llc_c_ac.c" and "llc_c_ev.c" modules. * or in "llc_c_ac.c" and "llc_c_ev.c" modules.
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001, 2002 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* llc_conn.c - Driver routines for connection component. * llc_conn.c - Driver routines for connection component.
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
...@@ -84,7 +84,8 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) ...@@ -84,7 +84,8 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
goto out_kfree_skb; goto out_kfree_skb;
} }
if (!ev->ind_prim && !ev->cfm_prim) { /* indicate or confirm not required */ if (!ev->ind_prim && !ev->cfm_prim) {
/* indicate or confirm not required */
if (!skb->list) if (!skb->list)
goto out_kfree_skb; goto out_kfree_skb;
goto out_skb_put; goto out_skb_put;
...@@ -625,17 +626,17 @@ static int llc_find_offset(int state, int ev_type) ...@@ -625,17 +626,17 @@ static int llc_find_offset(int state, int ev_type)
* init_pf_cycle and I don't know what is it. * init_pf_cycle and I don't know what is it.
*/ */
switch (ev_type) { switch (ev_type) {
case LLC_CONN_EV_TYPE_PRIM: case LLC_CONN_EV_TYPE_PRIM:
rc = llc_offset_table[state][0]; break; rc = llc_offset_table[state][0]; break;
case LLC_CONN_EV_TYPE_PDU: case LLC_CONN_EV_TYPE_PDU:
rc = llc_offset_table[state][4]; break; rc = llc_offset_table[state][4]; break;
case LLC_CONN_EV_TYPE_SIMPLE: case LLC_CONN_EV_TYPE_SIMPLE:
rc = llc_offset_table[state][1]; break; rc = llc_offset_table[state][1]; break;
case LLC_CONN_EV_TYPE_P_TMR: case LLC_CONN_EV_TYPE_P_TMR:
case LLC_CONN_EV_TYPE_ACK_TMR: case LLC_CONN_EV_TYPE_ACK_TMR:
case LLC_CONN_EV_TYPE_REJ_TMR: case LLC_CONN_EV_TYPE_REJ_TMR:
case LLC_CONN_EV_TYPE_BUSY_TMR: case LLC_CONN_EV_TYPE_BUSY_TMR:
rc = llc_offset_table[state][3]; break; rc = llc_offset_table[state][3]; break;
} }
return rc; return rc;
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* them return 0 On success and 1 otherwise. * them return 0 On success and 1 otherwise.
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* llc_if.c - Defines LLC interface to upper layer * llc_if.c - Defines LLC interface to upper layer
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* llc_mac.c - Manages interface between LLC and MAC * llc_mac.c - Manages interface between LLC and MAC
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
...@@ -78,7 +78,8 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -78,7 +78,8 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
} }
sap = llc_sap_find(pdu->dsap); sap = llc_sap_find(pdu->dsap);
if (!sap) {/* unknown SAP */ if (!sap) {/* unknown SAP */
dprintk("%s: llc_sap_find(%02X) failed!\n", __FUNCTION__, pdu->dsap); dprintk("%s: llc_sap_find(%02X) failed!\n", __FUNCTION__,
pdu->dsap);
goto drop; goto drop;
} }
llc_decode_pdu_type(skb, &dest); llc_decode_pdu_type(skb, &dest);
...@@ -255,41 +256,41 @@ u16 lan_hdrs_init(struct sk_buff *skb, u8 *sa, u8 *da) ...@@ -255,41 +256,41 @@ u16 lan_hdrs_init(struct sk_buff *skb, u8 *sa, u8 *da)
switch (skb->dev->type) { switch (skb->dev->type) {
#ifdef CONFIG_TR #ifdef CONFIG_TR
case ARPHRD_IEEE802_TR: { case ARPHRD_IEEE802_TR: {
struct trh_hdr *trh; struct trh_hdr *trh;
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
trh = (struct trh_hdr *)skb_push(skb, sizeof(*trh)); trh = (struct trh_hdr *)skb_push(skb, sizeof(*trh));
trh->ac = AC; trh->ac = AC;
trh->fc = LLC_FRAME; trh->fc = LLC_FRAME;
if (sa) if (sa)
memcpy(trh->saddr, sa, dev->addr_len); memcpy(trh->saddr, sa, dev->addr_len);
else else
memset(trh->saddr, 0, dev->addr_len); memset(trh->saddr, 0, dev->addr_len);
if (da) { if (da) {
memcpy(trh->daddr, da, dev->addr_len); memcpy(trh->daddr, da, dev->addr_len);
tr_source_route(skb, trh, dev); tr_source_route(skb, trh, dev);
}
skb->mac.raw = skb->data;
break;
} }
skb->mac.raw = skb->data;
break;
}
#endif #endif
case ARPHRD_ETHER: case ARPHRD_ETHER:
case ARPHRD_LOOPBACK: { case ARPHRD_LOOPBACK: {
unsigned short len = skb->len; unsigned short len = skb->len;
struct ethhdr *eth; struct ethhdr *eth;
skb->mac.raw = skb_push(skb, sizeof(*eth)); skb->mac.raw = skb_push(skb, sizeof(*eth));
eth = (struct ethhdr *)skb->mac.raw; eth = (struct ethhdr *)skb->mac.raw;
eth->h_proto = htons(len); eth->h_proto = htons(len);
memcpy(eth->h_dest, da, ETH_ALEN); memcpy(eth->h_dest, da, ETH_ALEN);
memcpy(eth->h_source, sa, ETH_ALEN); memcpy(eth->h_source, sa, ETH_ALEN);
break; break;
} }
default: default:
printk(KERN_WARNING "Unknown DEVICE type : %d\n", printk(KERN_WARNING "Unknown DEVICE type : %d\n",
skb->dev->type); skb->dev->type);
rc = 1; rc = 1;
} }
return rc; return rc;
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* and connections of the LLC. * and connections of the LLC.
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001, 2002 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
...@@ -600,5 +600,5 @@ module_init(llc_init); ...@@ -600,5 +600,5 @@ module_init(llc_init);
module_exit(llc_exit); module_exit(llc_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Procom, 1997, Arnaldo C. Melo, Jay Schullist, 2001, 2002"); MODULE_AUTHOR("Procom, 1997, Arnaldo C. Melo, Jay Schullist, 2001-2003");
MODULE_DESCRIPTION("LLC 2.0, NET4.0 IEEE 802.2 extended support"); MODULE_DESCRIPTION("LLC 2.0, NET4.0 IEEE 802.2 extended support");
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* llc_pdu.c - access to PDU internals * llc_pdu.c - access to PDU internals
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
...@@ -63,13 +63,13 @@ void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value) ...@@ -63,13 +63,13 @@ void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value)
pdu = llc_pdu_sn_hdr(skb); pdu = llc_pdu_sn_hdr(skb);
switch (pdu_type) { switch (pdu_type) {
case LLC_PDU_TYPE_I: case LLC_PDU_TYPE_I:
case LLC_PDU_TYPE_S: case LLC_PDU_TYPE_S:
pdu->ctrl_2 = (pdu->ctrl_2 & 0xFE) | bit_value; pdu->ctrl_2 = (pdu->ctrl_2 & 0xFE) | bit_value;
break; break;
case LLC_PDU_TYPE_U: case LLC_PDU_TYPE_U:
pdu->ctrl_1 |= (pdu->ctrl_1 & 0xEF) | (bit_value << 4); pdu->ctrl_1 |= (pdu->ctrl_1 & 0xEF) | (bit_value << 4);
break; break;
} }
} }
...@@ -91,13 +91,13 @@ void llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit) ...@@ -91,13 +91,13 @@ void llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit)
pdu = llc_pdu_sn_hdr(skb); pdu = llc_pdu_sn_hdr(skb);
switch (pdu_type) { switch (pdu_type) {
case LLC_PDU_TYPE_I: case LLC_PDU_TYPE_I:
case LLC_PDU_TYPE_S: case LLC_PDU_TYPE_S:
*pf_bit = pdu->ctrl_2 & LLC_S_PF_BIT_MASK; *pf_bit = pdu->ctrl_2 & LLC_S_PF_BIT_MASK;
break; break;
case LLC_PDU_TYPE_U: case LLC_PDU_TYPE_U:
*pf_bit = (pdu->ctrl_1 & LLC_U_PF_BIT_MASK) >> 4; *pf_bit = (pdu->ctrl_1 & LLC_U_PF_BIT_MASK) >> 4;
break; break;
} }
} }
...@@ -547,20 +547,20 @@ void llc_decode_pdu_type(struct sk_buff *skb, u8 *dest) ...@@ -547,20 +547,20 @@ void llc_decode_pdu_type(struct sk_buff *skb, u8 *dest)
if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) != LLC_PDU_TYPE_U) if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) != LLC_PDU_TYPE_U)
goto out; goto out;
switch (LLC_U_PDU_CMD(pdu)) { switch (LLC_U_PDU_CMD(pdu)) {
case LLC_1_PDU_CMD_XID: case LLC_1_PDU_CMD_XID:
case LLC_1_PDU_CMD_UI: case LLC_1_PDU_CMD_UI:
case LLC_1_PDU_CMD_TEST: case LLC_1_PDU_CMD_TEST:
type = LLC_DEST_SAP; type = LLC_DEST_SAP;
break; break;
case LLC_2_PDU_CMD_SABME: case LLC_2_PDU_CMD_SABME:
case LLC_2_PDU_CMD_DISC: case LLC_2_PDU_CMD_DISC:
case LLC_2_PDU_RSP_UA: case LLC_2_PDU_RSP_UA:
case LLC_2_PDU_RSP_DM: case LLC_2_PDU_RSP_DM:
case LLC_2_PDU_RSP_FRMR: case LLC_2_PDU_RSP_FRMR:
break; break;
default: default:
type = LLC_DEST_INVALID; type = LLC_DEST_INVALID;
break; break;
} }
out: out:
*dest = type; *dest = type;
...@@ -604,13 +604,13 @@ static u8 llc_pdu_get_pf_bit(struct llc_pdu_sn *pdu) ...@@ -604,13 +604,13 @@ static u8 llc_pdu_get_pf_bit(struct llc_pdu_sn *pdu)
} else } else
pdu_type = LLC_PDU_TYPE_I; pdu_type = LLC_PDU_TYPE_I;
switch (pdu_type) { switch (pdu_type) {
case LLC_PDU_TYPE_I: case LLC_PDU_TYPE_I:
case LLC_PDU_TYPE_S: case LLC_PDU_TYPE_S:
pf_bit = pdu->ctrl_2 & LLC_S_PF_BIT_MASK; pf_bit = pdu->ctrl_2 & LLC_S_PF_BIT_MASK;
break; break;
case LLC_PDU_TYPE_U: case LLC_PDU_TYPE_U:
pf_bit = (pdu->ctrl_1 & LLC_U_PF_BIT_MASK) >> 4; pf_bit = (pdu->ctrl_1 & LLC_U_PF_BIT_MASK) >> 4;
break; break;
} }
return pf_bit; return pf_bit;
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* proc_llc.c - proc interface for LLC * proc_llc.c - proc interface for LLC
* *
* Copyright (c) 2001 by Jay Schulist <jschlst@samba.org> * Copyright (c) 2001 by Jay Schulist <jschlst@samba.org>
* 2002 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2002-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* them return 0 On success and 1 otherwise. * them return 0 On success and 1 otherwise.
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* in 802.2 LLC protocol standard document. * in 802.2 LLC protocol standard document.
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* which are described in 802.2 LLC protocol standard document. * which are described in 802.2 LLC protocol standard document.
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* llc_sap.c - driver routines for SAP component. * llc_sap.c - driver routines for SAP component.
* *
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* llc_stat.c - Implementation of LLC station component state machine * llc_stat.c - Implementation of LLC station component state machine
* transitions * transitions
* Copyright (c) 1997 by Procom Technology, Inc. * Copyright (c) 1997 by Procom Technology, Inc.
* 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* This program can be redistributed or modified under the terms of the * This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation. * GNU General Public License as published by the Free Software Foundation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment