* Author: Eric Barton <eric@bartonsoftware.com>
*/
+#include <asm/page.h>
#include "ralnd.h"
void
tx->tx_nob = nob;
tx->tx_buffer = (void *)((unsigned long)(kiov->kiov_offset + offset));
- phys->Address = lnet_page2phys(kiov->kiov_page);
+ phys->Address = page_to_phys(kiov->kiov_page);
phys++;
resid = nob - (kiov->kiov_len - offset);
return -EMSGSIZE;
}
- phys->Address = lnet_page2phys(kiov->kiov_page);
+ phys->Address = page_to_phys(kiov->kiov_page);
phys++;
resid -= PAGE_SIZE;
void
kranal_tx_done (kra_tx_t *tx, int completion)
{
- lnet_msg_t *lnetmsg[2];
- unsigned long flags;
- int i;
+ lnet_msg_t *lnetmsg[2];
+ unsigned long flags;
+ int i;
- LASSERT (!cfs_in_interrupt());
+ LASSERT (!in_interrupt());
- kranal_unmap_buffer(tx);
+ kranal_unmap_buffer(tx);
- lnetmsg[0] = tx->tx_lntmsg[0]; tx->tx_lntmsg[0] = NULL;
- lnetmsg[1] = tx->tx_lntmsg[1]; tx->tx_lntmsg[1] = NULL;
+ lnetmsg[0] = tx->tx_lntmsg[0]; tx->tx_lntmsg[0] = NULL;
+ lnetmsg[1] = tx->tx_lntmsg[1]; tx->tx_lntmsg[1] = NULL;
- tx->tx_buftype = RANAL_BUF_NONE;
- tx->tx_msg.ram_type = RANAL_MSG_NONE;
- tx->tx_conn = NULL;
+ tx->tx_buftype = RANAL_BUF_NONE;
+ tx->tx_msg.ram_type = RANAL_MSG_NONE;
+ tx->tx_conn = NULL;
spin_lock_irqsave(&kranal_data.kra_tx_lock, flags);
- cfs_list_add_tail(&tx->tx_list, &kranal_data.kra_idle_txs);
+ cfs_list_add_tail(&tx->tx_list, &kranal_data.kra_idle_txs);
spin_unlock_irqrestore(&kranal_data.kra_tx_lock, flags);
- /* finalize AFTER freeing lnet msgs */
- for (i = 0; i < 2; i++) {
- if (lnetmsg[i] == NULL)
- continue;
+ /* finalize AFTER freeing lnet msgs */
+ for (i = 0; i < 2; i++) {
+ if (lnetmsg[i] == NULL)
+ continue;
- lnet_finalize(kranal_data.kra_ni, lnetmsg[i], completion);
- }
+ lnet_finalize(kranal_data.kra_ni, lnetmsg[i], completion);
+ }
}
kra_conn_t *
/* NB 'private' is different depending on what we're sending.... */
- CDEBUG(D_NET, "sending %d bytes in %d frags to %s\n",
- nob, niov, libcfs_id2str(target));
+ CDEBUG(D_NET, "sending %d bytes in %d frags to %s\n",
+ nob, niov, libcfs_id2str(target));
- LASSERT (nob == 0 || niov > 0);
- LASSERT (niov <= LNET_MAX_IOV);
+ LASSERT (nob == 0 || niov > 0);
+ LASSERT (niov <= LNET_MAX_IOV);
- LASSERT (!cfs_in_interrupt());
- /* payload is either all vaddrs or all pages */
- LASSERT (!(kiov != NULL && iov != NULL));
+ LASSERT (!in_interrupt());
+ /* payload is either all vaddrs or all pages */
+ LASSERT (!(kiov != NULL && iov != NULL));
- if (routing) {
- CERROR ("Can't route\n");
- return -EIO;
- }
+ if (routing) {
+ CERROR ("Can't route\n");
+ return -EIO;
+ }
switch(type) {
default:
struct iovec *iov, lnet_kiov_t *kiov,
unsigned int offset, unsigned int mlen, unsigned int rlen)
{
- kra_conn_t *conn = private;
- kra_msg_t *rxmsg = conn->rac_rxmsg;
- kra_tx_t *tx;
- void *buffer;
- int rc;
+ kra_conn_t *conn = private;
+ kra_msg_t *rxmsg = conn->rac_rxmsg;
+ kra_tx_t *tx;
+ void *buffer;
+ int rc;
- LASSERT (mlen <= rlen);
- LASSERT (!cfs_in_interrupt());
- /* Either all pages or all vaddrs */
- LASSERT (!(kiov != NULL && iov != NULL));
+ LASSERT (mlen <= rlen);
+ LASSERT (!in_interrupt());
+ /* Either all pages or all vaddrs */
+ LASSERT (!(kiov != NULL && iov != NULL));
- CDEBUG(D_NET, "conn %p, rxmsg %p, lntmsg %p\n", conn, rxmsg, lntmsg);
+ CDEBUG(D_NET, "conn %p, rxmsg %p, lntmsg %p\n", conn, rxmsg, lntmsg);
switch(rxmsg->ram_type) {
default:
int
kranal_thread_start(int(*fn)(void *arg), void *arg, char *name)
{
- cfs_task_t *task = cfs_thread_run(fn, arg, name);
+ struct task_struct *task = cfs_thread_run(fn, arg, name);
if (!IS_ERR(task))
- cfs_atomic_inc(&kranal_data.kra_nthreads);
+ atomic_inc(&kranal_data.kra_nthreads);
return PTR_ERR(task);
}
void
kranal_thread_fini (void)
{
- cfs_atomic_dec(&kranal_data.kra_nthreads);
+ atomic_dec(&kranal_data.kra_nthreads);
}
int
conn->rac_state == RANAL_CONN_CLOSING);
if (!conn->rac_close_sent &&
- cfs_time_aftereq(now, conn->rac_last_tx + conn->rac_keepalive *
- HZ)) {
+ cfs_time_aftereq(now, conn->rac_last_tx +
+ msecs_to_jiffies(conn->rac_keepalive *
+ MSEC_PER_SEC))) {
/* not sent in a while; schedule conn so scheduler sends a keepalive */
CDEBUG(D_NET, "Scheduling keepalive %p->%s\n",
conn, libcfs_nid2str(conn->rac_peer->rap_nid));
kranal_schedule_conn(conn);
}
- timeout = conn->rac_timeout * HZ;
+ timeout = msecs_to_jiffies(conn->rac_timeout * MSEC_PER_SEC);
if (!conn->rac_close_recvd &&
cfs_time_aftereq(now, conn->rac_last_rx + timeout)) {
(conn->rac_state == RANAL_CONN_ESTABLISHED) ?
"Nothing" : "CLOSE not",
libcfs_nid2str(conn->rac_peer->rap_nid),
- (now - conn->rac_last_rx)/HZ);
+ jiffies_to_msecs(now - conn->rac_last_rx)/MSEC_PER_SEC);
return -ETIMEDOUT;
}
spin_unlock_irqrestore(&conn->rac_lock, flags);
CERROR("tx on fmaq for %s blocked %lu seconds\n",
libcfs_nid2str(conn->rac_peer->rap_nid),
- (now - tx->tx_qtime)/HZ);
+ jiffies_to_msecs(now-tx->tx_qtime)/MSEC_PER_SEC);
return -ETIMEDOUT;
}
}
spin_unlock_irqrestore(&conn->rac_lock, flags);
CERROR("tx on rdmaq for %s blocked %lu seconds\n",
libcfs_nid2str(conn->rac_peer->rap_nid),
- (now - tx->tx_qtime)/HZ);
+ jiffies_to_msecs(now-tx->tx_qtime)/MSEC_PER_SEC);
return -ETIMEDOUT;
}
}
spin_unlock_irqrestore(&conn->rac_lock, flags);
CERROR("tx on replyq for %s blocked %lu seconds\n",
libcfs_nid2str(conn->rac_peer->rap_nid),
- (now - tx->tx_qtime)/HZ);
+ jiffies_to_msecs(now-tx->tx_qtime)/MSEC_PER_SEC);
return -ETIMEDOUT;
}
}
conn_index = (conn_index + 1) % conn_entries;
}
- next_check_time += p * HZ;
+ next_check_time += msecs_to_jiffies(p * MSEC_PER_SEC);
spin_lock_irqsave(&kranal_data.kra_reaper_lock, flags);
case RAP_NOT_DONE:
if (cfs_time_aftereq(jiffies,
- conn->rac_last_tx + conn->rac_keepalive *
- HZ))
+ conn->rac_last_tx +
+ msecs_to_jiffies(conn->rac_keepalive *
+ MSEC_PER_SEC)))
CWARN("EAGAIN sending %02x (idle %lu secs)\n",
msg->ram_type,
- (jiffies - conn->rac_last_tx)/HZ);
+ jiffies_to_msecs(jiffies - conn->rac_last_tx) /
+ MSEC_PER_SEC);
return -EAGAIN;
}
}
if (cfs_time_aftereq(jiffies,
conn->rac_last_tx +
- conn->rac_keepalive * HZ)) {
+ msecs_to_jiffies(conn->rac_keepalive *
+ MSEC_PER_SEC))) {
CDEBUG(D_NET, "sending NOOP (rdma in progress)\n");
kranal_init_msg(&conn->rac_msg, RANAL_MSG_NOOP);
kranal_sendmsg(conn, &conn->rac_msg, NULL, 0);
spin_unlock_irqrestore(&conn->rac_lock, flags);
if (cfs_time_aftereq(jiffies,
- conn->rac_last_tx + conn->rac_keepalive *
- HZ)) {
+ conn->rac_last_tx +
+ msecs_to_jiffies(conn->rac_keepalive *
+ MSEC_PER_SEC))) {
CDEBUG(D_NET, "sending NOOP -> %s (%p idle %lu(%ld))\n",
libcfs_nid2str(conn->rac_peer->rap_nid), conn,
- (jiffies - conn->rac_last_tx)/HZ,
+ jiffies_to_msecs(jiffies - conn->rac_last_tx) /
+ MSEC_PER_SEC,
conn->rac_keepalive);
kranal_init_msg(&conn->rac_msg, RANAL_MSG_NOOP);
kranal_sendmsg(conn, &conn->rac_msg, NULL, 0);
LASSERT (rrc == RAP_NOT_DONE);
if (!cfs_time_aftereq(jiffies, conn->rac_last_tx +
- conn->rac_timeout * HZ))
+ msecs_to_jiffies(conn->rac_timeout*MSEC_PER_SEC)))
return -EAGAIN;
/* Too late */
/* retry with exponential backoff until HZ */
if (conn->rac_keepalive == 0)
conn->rac_keepalive = 1;
- else if (conn->rac_keepalive <= HZ)
+ else if (conn->rac_keepalive <=
+ msecs_to_jiffies(MSEC_PER_SEC))
conn->rac_keepalive *= 2;
else
- conn->rac_keepalive += HZ;
+ conn->rac_keepalive +=
+ msecs_to_jiffies(MSEC_PER_SEC);
deadline = conn->rac_last_tx + conn->rac_keepalive;
spin_lock_irqsave(&dev->rad_lock, flags);