Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158997
b: refs/heads/master
c: 02a6a25
h: refs/heads/master
i:
  158995: a3a19db
v: v3
  • Loading branch information
Andy Grover authored and David S. Miller committed Jul 20, 2009
1 parent 4d4b81d commit cc63f9d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ddbcfa098bae757d3760dd1dbf2847a0bd5a525
refs/heads/master: 02a6a2592e41d27644d647f3bce23598649961bc
12 changes: 10 additions & 2 deletions trunk/net/rds/ib.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,17 +358,25 @@ extern ctl_table rds_ib_sysctl_table[];
/*
* Helper functions for getting/setting the header and data SGEs in
* RDS packets (not RDMA)
*
* From version 3.1 onwards, header is in front of data in the sge.
*/
static inline struct ib_sge *
rds_ib_header_sge(struct rds_ib_connection *ic, struct ib_sge *sge)
{
return &sge[0];
if (ic->conn->c_version > RDS_PROTOCOL_3_0)
return &sge[0];
else
return &sge[1];
}

static inline struct ib_sge *
rds_ib_data_sge(struct rds_ib_connection *ic, struct ib_sge *sge)
{
return &sge[1];
if (ic->conn->c_version > RDS_PROTOCOL_3_0)
return &sge[1];
else
return &sge[0];
}

#endif
9 changes: 6 additions & 3 deletions trunk/net/rds/ib_cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ void rds_ib_cm_connect_complete(struct rds_connection *conn, struct rdma_cm_even
if (event->param.conn.private_data_len >= sizeof(*dp)) {
dp = event->param.conn.private_data;

rds_ib_set_protocol(conn,
/* make sure it isn't empty data */
if (dp->dp_protocol_major) {
rds_ib_set_protocol(conn,
RDS_PROTOCOL(dp->dp_protocol_major,
dp->dp_protocol_minor));
rds_ib_set_flow_control(conn, be32_to_cpu(dp->dp_credit));
dp->dp_protocol_minor));
rds_ib_set_flow_control(conn, be32_to_cpu(dp->dp_credit));
}
}

printk(KERN_NOTICE "RDS/IB: connected to %pI4 version %u.%u%s\n",
Expand Down
43 changes: 42 additions & 1 deletion trunk/net/rds/ib_recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,47 @@ u64 rds_ib_piggyb_ack(struct rds_ib_connection *ic)
return rds_ib_get_ack(ic);
}

static struct rds_header *rds_ib_get_header(struct rds_connection *conn,
struct rds_ib_recv_work *recv,
u32 data_len)
{
struct rds_ib_connection *ic = conn->c_transport_data;
void *hdr_buff = &ic->i_recv_hdrs[recv - ic->i_recvs];
void *addr;
u32 misplaced_hdr_bytes;

/*
* Support header at the front (RDS 3.1+) as well as header-at-end.
*
* Cases:
* 1) header all in header buff (great!)
* 2) header all in data page (copy all to header buff)
* 3) header split across hdr buf + data page
* (move bit in hdr buff to end before copying other bit from data page)
*/
if (conn->c_version > RDS_PROTOCOL_3_0 || data_len == RDS_FRAG_SIZE)
return hdr_buff;

if (data_len <= (RDS_FRAG_SIZE - sizeof(struct rds_header))) {
addr = kmap_atomic(recv->r_frag->f_page, KM_SOFTIRQ0);
memcpy(hdr_buff,
addr + recv->r_frag->f_offset + data_len,
sizeof(struct rds_header));
kunmap_atomic(addr, KM_SOFTIRQ0);
return hdr_buff;
}

misplaced_hdr_bytes = (sizeof(struct rds_header) - (RDS_FRAG_SIZE - data_len));

memmove(hdr_buff + misplaced_hdr_bytes, hdr_buff, misplaced_hdr_bytes);

addr = kmap_atomic(recv->r_frag->f_page, KM_SOFTIRQ0);
memcpy(hdr_buff, addr + recv->r_frag->f_offset + data_len,
sizeof(struct rds_header) - misplaced_hdr_bytes);
kunmap_atomic(addr, KM_SOFTIRQ0);
return hdr_buff;
}

/*
* It's kind of lame that we're copying from the posted receive pages into
* long-lived bitmaps. We could have posted the bitmaps and rdma written into
Expand Down Expand Up @@ -667,7 +708,7 @@ static void rds_ib_process_recv(struct rds_connection *conn,
}
byte_len -= sizeof(struct rds_header);

ihdr = &ic->i_recv_hdrs[recv - ic->i_recvs];
ihdr = rds_ib_get_header(conn, recv, byte_len);

/* Validate the checksum. */
if (!rds_message_verify_checksum(ihdr)) {
Expand Down

0 comments on commit cc63f9d

Please sign in to comment.