Commit 9bb50192 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] rxrpc endianness annotations

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5727c513
......@@ -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 */
uint32_t chan_ix; /* connection channel index (net order) */
uint32_t call_id; /* call ID on connection (net order) */
__be32 chan_ix; /* connection channel index */
__be32 call_id; /* call ID on connection */
unsigned long cjif; /* jiffies at call creation */
unsigned long flags; /* control flags */
#define RXRPC_CALL_ACKS_TIMO 0x00000001 /* ACKS timeout reached */
......@@ -97,7 +97,7 @@ struct rxrpc_call
rxrpc_seq_t ackr_win_bot; /* bottom of ACK window */
rxrpc_seq_t ackr_win_top; /* top of ACK window */
rxrpc_seq_t ackr_high_seq; /* highest seqno yet received */
rxrpc_seq_t ackr_prev_seq; /* previous seqno received */
rxrpc_seq_net_t ackr_prev_seq; /* previous seqno received */
unsigned ackr_pend_cnt; /* number of pending ACKs */
struct timer_list ackr_dfr_timo; /* timeout on deferred ACK */
char ackr_dfr_perm; /* request for deferred ACKs permitted */
......
......@@ -45,18 +45,18 @@ struct rxrpc_connection
rxrpc_serial_t serial_counter; /* packet serial number counter */
/* the following should all be in net order */
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 */
__be32 in_epoch; /* peer's epoch */
__be32 out_epoch; /* my epoch */
__be32 conn_id; /* connection ID, appropriately shifted */
__be16 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,
uint16_t port,
uint32_t addr,
__be16 port,
__be32 addr,
uint16_t service_id,
void *security,
struct rxrpc_connection **_conn);
......
......@@ -27,19 +27,19 @@ extern size_t RXRPC_MAX_PACKET_SIZE;
*/
struct rxrpc_header
{
uint32_t epoch; /* client boot timestamp */
__be32 epoch; /* client boot timestamp */
uint32_t cid; /* connection and channel ID */
__be32 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 */
uint32_t callNumber; /* call ID (0 for connection-level packets) */
__be32 callNumber; /* call ID (0 for connection-level packets) */
#define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */
uint32_t seq; /* sequence number of pkt in call stream */
uint32_t serial; /* serial number of pkt sent to network */
__be32 seq; /* sequence number of pkt in call stream */
__be32 serial; /* serial number of pkt sent to network */
uint8_t type; /* packet type */
#define RXRPC_PACKET_TYPE_DATA 1 /* data */
......@@ -62,8 +62,8 @@ struct rxrpc_header
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 */
__be16 _rsvd; /* reserved (used by kerberos security as cksum) */
__be16 serviceId; /* service ID */
} __attribute__((packed));
......@@ -85,7 +85,7 @@ struct rxrpc_jumbo_header
{
uint8_t flags; /* packet flags (as per rxrpc_header) */
uint8_t pad;
uint16_t _rsvd; /* reserved (used by kerberos security as cksum) */
__be16 _rsvd; /* reserved (used by kerberos security as cksum) */
};
#define RXRPC_JUMBO_DATALEN 1412 /* non-terminal jumbo packet data length */
......@@ -97,12 +97,12 @@ struct rxrpc_jumbo_header
*/
struct rxrpc_ackpacket
{
uint16_t bufferSpace; /* number of packet buffers available */
uint16_t maxSkew; /* diff between serno being ACK'd and highest serial no
__be16 bufferSpace; /* number of packet buffers available */
__be16 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 */
__be32 firstPacket; /* sequence no of first ACK'd packet in attached list */
__be32 previousPacket; /* sequence no of previous packet received */
__be32 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 */
......
......@@ -67,7 +67,7 @@ struct rxrpc_peer
extern int rxrpc_peer_lookup(struct rxrpc_transport *trans,
u32 addr,
__be32 addr,
struct rxrpc_peer **_peer);
static inline void rxrpc_get_peer(struct rxrpc_peer *peer)
......
......@@ -14,7 +14,7 @@
#ifdef __KERNEL__
extern uint32_t rxrpc_epoch;
extern __be32 rxrpc_epoch;
#ifdef CONFIG_SYSCTL
extern int rxrpc_ktrace;
......
......@@ -21,6 +21,8 @@
typedef uint32_t rxrpc_seq_t; /* Rx message sequence number */
typedef uint32_t rxrpc_serial_t; /* Rx message serial number */
typedef __be32 rxrpc_seq_net_t; /* on-the-wire Rx message sequence number */
typedef __be32 rxrpc_serial_net_t; /* on-the-wire Rx message serial number */
struct rxrpc_call;
struct rxrpc_connection;
......
......@@ -472,7 +472,7 @@ static inline int __rxrpc_call_gen_normal_ACK(struct rxrpc_call *call,
{
struct rxrpc_message *msg;
struct kvec diov[3];
unsigned aux[4];
__be32 aux[4];
int delta, ret;
/* ACKs default to DELAY */
......@@ -840,7 +840,7 @@ static int __rxrpc_call_abort(struct rxrpc_call *call, int errno)
struct rxrpc_message *msg;
struct kvec diov[1];
int ret;
u32 _error;
__be32 _error;
_enter("%p{%08x},%p{%d},%d",
conn, ntohl(conn->conn_id), call, ntohl(call->call_id), errno);
......@@ -986,7 +986,7 @@ static void rxrpc_call_receive_packet(struct rxrpc_call *call)
/* deal with abort packets */
case RXRPC_PACKET_TYPE_ABORT: {
uint32_t _dbuf, *dp;
__be32 _dbuf, *dp;
dp = skb_header_pointer(msg->pkt, msg->offset,
sizeof(_dbuf), &_dbuf);
......@@ -1048,7 +1048,7 @@ static void rxrpc_call_receive_data_packet(struct rxrpc_call *call,
struct rxrpc_message *pmsg;
struct list_head *_p;
int ret, lo, hi, rmtimo;
u32 opid;
__be32 opid;
_enter("%p{%u},%p{%u}", call, ntohl(call->call_id), msg, msg->seq);
......@@ -1270,7 +1270,7 @@ static void rxrpc_call_receive_ack_packet(struct rxrpc_call *call,
struct rxrpc_message *msg)
{
struct rxrpc_ackpacket _ack, *ap;
rxrpc_serial_t serial;
rxrpc_serial_net_t serial;
rxrpc_seq_t seq;
int ret;
......
......@@ -88,8 +88,8 @@ static inline int __rxrpc_create_connection(struct rxrpc_peer *peer,
* create a new connection record for outgoing connections
*/
int rxrpc_create_connection(struct rxrpc_transport *trans,
uint16_t port,
uint32_t addr,
__be16 port,
__be32 addr,
uint16_t service_id,
void *security,
struct rxrpc_connection **_conn)
......@@ -97,7 +97,7 @@ int rxrpc_create_connection(struct rxrpc_transport *trans,
struct rxrpc_connection *candidate, *conn;
struct rxrpc_peer *peer;
struct list_head *_p;
uint32_t connid;
__be32 connid;
int ret;
_enter("%p{%hu},%u,%hu", trans, trans->port, ntohs(port), service_id);
......@@ -169,7 +169,7 @@ int rxrpc_create_connection(struct rxrpc_transport *trans,
spin_unlock(&peer->conn_gylock);
/* pick the new candidate */
_debug("created connection: {%08x} [out]", htonl(candidate->conn_id));
_debug("created connection: {%08x} [out]", ntohl(candidate->conn_id));
atomic_inc(&peer->conn_count);
conn = candidate;
candidate = NULL;
......@@ -199,7 +199,7 @@ int rxrpc_create_connection(struct rxrpc_transport *trans,
/* handle resurrecting a connection from the graveyard */
found_in_graveyard:
_debug("resurrecting connection: {%08x} [out]", htonl(conn->conn_id));
_debug("resurrecting connection: {%08x} [out]", ntohl(conn->conn_id));
rxrpc_get_connection(conn);
rxrpc_krxtimod_del_timer(&conn->timeout);
list_del_init(&conn->link);
......@@ -219,8 +219,9 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer,
struct rxrpc_connection *conn, *candidate = NULL;
struct list_head *_p;
int ret, fresh = 0;
u32 x_epoch, x_connid;
u16 x_port, x_secix, x_servid;
__be32 x_epoch, x_connid;
__be16 x_port, x_servid;
__u32 x_secix;
u8 x_clflag;
_enter("%p{{%hu}},%u,%hu",
......@@ -310,7 +311,7 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer,
}
/* we can now add the new candidate to the list */
_debug("created connection: {%08x} [in]", htonl(candidate->conn_id));
_debug("created connection: {%08x} [in]", ntohl(candidate->conn_id));
rxrpc_get_peer(peer);
conn = candidate;
candidate = NULL;
......@@ -351,7 +352,7 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer,
/* handle resurrecting a connection from the graveyard */
found_in_graveyard:
_debug("resurrecting connection: {%08x} [in]", htonl(conn->conn_id));
_debug("resurrecting connection: {%08x} [in]", ntohl(conn->conn_id));
rxrpc_get_peer(peer);
rxrpc_get_connection(conn);
rxrpc_krxtimod_del_timer(&conn->timeout);
......@@ -397,7 +398,7 @@ void rxrpc_put_connection(struct rxrpc_connection *conn)
}
/* move to graveyard queue */
_debug("burying connection: {%08x}", htonl(conn->conn_id));
_debug("burying connection: {%08x}", ntohl(conn->conn_id));
list_del(&conn->link);
list_add_tail(&conn->link, &peer->conn_graveyard);
......@@ -442,7 +443,7 @@ void rxrpc_conn_do_timeout(struct rxrpc_connection *conn)
}
_debug("--- Destroying Connection %p{%08x} ---",
conn, htonl(conn->conn_id));
conn, ntohl(conn->conn_id));
down_write(&rxrpc_conns_sem);
list_del(&conn->proc_link);
......@@ -640,8 +641,8 @@ int rxrpc_conn_sendmsg(struct rxrpc_connection *conn,
_net("Sending message type %d of %Zd bytes to %08x:%d",
msg->hdr.type,
msg->dsize,
htonl(conn->addr.sin_addr.s_addr),
htons(conn->addr.sin_port));
ntohl(conn->addr.sin_addr.s_addr),
ntohs(conn->addr.sin_port));
/* send the message */
ret = kernel_sendmsg(conn->trans->socket, &msghdr,
......@@ -699,11 +700,11 @@ int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn,
}
_proto("Received packet %%%u [%u] on call %hu:%u:%u",
htonl(msg->hdr.serial),
htonl(msg->hdr.seq),
htons(msg->hdr.serviceId),
htonl(conn->conn_id),
htonl(call->call_id));
ntohl(msg->hdr.serial),
ntohl(msg->hdr.seq),
ntohs(msg->hdr.serviceId),
ntohl(conn->conn_id),
ntohl(call->call_id));
call->pkt_rcv_count++;
......
......@@ -32,7 +32,7 @@ MODULE_DESCRIPTION("Rx RPC implementation");
MODULE_AUTHOR("Red Hat, Inc.");
MODULE_LICENSE("GPL");
uint32_t rxrpc_epoch;
__be32 rxrpc_epoch;
/*****************************************************************************/
/*
......
......@@ -48,7 +48,7 @@ static const struct rxrpc_timer_ops rxrpc_peer_timer_ops = {
/*
* create a peer record
*/
static int __rxrpc_create_peer(struct rxrpc_transport *trans, uint32_t addr,
static int __rxrpc_create_peer(struct rxrpc_transport *trans, __be32 addr,
struct rxrpc_peer **_peer)
{
struct rxrpc_peer *peer;
......@@ -96,7 +96,7 @@ static int __rxrpc_create_peer(struct rxrpc_transport *trans, uint32_t addr,
* - returns (if successful) with peer record usage incremented
* - resurrects it from the graveyard if found there
*/
int rxrpc_peer_lookup(struct rxrpc_transport *trans, uint32_t addr,
int rxrpc_peer_lookup(struct rxrpc_transport *trans, __be32 addr,
struct rxrpc_peer **_peer)
{
struct rxrpc_peer *peer, *candidate = NULL;
......
......@@ -457,8 +457,8 @@ void rxrpc_trans_receive_packet(struct rxrpc_transport *trans)
struct rxrpc_peer *peer;
struct sk_buff *pkt;
int ret;
u32 addr;
u16 port;
__be32 addr;
__be16 port;
LIST_HEAD(msgq);
......@@ -612,7 +612,7 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
struct sockaddr_in sin;
struct msghdr msghdr;
struct kvec iov[2];
uint32_t _error;
__be32 _error;
int len, ret;
_enter("%p,%p,%d", trans, msg, error);
......@@ -655,8 +655,8 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
_net("Sending message type %d of %d bytes to %08x:%d",
ahdr.type,
len,
htonl(sin.sin_addr.s_addr),
htons(sin.sin_port));
ntohl(sin.sin_addr.s_addr),
ntohs(sin.sin_port));
/* send the message */
ret = kernel_sendmsg(trans->socket, &msghdr, iov, 2, len);
......@@ -678,7 +678,7 @@ static void rxrpc_trans_receive_error_report(struct rxrpc_transport *trans)
struct list_head connq, *_p;
struct errormsg emsg;
struct msghdr msg;
uint16_t port;
__be16 port;
int local, err;
_enter("%p", trans);
......
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