rxrpc: Pass sk_buff * rather than rxrpc_host_header * to functions
Pass a pointer to struct sk_buff rather than struct rxrpc_host_header to functions so that they can in the future get at transport protocol parameters rather than just RxRPC parameters. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
@@ -544,7 +544,7 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *,
|
|||||||
unsigned long, gfp_t);
|
unsigned long, gfp_t);
|
||||||
struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *,
|
struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *,
|
||||||
struct rxrpc_connection *,
|
struct rxrpc_connection *,
|
||||||
struct rxrpc_host_header *);
|
struct sk_buff *);
|
||||||
void rxrpc_release_call(struct rxrpc_call *);
|
void rxrpc_release_call(struct rxrpc_call *);
|
||||||
void rxrpc_release_calls_on_socket(struct rxrpc_sock *);
|
void rxrpc_release_calls_on_socket(struct rxrpc_sock *);
|
||||||
void __rxrpc_put_call(struct rxrpc_call *);
|
void __rxrpc_put_call(struct rxrpc_call *);
|
||||||
@@ -574,9 +574,9 @@ int rxrpc_connect_call(struct rxrpc_sock *, struct rxrpc_conn_parameters *,
|
|||||||
void rxrpc_put_connection(struct rxrpc_connection *);
|
void rxrpc_put_connection(struct rxrpc_connection *);
|
||||||
void __exit rxrpc_destroy_all_connections(void);
|
void __exit rxrpc_destroy_all_connections(void);
|
||||||
struct rxrpc_connection *rxrpc_find_connection(struct rxrpc_transport *,
|
struct rxrpc_connection *rxrpc_find_connection(struct rxrpc_transport *,
|
||||||
struct rxrpc_host_header *);
|
struct sk_buff *);
|
||||||
extern struct rxrpc_connection *
|
extern struct rxrpc_connection *
|
||||||
rxrpc_incoming_connection(struct rxrpc_transport *, struct rxrpc_host_header *);
|
rxrpc_incoming_connection(struct rxrpc_transport *, struct sk_buff *);
|
||||||
|
|
||||||
static inline bool rxrpc_conn_is_client(const struct rxrpc_connection *conn)
|
static inline bool rxrpc_conn_is_client(const struct rxrpc_connection *conn)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
conn = rxrpc_incoming_connection(trans, &sp->hdr);
|
conn = rxrpc_incoming_connection(trans, skb);
|
||||||
rxrpc_put_transport(trans);
|
rxrpc_put_transport(trans);
|
||||||
if (IS_ERR(conn)) {
|
if (IS_ERR(conn)) {
|
||||||
_debug("no conn");
|
_debug("no conn");
|
||||||
@@ -118,7 +118,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
call = rxrpc_incoming_call(rx, conn, &sp->hdr);
|
call = rxrpc_incoming_call(rx, conn, skb);
|
||||||
rxrpc_put_connection(conn);
|
rxrpc_put_connection(conn);
|
||||||
if (IS_ERR(call)) {
|
if (IS_ERR(call)) {
|
||||||
_debug("no call");
|
_debug("no call");
|
||||||
|
|||||||
@@ -421,8 +421,9 @@ found_user_ID_now_present:
|
|||||||
*/
|
*/
|
||||||
struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *rx,
|
struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *rx,
|
||||||
struct rxrpc_connection *conn,
|
struct rxrpc_connection *conn,
|
||||||
struct rxrpc_host_header *hdr)
|
struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
|
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
|
||||||
struct rxrpc_call *call, *candidate;
|
struct rxrpc_call *call, *candidate;
|
||||||
struct rb_node **p, *parent;
|
struct rb_node **p, *parent;
|
||||||
u32 call_id;
|
u32 call_id;
|
||||||
@@ -437,9 +438,9 @@ struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *rx,
|
|||||||
|
|
||||||
candidate->socket = rx;
|
candidate->socket = rx;
|
||||||
candidate->conn = conn;
|
candidate->conn = conn;
|
||||||
candidate->cid = hdr->cid;
|
candidate->cid = sp->hdr.cid;
|
||||||
candidate->call_id = hdr->callNumber;
|
candidate->call_id = sp->hdr.callNumber;
|
||||||
candidate->channel = hdr->cid & RXRPC_CHANNELMASK;
|
candidate->channel = sp->hdr.cid & RXRPC_CHANNELMASK;
|
||||||
candidate->rx_data_post = 0;
|
candidate->rx_data_post = 0;
|
||||||
candidate->state = RXRPC_CALL_SERVER_ACCEPTING;
|
candidate->state = RXRPC_CALL_SERVER_ACCEPTING;
|
||||||
if (conn->security_ix > 0)
|
if (conn->security_ix > 0)
|
||||||
@@ -450,7 +451,7 @@ struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *rx,
|
|||||||
/* set the channel for this call */
|
/* set the channel for this call */
|
||||||
call = conn->channels[candidate->channel];
|
call = conn->channels[candidate->channel];
|
||||||
_debug("channel[%u] is %p", candidate->channel, call);
|
_debug("channel[%u] is %p", candidate->channel, call);
|
||||||
if (call && call->call_id == hdr->callNumber) {
|
if (call && call->call_id == sp->hdr.callNumber) {
|
||||||
/* already set; must've been a duplicate packet */
|
/* already set; must've been a duplicate packet */
|
||||||
_debug("extant call [%d]", call->state);
|
_debug("extant call [%d]", call->state);
|
||||||
ASSERTCMP(call->conn, ==, conn);
|
ASSERTCMP(call->conn, ==, conn);
|
||||||
@@ -488,7 +489,7 @@ struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *rx,
|
|||||||
|
|
||||||
/* check the call number isn't duplicate */
|
/* check the call number isn't duplicate */
|
||||||
_debug("check dup");
|
_debug("check dup");
|
||||||
call_id = hdr->callNumber;
|
call_id = sp->hdr.callNumber;
|
||||||
p = &conn->calls.rb_node;
|
p = &conn->calls.rb_node;
|
||||||
parent = NULL;
|
parent = NULL;
|
||||||
while (*p) {
|
while (*p) {
|
||||||
|
|||||||
@@ -588,10 +588,10 @@ interrupted:
|
|||||||
* get a record of an incoming connection
|
* get a record of an incoming connection
|
||||||
*/
|
*/
|
||||||
struct rxrpc_connection *
|
struct rxrpc_connection *
|
||||||
rxrpc_incoming_connection(struct rxrpc_transport *trans,
|
rxrpc_incoming_connection(struct rxrpc_transport *trans, struct sk_buff *skb)
|
||||||
struct rxrpc_host_header *hdr)
|
|
||||||
{
|
{
|
||||||
struct rxrpc_connection *conn, *candidate = NULL;
|
struct rxrpc_connection *conn, *candidate = NULL;
|
||||||
|
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
|
||||||
struct rb_node *p, **pp;
|
struct rb_node *p, **pp;
|
||||||
const char *new = "old";
|
const char *new = "old";
|
||||||
__be32 epoch;
|
__be32 epoch;
|
||||||
@@ -599,10 +599,10 @@ rxrpc_incoming_connection(struct rxrpc_transport *trans,
|
|||||||
|
|
||||||
_enter("");
|
_enter("");
|
||||||
|
|
||||||
ASSERT(hdr->flags & RXRPC_CLIENT_INITIATED);
|
ASSERT(sp->hdr.flags & RXRPC_CLIENT_INITIATED);
|
||||||
|
|
||||||
epoch = hdr->epoch;
|
epoch = sp->hdr.epoch;
|
||||||
cid = hdr->cid & RXRPC_CIDMASK;
|
cid = sp->hdr.cid & RXRPC_CIDMASK;
|
||||||
|
|
||||||
/* search the connection list first */
|
/* search the connection list first */
|
||||||
read_lock_bh(&trans->conn_lock);
|
read_lock_bh(&trans->conn_lock);
|
||||||
@@ -636,13 +636,13 @@ rxrpc_incoming_connection(struct rxrpc_transport *trans,
|
|||||||
|
|
||||||
candidate->trans = trans;
|
candidate->trans = trans;
|
||||||
candidate->proto.local = trans->local;
|
candidate->proto.local = trans->local;
|
||||||
candidate->proto.epoch = hdr->epoch;
|
candidate->proto.epoch = sp->hdr.epoch;
|
||||||
candidate->proto.cid = hdr->cid & RXRPC_CIDMASK;
|
candidate->proto.cid = sp->hdr.cid & RXRPC_CIDMASK;
|
||||||
candidate->proto.in_clientflag = RXRPC_CLIENT_INITIATED;
|
candidate->proto.in_clientflag = RXRPC_CLIENT_INITIATED;
|
||||||
candidate->params.local = trans->local;
|
candidate->params.local = trans->local;
|
||||||
candidate->params.peer = trans->peer;
|
candidate->params.peer = trans->peer;
|
||||||
candidate->params.service_id = hdr->serviceId;
|
candidate->params.service_id = sp->hdr.serviceId;
|
||||||
candidate->security_ix = hdr->securityIndex;
|
candidate->security_ix = sp->hdr.securityIndex;
|
||||||
candidate->out_clientflag = 0;
|
candidate->out_clientflag = 0;
|
||||||
candidate->state = RXRPC_CONN_SERVER;
|
candidate->state = RXRPC_CONN_SERVER;
|
||||||
if (candidate->params.service_id)
|
if (candidate->params.service_id)
|
||||||
@@ -691,7 +691,7 @@ success:
|
|||||||
|
|
||||||
/* we found the connection in the list immediately */
|
/* we found the connection in the list immediately */
|
||||||
found_extant_connection:
|
found_extant_connection:
|
||||||
if (hdr->securityIndex != conn->security_ix) {
|
if (sp->hdr.securityIndex != conn->security_ix) {
|
||||||
read_unlock_bh(&trans->conn_lock);
|
read_unlock_bh(&trans->conn_lock);
|
||||||
goto security_mismatch;
|
goto security_mismatch;
|
||||||
}
|
}
|
||||||
@@ -701,7 +701,7 @@ found_extant_connection:
|
|||||||
|
|
||||||
/* we found the connection on the second time through the list */
|
/* we found the connection on the second time through the list */
|
||||||
found_extant_second:
|
found_extant_second:
|
||||||
if (hdr->securityIndex != conn->security_ix) {
|
if (sp->hdr.securityIndex != conn->security_ix) {
|
||||||
write_unlock_bh(&trans->conn_lock);
|
write_unlock_bh(&trans->conn_lock);
|
||||||
goto security_mismatch;
|
goto security_mismatch;
|
||||||
}
|
}
|
||||||
@@ -721,20 +721,21 @@ security_mismatch:
|
|||||||
* packet
|
* packet
|
||||||
*/
|
*/
|
||||||
struct rxrpc_connection *rxrpc_find_connection(struct rxrpc_transport *trans,
|
struct rxrpc_connection *rxrpc_find_connection(struct rxrpc_transport *trans,
|
||||||
struct rxrpc_host_header *hdr)
|
struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct rxrpc_connection *conn;
|
struct rxrpc_connection *conn;
|
||||||
|
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
|
||||||
struct rb_node *p;
|
struct rb_node *p;
|
||||||
u32 epoch, cid;
|
u32 epoch, cid;
|
||||||
|
|
||||||
_enter(",{%x,%x}", hdr->cid, hdr->flags);
|
_enter(",{%x,%x}", sp->hdr.cid, sp->hdr.flags);
|
||||||
|
|
||||||
read_lock_bh(&trans->conn_lock);
|
read_lock_bh(&trans->conn_lock);
|
||||||
|
|
||||||
cid = hdr->cid & RXRPC_CIDMASK;
|
cid = sp->hdr.cid & RXRPC_CIDMASK;
|
||||||
epoch = hdr->epoch;
|
epoch = sp->hdr.epoch;
|
||||||
|
|
||||||
if (hdr->flags & RXRPC_CLIENT_INITIATED)
|
if (sp->hdr.flags & RXRPC_CLIENT_INITIATED)
|
||||||
p = trans->server_conns.rb_node;
|
p = trans->server_conns.rb_node;
|
||||||
else
|
else
|
||||||
p = trans->client_conns.rb_node;
|
p = trans->client_conns.rb_node;
|
||||||
|
|||||||
@@ -628,8 +628,7 @@ int rxrpc_extract_header(struct rxrpc_skb_priv *sp, struct sk_buff *skb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct rxrpc_connection *rxrpc_conn_from_local(struct rxrpc_local *local,
|
static struct rxrpc_connection *rxrpc_conn_from_local(struct rxrpc_local *local,
|
||||||
struct sk_buff *skb,
|
struct sk_buff *skb)
|
||||||
struct rxrpc_skb_priv *sp)
|
|
||||||
{
|
{
|
||||||
struct rxrpc_peer *peer;
|
struct rxrpc_peer *peer;
|
||||||
struct rxrpc_transport *trans;
|
struct rxrpc_transport *trans;
|
||||||
@@ -647,7 +646,7 @@ static struct rxrpc_connection *rxrpc_conn_from_local(struct rxrpc_local *local,
|
|||||||
if (!trans)
|
if (!trans)
|
||||||
goto cant_find_conn;
|
goto cant_find_conn;
|
||||||
|
|
||||||
conn = rxrpc_find_connection(trans, &sp->hdr);
|
conn = rxrpc_find_connection(trans, skb);
|
||||||
rxrpc_put_transport(trans);
|
rxrpc_put_transport(trans);
|
||||||
if (!conn)
|
if (!conn)
|
||||||
goto cant_find_conn;
|
goto cant_find_conn;
|
||||||
@@ -739,7 +738,7 @@ void rxrpc_data_ready(struct sock *sk)
|
|||||||
* old-fashioned way doesn't really hurt */
|
* old-fashioned way doesn't really hurt */
|
||||||
struct rxrpc_connection *conn;
|
struct rxrpc_connection *conn;
|
||||||
|
|
||||||
conn = rxrpc_conn_from_local(local, skb, sp);
|
conn = rxrpc_conn_from_local(local, skb);
|
||||||
if (!conn)
|
if (!conn)
|
||||||
goto cant_route_call;
|
goto cant_route_call;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user