Commit d2a65691 authored by David Howells's avatar David Howells Committed by Linus Torvalds

[PATCH] RxRPC update

Here's a patch to update the RxRPC driver. Most of it is CodingStyle fixes,
but it also includes a few miscellaneous bug fixes. stdint types are also
turned into C99 forms (eg: u32 -> uint32_t).
parent 7770f5fe
......@@ -67,8 +67,8 @@ struct rxrpc_call
wait_queue_head_t waitq; /* wait queue for events to happen */
struct list_head link; /* general internal list link */
struct list_head call_link; /* master call list link */
u32 chan_ix; /* connection channel index (net order) */
u32 call_id; /* call ID on connection (net order) */
uint32_t chan_ix; /* connection channel index (net order) */
uint32_t call_id; /* call ID on connection (net order) */
unsigned long cjif; /* jiffies at call creation */
unsigned long flags; /* control flags */
#define RXRPC_CALL_ACKS_TIMO 0x00000001 /* ACKS timeout reached */
......@@ -103,7 +103,7 @@ struct rxrpc_call
char ackr_dfr_perm; /* request for deferred ACKs permitted */
rxrpc_seq_t ackr_dfr_seq; /* seqno for deferred ACK */
struct rxrpc_ackpacket ackr; /* pending normal ACK packet */
u8 ackr_array[RXRPC_CALL_ACK_WINDOW_SIZE]; /* ACK records */
uint8_t ackr_array[RXRPC_CALL_ACK_WINDOW_SIZE]; /* ACK records */
/* presentation layer */
char app_last_rcv; /* T if received last packet from remote end */
......@@ -131,14 +131,14 @@ struct rxrpc_call
struct list_head app_attn_link; /* application attention list linkage */
size_t app_mark; /* trigger callback when app_ready_qty>=app_mark */
char app_async_read; /* T if in async-read mode */
u8 *app_read_buf; /* application async read buffer (app_mark size) */
u8 *app_scr_alloc; /* application scratch allocation pointer */
uint8_t *app_read_buf; /* application async read buffer (app_mark size) */
uint8_t *app_scr_alloc; /* application scratch allocation pointer */
void *app_scr_ptr; /* application pointer into scratch buffer */
#define RXRPC_APP_MARK_EOF 0xFFFFFFFFU /* mark at end of input */
/* application scratch buffer */
u8 app_scratch[0] __attribute__((aligned(sizeof(long))));
uint8_t app_scratch[0] __attribute__((aligned(sizeof(long))));
};
#define RXRPC_CALL_SCRATCH_SIZE (PAGE_SIZE - sizeof(struct rxrpc_call))
......@@ -206,7 +206,7 @@ extern int rxrpc_call_read_data(struct rxrpc_call *call, void *buffer, size_t si
extern int rxrpc_call_write_data(struct rxrpc_call *call,
size_t sioc,
struct iovec siov[],
u8 rxhdr_flags,
uint8_t rxhdr_flags,
int alloc_flags,
int dup_data,
size_t *size_sent);
......
......@@ -34,6 +34,7 @@ struct rxrpc_connection
struct list_head link; /* link in peer's list */
struct list_head proc_link; /* link in proc list */
struct list_head err_link; /* link in ICMP error processing list */
struct list_head id_link; /* link in ID grant list */
struct sockaddr_in addr; /* remote address */
struct rxrpc_call *channels[4]; /* channels (active calls) */
wait_queue_head_t chanwait; /* wait for channel to become available */
......@@ -44,19 +45,19 @@ struct rxrpc_connection
rxrpc_serial_t serial_counter; /* packet serial number counter */
/* the following should all be in net order */
u32 in_epoch; /* peer's epoch */
u32 out_epoch; /* my epoch */
u32 conn_id; /* connection ID, appropriately shifted */
u16 service_id; /* service ID */
u8 security_ix; /* security ID */
u8 in_clientflag; /* RXRPC_CLIENT_INITIATED if we are server */
u8 out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */
uint32_t in_epoch; /* peer's epoch */
uint32_t out_epoch; /* my epoch */
uint32_t conn_id; /* connection ID, appropriately shifted */
uint16_t service_id; /* service ID */
uint8_t security_ix; /* security ID */
uint8_t in_clientflag; /* RXRPC_CLIENT_INITIATED if we are server */
uint8_t out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */
};
extern int rxrpc_create_connection(struct rxrpc_transport *trans,
u16 port,
u32 addr,
unsigned short service_id,
uint16_t port,
uint32_t addr,
uint16_t service_id,
void *security,
struct rxrpc_connection **_conn);
......
......@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version.
*/
#ifndef _H_3AD3363A_3A9C_11D6_83D8_0002B3163499
#define _H_3AD3363A_3A9C_11D6_83D8_0002B3163499
#ifndef _LINUX_RXRPC_MESSAGE_H
#define _LINUX_RXRPC_MESSAGE_H
#include <rxrpc/packet.h>
......@@ -61,7 +61,7 @@ static inline void rxrpc_put_message(struct rxrpc_message *msg)
extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
struct rxrpc_call *call,
u8 type,
uint8_t type,
int count,
struct iovec diov[],
int alloc_flags,
......@@ -69,4 +69,4 @@ extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
extern int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg);
#endif /* _H_3AD3363A_3A9C_11D6_83D8_0002B3163499 */
#endif /* _LINUX_RXRPC_MESSAGE_H */
......@@ -27,21 +27,21 @@ extern size_t RXRPC_MAX_PACKET_SIZE;
*/
struct rxrpc_header
{
u32 epoch; /* client boot timestamp */
uint32_t epoch; /* client boot timestamp */
u32 cid; /* connection and channel ID */
uint32_t cid; /* connection and channel ID */
#define RXRPC_MAXCALLS 4 /* max active calls per conn */
#define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */
#define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */
#define RXRPC_CIDSHIFT 2 /* shift for connection ID */
u32 callNumber; /* call ID (0 for connection-level packets) */
uint32_t callNumber; /* call ID (0 for connection-level packets) */
#define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */
u32 seq; /* sequence number of pkt in call stream */
u32 serial; /* serial number of pkt sent to network */
uint32_t seq; /* sequence number of pkt in call stream */
uint32_t serial; /* serial number of pkt sent to network */
u8 type; /* packet type */
uint8_t type; /* packet type */
#define RXRPC_PACKET_TYPE_DATA 1 /* data */
#define RXRPC_PACKET_TYPE_ACK 2 /* ACK */
#define RXRPC_PACKET_TYPE_BUSY 3 /* call reject */
......@@ -52,7 +52,7 @@ struct rxrpc_header
#define RXRPC_PACKET_TYPE_DEBUG 8 /* debug info request */
#define RXRPC_N_PACKET_TYPES 9 /* number of packet types (incl type 0) */
u8 flags; /* packet flags */
uint8_t flags; /* packet flags */
#define RXRPC_CLIENT_INITIATED 0x01 /* signifies a packet generated by a client */
#define RXRPC_REQUEST_ACK 0x02 /* request an unconditional ACK of this packet */
#define RXRPC_LAST_PACKET 0x04 /* the last packet from this side for this call */
......@@ -60,10 +60,10 @@ struct rxrpc_header
#define RXRPC_JUMBO_PACKET 0x20 /* [DATA] this is a jumbo packet */
#define RXRPC_SLOW_START_OK 0x20 /* [ACK] slow start supported */
u8 userStatus; /* app-layer defined status */
u8 securityIndex; /* security protocol ID */
u16 _rsvd; /* reserved (used by kerberos security as cksum) */
u16 serviceId; /* service ID */
uint8_t userStatus; /* app-layer defined status */
uint8_t securityIndex; /* security protocol ID */
uint16_t _rsvd; /* reserved (used by kerberos security as cksum) */
uint16_t serviceId; /* service ID */
} __attribute__((packed));
......@@ -83,9 +83,9 @@ extern const char *rxrpc_pkts[];
*/
struct rxrpc_jumbo_header
{
u8 flags; /* packet flags (as per rxrpc_header) */
u8 pad;
u16 _rsvd; /* reserved (used by kerberos security as cksum) */
uint8_t flags; /* packet flags (as per rxrpc_header) */
uint8_t pad;
uint16_t _rsvd; /* reserved (used by kerberos security as cksum) */
};
#define RXRPC_JUMBO_DATALEN 1412 /* non-terminal jumbo packet data length */
......@@ -97,13 +97,14 @@ struct rxrpc_jumbo_header
*/
struct rxrpc_ackpacket
{
u16 bufferSpace; /* number of packet buffers available */
u16 maxSkew; /* diff between serno being ACK'd and highest serial no received */
u32 firstPacket; /* sequence no of first ACK'd packet in attached list */
u32 previousPacket; /* sequence no of previous packet received */
u32 serial; /* serial no of packet that prompted this ACK */
u8 reason; /* reason for ACK */
uint16_t bufferSpace; /* number of packet buffers available */
uint16_t maxSkew; /* diff between serno being ACK'd and highest serial no
* received */
uint32_t firstPacket; /* sequence no of first ACK'd packet in attached list */
uint32_t previousPacket; /* sequence no of previous packet received */
uint32_t serial; /* serial no of packet that prompted this ACK */
uint8_t reason; /* reason for ACK */
#define RXRPC_ACK_REQUESTED 1 /* ACK was requested on packet */
#define RXRPC_ACK_DUPLICATE 2 /* duplicate packet received */
#define RXRPC_ACK_OUT_OF_SEQUENCE 3 /* out of sequence packet received */
......@@ -114,10 +115,10 @@ struct rxrpc_ackpacket
#define RXRPC_ACK_DELAY 8 /* nothing happened since received packet */
#define RXRPC_ACK_IDLE 9 /* ACK due to fully received ACK window */
u8 nAcks; /* number of ACKs */
uint8_t nAcks; /* number of ACKs */
#define RXRPC_MAXACKS 255
u8 acks[0]; /* list of ACK/NAKs */
uint8_t acks[0]; /* list of ACK/NAKs */
#define RXRPC_ACK_TYPE_NACK 0
#define RXRPC_ACK_TYPE_ACK 1
......
......@@ -42,7 +42,10 @@ struct rxrpc_peer
struct rxrpc_timer timeout; /* timeout for grave destruction */
struct list_head link; /* link in transport's peer list */
struct list_head proc_link; /* link in /proc list */
rwlock_t conn_lock; /* lock for connections */
rwlock_t conn_idlock; /* lock for connection IDs */
struct list_head conn_idlist; /* list of connections granted IDs */
uint32_t conn_idcounter; /* connection ID counter */
rwlock_t conn_lock; /* lock for active/dead connections */
struct list_head conn_active; /* active connections to/from this peer */
struct list_head conn_graveyard; /* graveyard for inactive connections */
spinlock_t conn_gylock; /* lock for conn_graveyard */
......
......@@ -14,7 +14,7 @@
#ifdef __KERNEL__
extern u32 rxrpc_epoch;
extern uint32_t rxrpc_epoch;
extern int rxrpc_ktrace;
extern int rxrpc_kdebug;
......
......@@ -85,10 +85,11 @@ extern int rxrpc_create_transport(unsigned short port,
static inline void rxrpc_get_transport(struct rxrpc_transport *trans)
{
if (atomic_read(&trans->usage)<=0)
if (atomic_read(&trans->usage) <= 0)
BUG();
atomic_inc(&trans->usage);
//printk("rxrpc_get_transport(%p{u=%d})\n",trans,atomic_read(&trans->usage));
//printk("rxrpc_get_transport(%p{u=%d})\n",
// trans, atomic_read(&trans->usage));
}
extern void rxrpc_put_transport(struct rxrpc_transport *trans);
......@@ -99,11 +100,6 @@ extern int rxrpc_add_service(struct rxrpc_transport *trans,
extern void rxrpc_del_service(struct rxrpc_transport *trans,
struct rxrpc_service *srv);
#if 0
extern int rxrpc_trans_add_connection(struct rxrpc_transport *trans,
struct rxrpc_connection *conn);
#endif
extern void rxrpc_trans_receive_packet(struct rxrpc_transport *trans);
extern int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
......
......@@ -19,8 +19,8 @@
#include <linux/spinlock.h>
#include <asm/atomic.h>
typedef unsigned rxrpc_seq_t; /* Rx message sequence number */
typedef unsigned rxrpc_serial_t; /* Rx message serial number */
typedef uint32_t rxrpc_seq_t; /* Rx message sequence number */
typedef uint32_t rxrpc_serial_t; /* Rx message serial number */
struct rxrpc_call;
struct rxrpc_connection;
......
......@@ -2,7 +2,9 @@
# Makefile for Linux kernel Rx RPC
#
rxrpc-y := \
#CFLAGS += -finstrument-functions
rxrpc-objs := \
call.o \
connection.o \
krxiod.o \
......@@ -13,7 +15,11 @@ rxrpc-y := \
rxrpc_syms.o \
transport.o
rxrpc-$(CONFIG_PROC_FS) += proc.o
rxrpc-$(CONFIG_SYSCTL) += sysctl.o
ifeq ($(CONFIG_PROC_FS),y)
rxrpc-objs += proc.o
endif
ifeq ($(CONFIG_SYSCTL),y)
rxrpc-objs += sysctl.o
endif
obj-$(CONFIG_RXRPC) := rxrpc.o
This diff is collapsed.
This diff is collapsed.
......@@ -55,7 +55,7 @@ static inline void rxrpc_discard_my_signals(void)
siginfo_t sinfo;
spin_lock_irq(&current->sighand->siglock);
dequeue_signal(current,&current->blocked,&sinfo);
dequeue_signal(current, &current->blocked, &sinfo);
spin_unlock_irq(&current->sighand->siglock);
}
}
......@@ -71,6 +71,7 @@ extern struct rw_semaphore rxrpc_calls_sem;
*/
extern struct list_head rxrpc_conns;
extern struct rw_semaphore rxrpc_conns_sem;
extern unsigned long rxrpc_conn_timeout;
extern void rxrpc_conn_do_timeout(struct rxrpc_connection *conn);
extern void rxrpc_conn_clearall(struct rxrpc_peer *peer);
......@@ -80,6 +81,7 @@ extern void rxrpc_conn_clearall(struct rxrpc_peer *peer);
*/
extern struct list_head rxrpc_peers;
extern struct rw_semaphore rxrpc_peers_sem;
extern unsigned long rxrpc_peer_timeout;
extern void rxrpc_peer_calculate_rtt(struct rxrpc_peer *peer,
struct rxrpc_message *msg,
......
......@@ -44,6 +44,12 @@ static int rxrpc_krxiod(void *arg)
daemonize("krxiod");
/* only certain signals are of interest */
spin_lock_irq(&current->sighand->siglock);
siginitsetinv(&current->blocked, 0);
recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);
/* loop around waiting for work to do */
do {
/* wait for work or to be told to exit */
......@@ -51,7 +57,7 @@ static int rxrpc_krxiod(void *arg)
if (!atomic_read(&rxrpc_krxiod_qcount)) {
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&rxrpc_krxiod_sleepq,&krxiod);
add_wait_queue(&rxrpc_krxiod_sleepq, &krxiod);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
......@@ -63,7 +69,7 @@ static int rxrpc_krxiod(void *arg)
schedule();
}
remove_wait_queue(&rxrpc_krxiod_sleepq,&krxiod);
remove_wait_queue(&rxrpc_krxiod_sleepq, &krxiod);
set_current_state(TASK_RUNNING);
}
_debug("### End Wait");
......@@ -78,12 +84,16 @@ static int rxrpc_krxiod(void *arg)
spin_lock_irq(&rxrpc_krxiod_transportq_lock);
if (!list_empty(&rxrpc_krxiod_transportq)) {
trans = list_entry(rxrpc_krxiod_transportq.next,
struct rxrpc_transport,krxiodq_link);
trans = list_entry(
rxrpc_krxiod_transportq.next,
struct rxrpc_transport,
krxiodq_link);
list_del_init(&trans->krxiodq_link);
atomic_dec(&rxrpc_krxiod_qcount);
/* make sure it hasn't gone away and doesn't go away */
/* make sure it hasn't gone away and doesn't go
* away */
if (atomic_read(&trans->usage)>0)
rxrpc_get_transport(trans);
else
......@@ -106,13 +116,16 @@ static int rxrpc_krxiod(void *arg)
if (!list_empty(&rxrpc_krxiod_callq)) {
call = list_entry(rxrpc_krxiod_callq.next,
struct rxrpc_call,rcv_krxiodq_lk);
struct rxrpc_call,
rcv_krxiodq_lk);
list_del_init(&call->rcv_krxiodq_lk);
atomic_dec(&rxrpc_krxiod_qcount);
/* make sure it hasn't gone away and doesn't go away */
if (atomic_read(&call->usage)>0) {
_debug("@@@ KRXIOD Begin Attend Call %p",call);
/* make sure it hasn't gone away and doesn't go
* away */
if (atomic_read(&call->usage) > 0) {
_debug("@@@ KRXIOD"
" Begin Attend Call %p",call);
rxrpc_get_call(call);
}
else {
......@@ -125,7 +138,7 @@ static int rxrpc_krxiod(void *arg)
if (call) {
rxrpc_call_do_stuff(call);
rxrpc_put_call(call);
_debug("@@@ KRXIOD End Attend Call %p",call);
_debug("@@@ KRXIOD End Attend Call %p", call);
}
}
......@@ -137,7 +150,7 @@ static int rxrpc_krxiod(void *arg)
} while (!rxrpc_krxiod_die);
/* and that's all */
complete_and_exit(&rxrpc_krxiod_dead,0);
complete_and_exit(&rxrpc_krxiod_dead, 0);
} /* end rxrpc_krxiod() */
......@@ -147,7 +160,7 @@ static int rxrpc_krxiod(void *arg)
*/
int __init rxrpc_krxiod_init(void)
{
return kernel_thread(rxrpc_krxiod,NULL,0);
return kernel_thread(rxrpc_krxiod, NULL, 0);
} /* end rxrpc_krxiod_init() */
......@@ -174,16 +187,17 @@ void rxrpc_krxiod_queue_transport(struct rxrpc_transport *trans)
_enter("");
if (list_empty(&trans->krxiodq_link)) {
spin_lock_irqsave(&rxrpc_krxiod_transportq_lock,flags);
spin_lock_irqsave(&rxrpc_krxiod_transportq_lock, flags);
if (list_empty(&trans->krxiodq_link)) {
if (atomic_read(&trans->usage)>0) {
list_add_tail(&trans->krxiodq_link,&rxrpc_krxiod_transportq);
if (atomic_read(&trans->usage) > 0) {
list_add_tail(&trans->krxiodq_link,
&rxrpc_krxiod_transportq);
atomic_inc(&rxrpc_krxiod_qcount);
}
}
spin_unlock_irqrestore(&rxrpc_krxiod_transportq_lock,flags);
spin_unlock_irqrestore(&rxrpc_krxiod_transportq_lock, flags);
wake_up_all(&rxrpc_krxiod_sleepq);
}
......@@ -201,12 +215,12 @@ void rxrpc_krxiod_dequeue_transport(struct rxrpc_transport *trans)
_enter("");
spin_lock_irqsave(&rxrpc_krxiod_transportq_lock,flags);
spin_lock_irqsave(&rxrpc_krxiod_transportq_lock, flags);
if (!list_empty(&trans->krxiodq_link)) {
list_del_init(&trans->krxiodq_link);
atomic_dec(&rxrpc_krxiod_qcount);
}
spin_unlock_irqrestore(&rxrpc_krxiod_transportq_lock,flags);
spin_unlock_irqrestore(&rxrpc_krxiod_transportq_lock, flags);
_leave("");
......@@ -221,12 +235,13 @@ void rxrpc_krxiod_queue_call(struct rxrpc_call *call)
unsigned long flags;
if (list_empty(&call->rcv_krxiodq_lk)) {
spin_lock_irqsave(&rxrpc_krxiod_callq_lock,flags);
if (atomic_read(&call->usage)>0) {
list_add_tail(&call->rcv_krxiodq_lk,&rxrpc_krxiod_callq);
spin_lock_irqsave(&rxrpc_krxiod_callq_lock, flags);
if (atomic_read(&call->usage) > 0) {
list_add_tail(&call->rcv_krxiodq_lk,
&rxrpc_krxiod_callq);
atomic_inc(&rxrpc_krxiod_qcount);
}
spin_unlock_irqrestore(&rxrpc_krxiod_callq_lock,flags);
spin_unlock_irqrestore(&rxrpc_krxiod_callq_lock, flags);
}
wake_up_all(&rxrpc_krxiod_sleepq);
......@@ -240,11 +255,11 @@ void rxrpc_krxiod_dequeue_call(struct rxrpc_call *call)
{
unsigned long flags;
spin_lock_irqsave(&rxrpc_krxiod_callq_lock,flags);
spin_lock_irqsave(&rxrpc_krxiod_callq_lock, flags);
if (!list_empty(&call->rcv_krxiodq_lk)) {
list_del_init(&call->rcv_krxiodq_lk);
atomic_dec(&rxrpc_krxiod_qcount);
}
spin_unlock_irqrestore(&rxrpc_krxiod_callq_lock,flags);
spin_unlock_irqrestore(&rxrpc_krxiod_callq_lock, flags);
} /* end rxrpc_krxiod_dequeue_call() */
......@@ -36,7 +36,8 @@ static volatile int rxrpc_krxsecd_die;
static atomic_t rxrpc_krxsecd_qcount;
/* queue of unprocessed inbound messages with seqno #1 and RXRPC_CLIENT_INITIATED flag set */
/* queue of unprocessed inbound messages with seqno #1 and
* RXRPC_CLIENT_INITIATED flag set */
static LIST_HEAD(rxrpc_krxsecd_initmsgq);
static spinlock_t rxrpc_krxsecd_initmsgq_lock = SPIN_LOCK_UNLOCKED;
......@@ -48,14 +49,20 @@ static void rxrpc_krxsecd_process_incoming_call(struct rxrpc_message *msg);
*/
static int rxrpc_krxsecd(void *arg)
{
DECLARE_WAITQUEUE(krxsecd,current);
DECLARE_WAITQUEUE(krxsecd, current);
int die;
printk("Started krxsecd %d\n",current->pid);
printk("Started krxsecd %d\n", current->pid);
daemonize("krxsecd");
/* only certain signals are of interest */
spin_lock_irq(&current->sighand->siglock);
siginitsetinv(&current->blocked, 0);
recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);
/* loop around waiting for work to do */
do {
/* wait for work or to be told to exit */
......@@ -63,7 +70,7 @@ static int rxrpc_krxsecd(void *arg)
if (!atomic_read(&rxrpc_krxsecd_qcount)) {
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&rxrpc_krxsecd_sleepq,&krxsecd);
add_wait_queue(&rxrpc_krxsecd_sleepq, &krxsecd);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
......@@ -75,7 +82,7 @@ static int rxrpc_krxsecd(void *arg)
schedule();
}
remove_wait_queue(&rxrpc_krxsecd_sleepq,&krxsecd);
remove_wait_queue(&rxrpc_krxsecd_sleepq, &krxsecd);
set_current_state(TASK_RUNNING);
}
die = rxrpc_krxsecd_die;
......@@ -91,7 +98,7 @@ static int rxrpc_krxsecd(void *arg)
if (!list_empty(&rxrpc_krxsecd_initmsgq)) {
msg = list_entry(rxrpc_krxsecd_initmsgq.next,
struct rxrpc_message,link);
struct rxrpc_message, link);
list_del_init(&msg->link);
atomic_dec(&rxrpc_krxsecd_qcount);
}
......@@ -112,7 +119,7 @@ static int rxrpc_krxsecd(void *arg)
} while (!die);
/* and that's all */
complete_and_exit(&rxrpc_krxsecd_dead,0);
complete_and_exit(&rxrpc_krxsecd_dead, 0);
} /* end rxrpc_krxsecd() */
......@@ -122,7 +129,7 @@ static int rxrpc_krxsecd(void *arg)
*/
int __init rxrpc_krxsecd_init(void)
{
return kernel_thread(rxrpc_krxsecd,NULL,0);
return kernel_thread(rxrpc_krxsecd, NULL, 0);
} /* end rxrpc_krxsecd_init() */
......@@ -154,11 +161,11 @@ void rxrpc_krxsecd_clear_transport(struct rxrpc_transport *trans)
/* move all the messages for this transport onto a temp list */
spin_lock(&rxrpc_krxsecd_initmsgq_lock);
list_for_each_safe(_p,_n,&rxrpc_krxsecd_initmsgq) {
msg = list_entry(_p,struct rxrpc_message,link);
if (msg->trans==trans) {
list_for_each_safe(_p, _n, &rxrpc_krxsecd_initmsgq) {
msg = list_entry(_p, struct rxrpc_message, link);
if (msg->trans == trans) {
list_del(&msg->link);
list_add_tail(&msg->link,&tmp);
list_add_tail(&msg->link, &tmp);
atomic_dec(&rxrpc_krxsecd_qcount);
}
}
......@@ -167,7 +174,7 @@ void rxrpc_krxsecd_clear_transport(struct rxrpc_transport *trans)
/* zap all messages on the temp list */
while (!list_empty(&tmp)) {
msg = list_entry(tmp.next,struct rxrpc_message,link);
msg = list_entry(tmp.next, struct rxrpc_message, link);
list_del_init(&msg->link);
rxrpc_put_message(msg);
}
......@@ -181,14 +188,14 @@ void rxrpc_krxsecd_clear_transport(struct rxrpc_transport *trans)
*/
void rxrpc_krxsecd_queue_incoming_call(struct rxrpc_message *msg)
{
_enter("%p",msg);
_enter("%p", msg);
/* queue for processing by krxsecd */
spin_lock(&rxrpc_krxsecd_initmsgq_lock);
if (!rxrpc_krxsecd_die) {
rxrpc_get_message(msg);
list_add_tail(&msg->link,&rxrpc_krxsecd_initmsgq);
list_add_tail(&msg->link, &rxrpc_krxsecd_initmsgq);
atomic_inc(&rxrpc_krxsecd_qcount);
}
......@@ -212,10 +219,10 @@ void rxrpc_krxsecd_process_incoming_call(struct rxrpc_message *msg)
unsigned short sid;
int ret;
_enter("%p{tr=%p}",msg,trans);
_enter("%p{tr=%p}", msg, trans);
ret = rxrpc_incoming_call(msg->conn,msg,&call);
if (ret<0)
ret = rxrpc_incoming_call(msg->conn, msg, &call);
if (ret < 0)
goto out;
/* find the matching service on the transport */
......@@ -223,11 +230,11 @@ void rxrpc_krxsecd_process_incoming_call(struct rxrpc_message *msg)
srv = NULL;
spin_lock(&trans->lock);
list_for_each(_p,&trans->services) {
srv = list_entry(_p,struct rxrpc_service,link);
if (srv->service_id==sid && try_module_get(srv->owner)) {
list_for_each(_p, &trans->services) {
srv = list_entry(_p, struct rxrpc_service, link);
if (srv->service_id == sid && try_module_get(srv->owner)) {
/* found a match (made sure it won't vanish) */
_debug("found service '%s'",srv->name);
_debug("found service '%s'", srv->name);
call->owner = srv->owner;
break;
}
......@@ -238,7 +245,7 @@ void rxrpc_krxsecd_process_incoming_call(struct rxrpc_message *msg)
* - the func must inc the call's usage count to keep it
*/
ret = -ENOENT;
if (_p!=&trans->services) {
if (_p != &trans->services) {
/* attempt to accept the call */
call->conn->service = srv;
call->app_attn_func = srv->attn_func;
......@@ -248,19 +255,20 @@ void rxrpc_krxsecd_process_incoming_call(struct rxrpc_message *msg)
ret = srv->new_call(call);
/* send an abort if an error occurred */
if (ret<0) {
rxrpc_call_abort(call,ret);
if (ret < 0) {
rxrpc_call_abort(call, ret);
}
else {
/* formally receive and ACK the new packet */
ret = rxrpc_conn_receive_call_packet(call->conn,call,msg);
ret = rxrpc_conn_receive_call_packet(call->conn,
call, msg);
}
}
rxrpc_put_call(call);
out:
if (ret<0)
rxrpc_trans_immediate_abort(trans,msg,ret);
if (ret < 0)
rxrpc_trans_immediate_abort(trans, msg, ret);
_leave(" (%d)",ret);
_leave(" (%d)", ret);
} /* end rxrpc_krxsecd_process_incoming_call() */
......@@ -36,8 +36,8 @@ int rxrpc_krxtimod_start(void)
{
int ret;
ret = kernel_thread(krxtimod,NULL,0);
if (ret<0)
ret = kernel_thread(krxtimod, NULL, 0);
if (ret < 0)
return ret;
wait_for_completion(&krxtimod_alive);
......@@ -64,30 +64,36 @@ void rxrpc_krxtimod_kill(void)
*/
static int krxtimod(void *arg)
{
DECLARE_WAITQUEUE(myself,current);
DECLARE_WAITQUEUE(myself, current);
rxrpc_timer_t *timer;
printk("Started krxtimod %d\n",current->pid);
printk("Started krxtimod %d\n", current->pid);
daemonize("krxtimod");
complete(&krxtimod_alive);
/* only certain signals are of interest */
spin_lock_irq(&current->sighand->siglock);
siginitsetinv(&current->blocked, 0);
recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);
/* loop around looking for things to attend to */
loop:
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&krxtimod_sleepq,&myself);
add_wait_queue(&krxtimod_sleepq, &myself);
for (;;) {
unsigned long jif;
unsigned long timeout;
signed long timeout;
/* deal with the server being asked to die */
if (krxtimod_die) {
remove_wait_queue(&krxtimod_sleepq,&myself);
remove_wait_queue(&krxtimod_sleepq, &myself);
_leave("");
complete_and_exit(&krxtimod_dead,0);
complete_and_exit(&krxtimod_dead, 0);
}
/* discard pending signals */
......@@ -97,18 +103,19 @@ static int krxtimod(void *arg)
spin_lock(&krxtimod_lock);
if (list_empty(&krxtimod_list)) {
timeout = MAX_SCHEDULE_TIMEOUT;
} else {
unsigned long tmo;
}
else {
timer = list_entry(krxtimod_list.next,
rxrpc_timer_t, link);
tmo = timer->timo_jif;
timeout = timer->timo_jif;
jif = jiffies;
if (time_before_eq(tmo,jif))
if (time_before_eq((unsigned long) timeout, jif))
goto immediate;
timeout = (long)tmo - (long)jiffies;
else {
timeout = (long) timeout - (long) jiffies;
}
}
spin_unlock(&krxtimod_lock);
......@@ -118,13 +125,14 @@ static int krxtimod(void *arg)
}
/* the thing on the front of the queue needs processing
* - we come here with the lock held and timer pointing to the expired entry
* - we come here with the lock held and timer pointing to the expired
* entry
*/
immediate:
remove_wait_queue(&krxtimod_sleepq,&myself);
remove_wait_queue(&krxtimod_sleepq, &myself);
set_current_state(TASK_RUNNING);
_debug("@@@ Begin Timeout of %p",timer);
_debug("@@@ Begin Timeout of %p", timer);
/* dequeue the timer */
list_del_init(&timer->link);
......@@ -147,29 +155,30 @@ void rxrpc_krxtimod_add_timer(rxrpc_timer_t *timer, unsigned long timeout)
struct list_head *_p;
rxrpc_timer_t *ptimer;
_enter("%p,%lu",timer,timeout);
_enter("%p,%lu", timer, timeout);
spin_lock(&krxtimod_lock);
list_del(&timer->link);
/* the timer was deferred or reset - put it back in the queue at the right place */
/* the timer was deferred or reset - put it back in the queue at the
* right place */
timer->timo_jif = jiffies + timeout;
list_for_each(_p,&krxtimod_list) {
ptimer = list_entry(_p,rxrpc_timer_t,link);
if (time_before(timer->timo_jif,ptimer->timo_jif))
list_for_each(_p, &krxtimod_list) {
ptimer = list_entry(_p, rxrpc_timer_t, link);
if (time_before(timer->timo_jif, ptimer->timo_jif))
break;
}
list_add_tail(&timer->link,_p); /* insert before stopping point */
list_add_tail(&timer->link, _p); /* insert before stopping point */
spin_unlock(&krxtimod_lock);
wake_up(&krxtimod_sleepq);
_leave("");
} /* end rxrpc_krxtimod_queue_vlocation() */
} /* end rxrpc_krxtimod_add_timer() */
/*****************************************************************************/
/*
......@@ -180,7 +189,7 @@ int rxrpc_krxtimod_del_timer(rxrpc_timer_t *timer)
{
int ret = 0;
_enter("%p",timer);
_enter("%p", timer);
spin_lock(&krxtimod_lock);
......@@ -193,6 +202,6 @@ int rxrpc_krxtimod_del_timer(rxrpc_timer_t *timer)
wake_up(&krxtimod_sleepq);
_leave(" = %d",ret);
_leave(" = %d", ret);
return ret;
} /* end rxrpc_krxtimod_del_timer() */
......@@ -32,7 +32,7 @@ MODULE_DESCRIPTION("Rx RPC implementation");
MODULE_AUTHOR("Red Hat, Inc.");
MODULE_LICENSE("GPL");
u32 rxrpc_epoch;
uint32_t rxrpc_epoch;
/*****************************************************************************/
/*
......@@ -101,11 +101,16 @@ static void __exit rxrpc_cleanup(void)
{
kenter("");
__RXACCT(printk("Outstanding Messages : %d\n",atomic_read(&rxrpc_message_count)));
__RXACCT(printk("Outstanding Calls : %d\n",atomic_read(&rxrpc_call_count)));
__RXACCT(printk("Outstanding Connections: %d\n",atomic_read(&rxrpc_connection_count)));
__RXACCT(printk("Outstanding Peers : %d\n",atomic_read(&rxrpc_peer_count)));
__RXACCT(printk("Outstanding Transports : %d\n",atomic_read(&rxrpc_transport_count)));
__RXACCT(printk("Outstanding Messages : %d\n",
atomic_read(&rxrpc_message_count)));
__RXACCT(printk("Outstanding Calls : %d\n",
atomic_read(&rxrpc_call_count)));
__RXACCT(printk("Outstanding Connections: %d\n",
atomic_read(&rxrpc_connection_count)));
__RXACCT(printk("Outstanding Peers : %d\n",
atomic_read(&rxrpc_peer_count)));
__RXACCT(printk("Outstanding Transports : %d\n",
atomic_read(&rxrpc_transport_count)));
rxrpc_krxsecd_kill();
rxrpc_krxiod_kill();
......@@ -117,11 +122,61 @@ static void __exit rxrpc_cleanup(void)
rxrpc_proc_cleanup();
#endif
__RXACCT(printk("Outstanding Messages : %d\n",atomic_read(&rxrpc_message_count)));
__RXACCT(printk("Outstanding Calls : %d\n",atomic_read(&rxrpc_call_count)));
__RXACCT(printk("Outstanding Connections: %d\n",atomic_read(&rxrpc_connection_count)));
__RXACCT(printk("Outstanding Peers : %d\n",atomic_read(&rxrpc_peer_count)));
__RXACCT(printk("Outstanding Transports : %d\n",atomic_read(&rxrpc_transport_count)));
__RXACCT(printk("Outstanding Messages : %d\n",
atomic_read(&rxrpc_message_count)));
__RXACCT(printk("Outstanding Calls : %d\n",
atomic_read(&rxrpc_call_count)));
__RXACCT(printk("Outstanding Connections: %d\n",
atomic_read(&rxrpc_connection_count)));
__RXACCT(printk("Outstanding Peers : %d\n",
atomic_read(&rxrpc_peer_count)));
__RXACCT(printk("Outstanding Transports : %d\n",
atomic_read(&rxrpc_transport_count)));
kleave("");
} /* end rxrpc_cleanup() */
/*****************************************************************************/
/*
* clear the dead space between task_struct and kernel stack
* - called by supplying -finstrument-functions to gcc
*/
#if 0
void __cyg_profile_func_enter (void *this_fn, void *call_site)
__attribute__((no_instrument_function));
void __cyg_profile_func_enter (void *this_fn, void *call_site)
{
asm volatile(" movl %%esp,%%edi \n"
" andl %0,%%edi \n"
" addl %1,%%edi \n"
" movl %%esp,%%ecx \n"
" subl %%edi,%%ecx \n"
" shrl $2,%%ecx \n"
" movl $0xedededed,%%eax \n"
" rep stosl \n"
:
: "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info))
: "eax", "ecx", "edi", "memory", "cc"
);
}
void __cyg_profile_func_exit(void *this_fn, void *call_site)
__attribute__((no_instrument_function));
void __cyg_profile_func_exit(void *this_fn, void *call_site)
{
asm volatile(" movl %%esp,%%edi \n"
" andl %0,%%edi \n"
" addl %1,%%edi \n"
" movl %%esp,%%ecx \n"
" subl %%edi,%%ecx \n"
" shrl $2,%%ecx \n"
" movl $0xdadadada,%%eax \n"
" rep stosl \n"
:
: "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info))
: "eax", "ecx", "edi", "memory", "cc"
);
}
#endif
This diff is collapsed.
This diff is collapsed.
......@@ -60,6 +60,22 @@ static ctl_table rxrpc_sysctl_table[] = {
.mode = 0644,
.proc_handler = &proc_dointvec
},
{
.ctl_name = 5,
.procname = "peertimo",
.data = &rxrpc_peer_timeout,
.maxlen = sizeof(unsigned long),
.mode = 0644,
.proc_handler = &proc_doulongvec_minmax
},
{
.ctl_name = 6,
.procname = "conntimo",
.data = &rxrpc_conn_timeout,
.maxlen = sizeof(unsigned long),
.mode = 0644,
.proc_handler = &proc_doulongvec_minmax
},
{ .ctl_name = 0 }
};
......@@ -67,6 +83,7 @@ static ctl_table rxrpc_dir_sysctl_table[] = {
{
.ctl_name = 1,
.procname = "rxrpc",
.maxlen = 0,
.mode = 0555,
.child = rxrpc_sysctl_table
},
......@@ -81,7 +98,7 @@ static ctl_table rxrpc_dir_sysctl_table[] = {
int rxrpc_sysctl_init(void)
{
#ifdef CONFIG_SYSCTL
rxrpc_sysctl = register_sysctl_table(rxrpc_dir_sysctl_table,0);
rxrpc_sysctl = register_sysctl_table(rxrpc_dir_sysctl_table, 0);
if (!rxrpc_sysctl)
return -ENOMEM;
#endif /* CONFIG_SYSCTL */
......
This diff is collapsed.
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