Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | net/sctp/ulpqueue.c | void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq, gfp_t gfp) {
struct sctp_ulpevent *event;
struct sctp_association *asoc;
struct sctp_sock *sp;
__u32 ctsn;
struct sk_buff *skb;
asoc = ulpq->asoc;
sp = sctp_sk(asoc->base.sk);
if (ulpq->pd_mode)
return;
/* Data must be at or below the Cumu... | [
0,
0
] |
Linux Kernel | net/sctp/ulpqueue.c | void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
gfp_t gfp) {
struct sctp_association *asoc = ulpq->asoc;
__u32 freed = 0;
__u16 needed;
needed = ntohs(chunk->chunk_hdr->length) - sizeof(struct sctp_data_chunk);
if (skb_queue_empty(&asoc->base.sk->sk_receive_queu... | [
1,
0
] |
Linux Kernel | net/sctp/ulpqueue.c | void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, gfp_t gfp) {
struct sctp_ulpevent *ev = NULL;
struct sctp_sock *sp;
struct sock *sk;
if (!ulpq->pd_mode)
return;
sk = ulpq->asoc->base.sk;
sp = sctp_sk(sk);
if (sctp_ulpevent_type_enabled(ulpq->asoc->subscribe,
SCTP_PAR... | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c |
static void smc_set_keepalive(struct sock *sk, int val) {
struct smc_sock *smc = smc_sk(sk);
smc->clcsock->sk->sk_prot->keepalive(smc->clcsock->sk, val);
} | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c | static void smc_release_cb(struct sock *sk) {
struct smc_sock *smc = smc_sk(sk);
if (smc->conn.tx_in_release_sock) {
smc_tx_pending(&smc->conn);
smc->conn.tx_in_release_sock = false;
}
} | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c |
static void smc_fback_restore_callbacks(struct smc_sock *smc) {
struct sock *clcsk = smc->clcsock->sk;
write_lock_bh(&clcsk->sk_callback_lock);
clcsk->sk_user_data = NULL;
smc_clcsock_restore_cb(&clcsk->sk_state_change, &smc->clcsk_state_change);
smc_clcsock_restore_cb(&clcsk->sk_data_ready, &smc->clcsk_da... | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c | static struct sock *smc_sock_alloc(struct net *net, struct socket *sock,
int protocol) {
struct smc_sock *smc;
struct proto *prot;
struct sock *sk;
prot = (protocol == SMCPROTO_SMC6) ? &smc_proto6 : &smc_proto;
sk = sk_alloc(net, PF_SMC, GFP_KERNEL, prot, 0);
if (!sk)
... | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c | static int smc_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) {
struct sockaddr_in *addr = (struct sockaddr_in *)uaddr;
struct sock *sk = sock->sk;
struct smc_sock *smc;
int rc;
smc = smc_sk(sk);
rc = -EINVAL;
if (addr_len < sizeof(struct sockaddr_in))
goto out;
rc = -EAFNOSUPPOR... | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c | static void smc_copy_sock_settings_to_smc(struct smc_sock *smc) {
smc_copy_sock_settings(&smc->sk, smc->clcsock->sk, SK_FLAGS_CLC_TO_SMC);
} | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c |
static void
smc_conn_save_peer_info_fce(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm *clc) {
struct smc_clc_msg_accept_confirm_v2 *clc_v2 =
(struct smc_clc_msg_accept_confirm_v2 *)clc;
struct smc_clc_first_contact_ext *fce;
int clc_v2_len;
if (clc->hdr.version == S... | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c |
static void smcr_conn_save_peer_info(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm *clc) {
int bufsize = smc_uncompress_bufsize(clc->r0.rmbe_size);
smc->conn.peer_rmbe_idx = clc->r0.rmbe_idx;
smc->conn.local_tx_ctrl.token = ntohl(clc->r0.rmbe_alert_token);
smc->c... | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c | static void smcd_conn_save_peer_info(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm *clc) {
int bufsize = smc_uncompress_bufsize(clc->d0.dmbe_size);
smc->conn.peer_rmbe_idx = clc->d0.dmbe_idx;
smc->conn.peer_token = clc->d0.token;
smc->conn.peer_rmbe_size = bufsiz... | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c |
static void smc_link_save_peer_info(struct smc_link *link,
struct smc_clc_msg_accept_confirm *clc,
struct smc_init_info *ini) {
link->peer_qpn = ntoh24(clc->r0.qpn);
memcpy(link->peer_gid, ini->peer_gid, SMC_GID_SIZE);
memcpy(link->peer_mac,... | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c |
static void smc_fback_replace_callbacks(struct smc_sock *smc) {
struct sock *clcsk = smc->clcsock->sk;
write_lock_bh(&clcsk->sk_callback_lock);
clcsk->sk_user_data = (void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY);
smc_clcsock_replace_cb(&clcsk->sk_state_change, smc_fback_state_change,
... | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c | static int smc_connect_fallback(struct smc_sock *smc, int reason_code) {
struct net *net = sock_net(&smc->sk);
int rc = 0;
rc = smc_switch_to_fallback(smc, reason_code);
if (rc) {
this_cpu_inc(net->smc.smc_stats->clnt_hshake_err_cnt);
if (smc->sk.sk_state == SMC_INIT)
sock_put(&smc->sk); /* passi... | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c | static int smc_connect_decline_fallback(struct smc_sock *smc, int reason_code,
u8 version) {
struct net *net = sock_net(&smc->sk);
int rc;
if (reason_code < 0) {
this_cpu_inc(net->smc.smc_stats->clnt_hshake_err_cnt);
if (smc->sk.sk_state == SMC_INIT)
sock_put... | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c | static int smc_find_rdma_device(struct smc_sock *smc,
struct smc_init_info *ini) {
smc_pnet_find_roce_resource(smc->clcsock->sk, ini);
if (!ini->check_smcrv2 && !ini->ib_dev)
return SMC_CLC_DECL_NOSMCRDEV;
if (ini->check_smcrv2 && !ini->smcrv2.ib_dev_v2)
return SMC_CLC_DEC... | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c | static bool smc_find_ism_v2_is_unique_chid(u16 chid, struct smc_init_info *ini,
int cnt) {
int i = (!ini->ism_dev[0]) ? 1 : 0;
for (; i < cnt; i++)
if (ini->ism_chid[i] == chid)
return false;
return true;
} | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c | static int smc_connect_clc(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm_v2 *aclc2,
struct smc_init_info *ini) {
int rc = 0;
rc = smc_clc_send_proposal(smc, ini);
if (rc)
return rc;
/* receive SMC Accept CLC message */
return smc_clc_wait_ms... | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c | static void smc_accept_unlink(struct sock *sk) {
struct smc_sock *par = smc_sk(sk)->listen_smc;
spin_lock(&par->accept_q_lock);
list_del_init(&smc_sk(sk)->accept_q);
spin_unlock(&par->accept_q_lock);
sk_acceptq_removed(&smc_sk(sk)->listen_smc->sk);
sock_put(sk);
} | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c | static void smc_listen_out_connected(struct smc_sock *new_smc) {
struct sock *newsmcsk = &new_smc->sk;
if (newsmcsk->sk_state == SMC_INIT)
newsmcsk->sk_state = SMC_ACTIVE;
smc_listen_out(new_smc);
} | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c | static void smc_listen_decline(struct smc_sock *new_smc, int reason_code,
int local_first, u8 version) {
smc_conn_abort(new_smc, local_first);
if (reason_code < 0 || smc_switch_to_fallback(new_smc, reason_code)) {
/* error, no fallback possible */
smc_listen_out_err(new_smc);... | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c |
static bool smc_is_already_selected(struct smcd_dev *smcd,
struct smc_init_info *ini, int matches) {
int i;
for (i = 0; i < matches; i++)
if (smcd == ini->ism_dev[i])
return true;
return false;
} | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c | static void smc_find_ism_v1_device_serv(struct smc_sock *new_smc,
struct smc_clc_msg_proposal *pclc,
struct smc_init_info *ini) {
struct smc_clc_msg_smcd *pclc_smcd = smc_get_clc_msg_smcd(pclc);
int rc = 0;
if (!(ini->smcd_version & ... | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c |
static int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) {
struct sock *sk = sock->sk;
struct smc_sock *smc;
int rc = -EPIPE;
smc = smc_sk(sk);
lock_sock(sk);
if ((sk->sk_state != SMC_ACTIVE) && (sk->sk_state != SMC_APPCLOSEWAIT1) &&
(sk->sk_state != SMC_INIT))
goto out;
if... | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c | static ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
struct pipe_inode_info *pipe, size_t len,
unsigned int flags) {
struct sock *sk = sock->sk;
struct smc_sock *smc;
int rc = -ENOTCONN;
smc = smc_sk(sk);
lock_sock(sk);
if (sk->sk_s... | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c |
static int smc_create(struct net *net, struct socket *sock, int protocol,
int kern) {
return __smc_create(net, sock, protocol, kern, NULL);
} | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c | static int smc_ulp_init(struct sock *sk) {
struct socket *tcp = sk->sk_socket;
struct net *net = sock_net(sk);
struct socket *smcsock;
int protocol, ret;
if (tcp->type != SOCK_STREAM || sk->sk_protocol != IPPROTO_TCP ||
(sk->sk_family != AF_INET && sk->sk_family != AF_INET6))
return -ESOCKTNOSUPPOR... | [
1,
0
] |
Linux Kernel | net/smc/af_smc.c | static void smc_ulp_clone(const struct request_sock *req, struct sock *newsk,
const gfp_t priority) {
struct inet_connection_sock *icsk = inet_csk(newsk);
icsk->icsk_ulp_ops = NULL;
} | [
0,
0
] |
Linux Kernel | net/smc/af_smc.c |
static void __net_exit smc_net_exit(struct net *net) {
smc_sysctl_net_exit(net);
smc_pnet_net_exit(net);
} | [
0,
0
] |
Linux Kernel | net/smc/smc.h |
static inline void smc_init_saved_callbacks(struct smc_sock *smc) {
smc->clcsk_state_change = NULL;
smc->clcsk_data_ready = NULL;
smc->clcsk_write_space = NULL;
smc->clcsk_error_report = NULL;
} | [
0,
0
] |
Linux Kernel | net/smc/smc.h | static inline void smc_clcsock_replace_cb(void (**target_cb)(struct sock *),
void (*new_cb)(struct sock *),
void (**saved_cb)(struct sock *)) {
if (!*saved_cb)
*saved_cb = *target_cb;
*target_cb = new_cb;
} | [
0,
0
] |
Linux Kernel | net/smc/smc.h | static inline u32 ntoh24(u8 *net) {
__be32 t = 0;
memcpy(((u8 *)&t) + 1, net, 3);
return be32_to_cpu(t);
} | [
1,
0
] |
Linux Kernel | net/smc/smc.h | static inline bool using_ipsec(struct smc_sock *smc) {
return (smc->clcsock->sk->sk_policy[0] || smc->clcsock->sk->sk_policy[1])
? true
: false;
}
#else | [
1,
0
] |
Linux Kernel | net/smc/smc_cdc.c |
static inline void smc_cdc_add_pending_send(struct smc_connection *conn,
struct smc_cdc_tx_pend *pend) {
BUILD_BUG_ON_MSG(
sizeof(struct smc_cdc_msg) > SMC_WR_BUF_SIZE,
"must increase SMC_WR_BUF_SIZE to at least sizeof(struct smc_cdc_msg)");
BUILD_BUG_ON_MSG(... | [
1,
0
] |
Linux Kernel | net/smc/smc_cdc.c |
void smc_cdc_wait_pend_tx_wr(struct smc_connection *conn) {
wait_event(conn->cdc_pend_tx_wq, !atomic_read(&conn->cdc_pend_tx_wr));
} | [
0,
0
] |
Linux Kernel | net/smc/smc_cdc.c | int smcd_cdc_msg_send(struct smc_connection *conn) {
struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
union smc_host_cursor curs;
struct smcd_cdc_msg cdc;
int rc, diff;
memset(&cdc, 0, sizeof(cdc));
cdc.common.type = SMC_CDC_MSG_TYPE;
curs.acurs.counter = atomic64_read(&conn->local_tx_ct... | [
1,
0
] |
Linux Kernel | net/smc/smc_cdc.h |
static inline bool smc_cdc_rxed_any_close(struct smc_connection *conn) {
return conn->local_rx_ctrl.conn_state_flags.peer_conn_abort ||
conn->local_rx_ctrl.conn_state_flags.peer_conn_closed;
} | [
0,
0
] |
Linux Kernel | net/smc/smc_cdc.h |
static inline void smc_curs_add(int size, union smc_host_cursor *curs,
int value) {
curs->count += value;
if (curs->count >= size) {
curs->wrap++;
curs->count -= size;
}
} | [
0,
0
] |
Linux Kernel | net/smc/smc_cdc.h |
static inline void smcd_curs_copy(union smcd_cdc_cursor *tgt,
union smcd_cdc_cursor *src,
struct smc_connection *conn) {
#ifndef KERNEL_HAS_ATOMIC64
unsigned long flags;
spin_lock_irqsave(&conn->acurs_lock, flags);
tgt->acurs = src->acurs;
sp... | [
0,
0
] |
Linux Kernel | net/smc/smc_cdc.h | static inline int smc_curs_comp(unsigned int size, union smc_host_cursor *old,
union smc_host_cursor *new) {
if (old->wrap > new->wrap ||
(old->wrap == new->wrap && old->count > new->count))
return -smc_curs_diff(size, new, old);
return smc_curs_diff(size, old, new);
} | [
1,
0
] |
Linux Kernel | net/smc/smc_cdc.h |
static inline void smc_host_msg_to_cdc(struct smc_cdc_msg *peer,
struct smc_connection *conn,
union smc_host_cursor *save) {
struct smc_host_cdc_msg *local = &conn->local_tx_ctrl;
peer->common.type = local->common.type;
peer->len = lo... | [
0,
0
] |
Linux Kernel | net/smc/smc_cdc.h |
static inline void smcr_cdc_msg_to_host(struct smc_host_cdc_msg *local,
struct smc_cdc_msg *peer,
struct smc_connection *conn) {
local->common.type = peer->common.type;
local->len = peer->len;
local->seqno = ntohs(peer->seqno);
loc... | [
0,
0
] |
Linux Kernel | net/smc/smc_clc.c | static bool smc_clc_ueid_valid(char *ueid) {
char *end = ueid + SMC_MAX_EID_LEN;
while (--end >= ueid && isspace(*end))
;
if (end < ueid)
return false;
if (!isalnum(*ueid) || islower(*ueid))
return false;
while (ueid <= end) {
if ((!isalnum(*ueid) || islower(*ueid)) && *ueid != '.' && *ueid !... | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.c | static int smc_clc_ueid_add(char *ueid) {
struct smc_clc_eid_entry *new_ueid, *tmp_ueid;
int rc;
if (!smc_clc_ueid_valid(ueid))
return -EINVAL;
new_ueid = kzalloc(sizeof(*new_ueid), GFP_KERNEL);
if (!new_ueid)
return -ENOMEM;
memcpy(new_ueid->eid, ueid, SMC_MAX_EID_LEN);
write_lock(&smc_clc_eid... | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.c |
int smc_nl_add_ueid(struct sk_buff *skb, struct genl_info *info) {
struct nlattr *nla_ueid = info->attrs[SMC_NLA_EID_TABLE_ENTRY];
char *ueid;
if (!nla_ueid || nla_len(nla_ueid) != SMC_MAX_EID_LEN + 1)
return -EINVAL;
ueid = (char *)nla_data(nla_ueid);
return smc_clc_ueid_add(ueid);
} | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.c |
int smc_nl_remove_ueid(struct sk_buff *skb, struct genl_info *info) {
struct nlattr *nla_ueid = info->attrs[SMC_NLA_EID_TABLE_ENTRY];
char *ueid;
if (!nla_ueid || nla_len(nla_ueid) != SMC_MAX_EID_LEN + 1)
return -EINVAL;
ueid = (char *)nla_data(nla_ueid);
return smc_clc_ueid_remove(ueid);
} | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.c |
static int smc_nl_ueid_dumpinfo(struct sk_buff *skb, u32 portid, u32 seq,
u32 flags, char *ueid) {
char ueid_str[SMC_MAX_EID_LEN + 1];
void *hdr;
hdr = genlmsg_put(skb, portid, seq, &smc_gen_nl_family, flags,
SMC_NETLINK_DUMP_UEID);
if (!hdr)
return -ENO... | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.c |
bool smc_clc_match_eid(u8 *negotiated_eid,
struct smc_clc_v2_extension *smc_v2_ext, u8 *peer_eid,
u8 *local_eid) {
bool match = false;
int i;
negotiated_eid[0] = 0;
read_lock(&smc_clc_eid_table.lock);
if (peer_eid && local_eid && smc_clc_eid_table.seid_enabled &... | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.c | static bool
smc_clc_msg_acc_conf_valid(struct smc_clc_msg_accept_confirm_v2 *clc_v2) {
struct smc_clc_msg_hdr *hdr = &clc_v2->hdr;
if (hdr->typev1 != SMC_TYPE_R && hdr->typev1 != SMC_TYPE_D)
return false;
if (hdr->version == SMC_V1) {
if ((hdr->typev1 == SMC_TYPE_R &&
ntohs(hdr->length) != SMCR_... | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.c | static int smc_clc_prfx_set4_rcu(struct dst_entry *dst, __be32 ipv4,
struct smc_clc_msg_proposal_prefix *prop) {
struct in_device *in_dev = __in_dev_get_rcu(dst->dev);
const struct in_ifaddr *ifa;
if (!in_dev)
return -ENODEV;
in_dev_for_each_ifa_rcu(ifa, in_dev) {
if (... | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.c | static int smc_clc_prfx_set6_rcu(struct dst_entry *dst,
struct smc_clc_msg_proposal_prefix *prop,
struct smc_clc_ipv6_prefix *ipv6_prfx) {
#if IS_ENABLED(CONFIG_IPV6)
struct inet6_dev *in6_dev = __in6_dev_get(dst->dev);
struct inet6_ifaddr *ifa;
in... | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.c | int smc_clc_prfx_match(struct socket *clcsock,
struct smc_clc_msg_proposal_prefix *prop) {
struct dst_entry *dst = sk_dst_get(clcsock->sk);
int rc;
if (!dst) {
rc = -ENOTCONN;
goto out;
}
if (!dst->dev) {
rc = -ENODEV;
goto out_rel;
}
rcu_read_lock();
if (!prop->i... | [
0,
0
] |
Linux Kernel | net/smc/smc_clc.c | int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info, u8 version) {
struct smc_clc_msg_decline *dclc_v1;
struct smc_clc_msg_decline_v2 dclc;
struct msghdr msg;
int len, send_len;
struct kvec vec;
dclc_v1 = (struct smc_clc_msg_decline *)&dclc;
memset(&dclc, 0, sizeof(dclc));
memcpy(dclc.hdr... | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.c | int smc_clc_send_accept(struct smc_sock *new_smc, bool srv_first_contact,
u8 version, u8 *negotiated_eid) {
struct smc_clc_msg_accept_confirm_v2 aclc_v2;
int len;
memset(&aclc_v2, 0, sizeof(aclc_v2));
aclc_v2.hdr.type = SMC_CLC_ACCEPT;
len = smc_clc_send_confirm_accept(new_smc, &aclc_... | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.c | void __init smc_clc_init(void) {
struct new_utsname *u;
memset(smc_hostname, _S, sizeof(smc_hostname));
u = utsname();
memcpy(smc_hostname, u->nodename,
min_t(size_t, strlen(u->nodename), sizeof(smc_hostname)));
INIT_LIST_HEAD(&smc_clc_eid_table.list);
rwlock_init(&smc_clc_eid_table.lock);
smc_... | [
1,
0
] |
Linux Kernel | net/smc/smc_clc.h |
static inline bool smcd_indicated(int smc_type) {
return smc_type == SMC_TYPE_D || smc_type == SMC_TYPE_B;
} | [
0,
0
] |
Linux Kernel | net/smc/smc_close.c | static void smc_close_cleanup_listen(struct sock *parent) {
struct sock *sk;
while ((sk = smc_accept_dequeue(parent, NULL)))
smc_close_non_accepted(sk);
} | [
0,
0
] |
Linux Kernel | net/smc/smc_close.c |
int smc_close_abort(struct smc_connection *conn) {
conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1;
return smc_cdc_get_slot_and_msg_send(conn);
} | [
0,
0
] |
Linux Kernel | net/smc/smc_close.c |
static void smc_close_cancel_work(struct smc_sock *smc) {
struct sock *sk = &smc->sk;
release_sock(sk);
cancel_work_sync(&smc->conn.close_work);
cancel_delayed_work_sync(&smc->conn.tx_work);
lock_sock(sk);
} | [
0,
0
] |
Linux Kernel | net/smc/smc_close.c | void smc_close_active_abort(struct smc_sock *smc) {
struct sock *sk = &smc->sk;
bool release_clcsock = false;
if (sk->sk_state != SMC_INIT && smc->clcsock && smc->clcsock->sk) {
sk->sk_err = ECONNABORTED;
if (smc->clcsock && smc->clcsock->sk)
tcp_abort(smc->clcsock->sk, ECONNABORTED);
}
switch ... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c |
static void smc_ibdev_cnt_dec(struct smc_link *lnk) {
atomic_dec(&lnk->smcibdev->lnk_cnt_by_port[lnk->ibport - 1]);
} | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | static int smcr_lgr_conn_assign_link(struct smc_connection *conn, bool first) {
enum smc_link_state expected = first ? SMC_LNK_ACTIVATING : SMC_LNK_ACTIVE;
int i, j;
for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) {
struct smc_link *lnk = &conn->lgr->lnk[i];
if (lnk->state != expected || lnk->link_is_asym)
... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c | static int smc_lgr_register_conn(struct smc_connection *conn, bool first) {
struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
static atomic_t nexttoken = ATOMIC_INIT(0);
int rc;
if (!conn->lgr->is_smcd) {
rc = smcr_lgr_conn_assign_link(conn, first);
if (rc) {
conn->lgr = NULL;
... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c | static void __smc_lgr_unregister_conn(struct smc_connection *conn) {
struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
struct smc_link_group *lgr = conn->lgr;
rb_erase(&conn->alert_node, &lgr->conns_all);
if (conn->lnk)
atomic_dec(&conn->lnk->conn_cnt);
lgr->conns_num--;
conn->alert_tok... | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | static int smc_nl_fill_lgr_v2_common(struct smc_link_group *lgr,
struct sk_buff *skb,
struct netlink_callback *cb,
struct nlattr *v2_attrs) {
char smc_host[SMC_MAX_HOSTNAME_LEN + 1];
char smc_eid[SMC_MAX_E... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c |
static int smc_nl_fill_smcr_lgr_v2(struct smc_link_group *lgr,
struct sk_buff *skb,
struct netlink_callback *cb) {
struct nlattr *v2_attrs;
v2_attrs = nla_nest_start(skb, SMC_NLA_LGR_R_V2);
if (!v2_attrs)
goto errattr;
if (nla_put_u8(sk... | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c |
int smcr_nl_get_link(struct sk_buff *skb, struct netlink_callback *cb) {
bool list_links = true;
smc_nl_fill_lgr_list(&smc_lgr_list, skb, cb, list_links);
return skb->len;
} | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c |
static void smc_lgr_terminate_work(struct work_struct *work) {
struct smc_link_group *lgr =
container_of(work, struct smc_link_group, terminate_work);
__smc_lgr_terminate(lgr, true);
} | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | static u8 smcr_next_link_id(struct smc_link_group *lgr) {
u8 link_id;
int i;
while (1) {
again:
link_id = ++lgr->next_link_id;
if (!link_id)
link_id = ++lgr->next_link_id;
for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) {
if (smc_link_usable(&lgr->lnk[i]) && lgr->lnk[i].link_id == link_id)
... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c |
static void smcr_copy_dev_info_to_link(struct smc_link *link) {
struct smc_ib_device *smcibdev = link->smcibdev;
snprintf(link->ibname, sizeof(link->ibname), "%s", smcibdev->ibdev->name);
link->ndev_ifidx = smcibdev->ndev_ifidx[link->ibport - 1];
} | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c | static int smc_write_space(struct smc_connection *conn) {
int buffer_len = conn->peer_rmbe_size;
union smc_host_cursor prod;
union smc_host_cursor cons;
int space;
smc_curs_copy(&prod, &conn->local_tx_ctrl.prod, conn);
smc_curs_copy(&cons, &conn->local_rx_ctrl.cons, conn);
space = buffer_len - smc_curs_... | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | void smc_switch_link_and_count(struct smc_connection *conn,
struct smc_link *to_lnk) {
atomic_dec(&conn->lnk->conn_cnt);
smcr_link_put(conn->lnk);
conn->lnk = to_lnk;
atomic_inc(&conn->lnk->conn_cnt);
/* link_put in smc_conn_free() */
smcr_link_hold(conn->lnk);
} | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | static void smcr_buf_unmap_link(struct smc_buf_desc *buf_desc, bool is_rmb,
struct smc_link *lnk) {
if (is_rmb || buf_desc->is_vm)
buf_desc->is_reg_mr[lnk->link_idx] = false;
if (!buf_desc->is_map_ib[lnk->link_idx])
return;
if ((is_rmb || buf_desc->is_vm) && buf_desc->mr[l... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c | static void __smcr_link_clear(struct smc_link *lnk) {
struct smc_link_group *lgr = lnk->lgr;
struct smc_ib_device *smcibdev;
smc_wr_free_link_mem(lnk);
smc_ibdev_cnt_dec(lnk);
put_device(&lnk->smcibdev->ibdev->dev);
smcibdev = lnk->smcibdev;
memset(lnk, 0, sizeof(struct smc_link));
lnk->state = SMC_LNK... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c |
void smcr_link_hold(struct smc_link *lnk) { refcount_inc(&lnk->refcnt); } | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c |
void smcr_link_put(struct smc_link *lnk) {
if (refcount_dec_and_test(&lnk->refcnt))
__smcr_link_clear(lnk);
} | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c |
static void smcr_buf_free(struct smc_link_group *lgr, bool is_rmb,
struct smc_buf_desc *buf_desc) {
int i;
for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++)
smcr_buf_unmap_link(buf_desc, is_rmb, &lgr->lnk[i]);
if (!buf_desc->is_vm && buf_desc->pages)
__free_pages(buf_desc->pages, bu... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c |
void smc_lgr_hold(struct smc_link_group *lgr) { refcount_inc(&lgr->refcnt); } | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | void smc_lgr_terminate_sched(struct smc_link_group *lgr) {
spinlock_t *lgr_lock;
smc_lgr_list_head(lgr, &lgr_lock);
spin_lock_bh(lgr_lock);
if (list_empty(&lgr->list) || lgr->terminating || lgr->freeing) {
spin_unlock_bh(lgr_lock);
return;
}
list_del_init(&lgr->list);
lgr->freeing = 1;
spin_unl... | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | void smcr_lgr_set_type(struct smc_link_group *lgr, enum smc_lgr_type new_type) {
char *lgr_type = "";
int i;
for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++)
if (smc_link_usable(&lgr->lnk[i]))
lgr->lnk[i].link_is_asym = false;
if (lgr->type == new_type)
return;
lgr->type = new_type;
switch (lgr->... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c | static void smcr_link_down(struct smc_link *lnk) {
struct smc_link_group *lgr = lnk->lgr;
struct smc_link *to_lnk;
int del_link_id;
if (!lgr || lnk->state == SMC_LNK_UNUSED || list_empty(&lgr->list))
return;
to_lnk = smc_switch_conns(lgr, lnk, true);
if (!to_lnk) {
smcr_link_clear(lnk, true);
... | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | void smcr_link_down_cond_sched(struct smc_link *lnk) {
if (smc_link_downing(&lnk->state)) {
trace_smcr_link_down(lnk, __builtin_return_address(0));
schedule_work(&lnk->link_down_wrk);
}
} | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c |
static int smc_vlan_by_tcpsk_walk(struct net_device *lower_dev,
struct netdev_nested_priv *priv) {
unsigned short *vlan_id = (unsigned short *)priv->data;
if (is_vlan_dev(lower_dev)) {
*vlan_id = vlan_dev_vlan_id(lower_dev);
return 1;
}
return 0;
} | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | static u8 smc_compress_bufsize(int size, bool is_smcd, bool is_rmb) {
const unsigned int max_scat = SG_MAX_SINGLE_ALLOC * PAGE_SIZE;
u8 compressed;
if (size <= SMC_BUF_MIN_SIZE)
return 0;
size = (size - 1) >> 14;
compressed =
min_t(u8, ilog2(size) + 1, is_smcd ? SMCD_DMBE_SIZES : SMCR_RMBE_SIZES);... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c | static struct smc_buf_desc *smc_buf_get_slot(int compressed_bufsize,
struct mutex *lock,
struct list_head *buf_list) {
struct smc_buf_desc *buf_slot;
mutex_lock(lock);
list_for_each_entry(buf_slot, buf_list, list) {
if ... | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | int smcr_buf_reg_lgr(struct smc_link *lnk) {
struct smc_link_group *lgr = lnk->lgr;
struct smc_buf_desc *buf_desc, *bf;
int i, rc = 0;
mutex_lock(&lgr->rmbs_lock);
for (i = 0; i < SMC_RMBE_SIZES; i++) {
list_for_each_entry_safe(buf_desc, bf, &lgr->rmbs[i], list) {
if (!buf_desc->used)
conti... | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | static struct smc_buf_desc *smcr_new_buf_create(struct smc_link_group *lgr,
bool is_rmb, int bufsize) {
struct smc_buf_desc *buf_desc;
buf_desc = kzalloc(sizeof(*buf_desc), GFP_KERNEL);
if (!buf_desc)
return ERR_PTR(-ENOMEM);
switch (lgr->buf_type) {
case ... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c |
void smc_rmb_sync_sg_for_cpu(struct smc_connection *conn) {
int i;
if (!conn->rmb_desc->is_dma_need_sync)
return;
if (!smc_conn_lgr_valid(conn) || conn->lgr->is_smcd)
return;
for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) {
if (!smc_link_active(&conn->lgr->lnk[i]))
continue;
smc_ib_sync_sg_... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.c |
static inline int smc_rmb_reserve_rtoken_idx(struct smc_link_group *lgr) {
int i;
for_each_clear_bit(i, lgr->rtokens_used_mask, SMC_RMBS_PER_LGR_MAX) {
if (!test_and_set_bit(i, lgr->rtokens_used_mask))
return i;
}
return -ENOSPC;
} | [
0,
0
] |
Linux Kernel | net/smc/smc_core.c | int smc_rtoken_add(struct smc_link *lnk, __be64 nw_vaddr, __be32 nw_rkey) {
struct smc_link_group *lgr = smc_get_lgr(lnk);
u64 dma_addr = be64_to_cpu(nw_vaddr);
u32 rkey = ntohl(nw_rkey);
int i;
for (i = 0; i < SMC_RMBS_PER_LGR_MAX; i++) {
if (lgr->rtokens[i][lnk->link_idx].rkey == rkey &&
lgr->r... | [
1,
0
] |
Linux Kernel | net/smc/smc_core.h | static inline struct smc_connection *
smc_lgr_find_conn(u32 token, struct smc_link_group *lgr) {
struct smc_connection *res = NULL;
struct rb_node *node;
node = lgr->conns_all.rb_node;
while (node) {
struct smc_connection *cur =
rb_entry(node, struct smc_connection, alert_node);
if (cur->alert... | [
0,
0
] |
Linux Kernel | net/smc/smc_ib.c |
static int smc_ib_modify_qp_init(struct smc_link *lnk) {
struct ib_qp_attr qp_attr;
memset(&qp_attr, 0, sizeof(qp_attr));
qp_attr.qp_state = IB_QPS_INIT;
qp_attr.pkey_index = 0;
qp_attr.port_num = lnk->ibport;
qp_attr.qp_access_flags = IB_ACCESS_LOCAL_WRITE | IB_ACCESS_REMOTE_WRITE;
return ib_modify_qp(... | [
1,
0
] |
Linux Kernel | net/smc/smc_ib.c | int smc_ib_modify_qp_rts(struct smc_link *lnk) {
struct ib_qp_attr qp_attr;
memset(&qp_attr, 0, sizeof(qp_attr));
qp_attr.qp_state = IB_QPS_RTS;
qp_attr.timeout = SMC_QP_TIMEOUT;
qp_attr.retry_cnt = SMC_QP_RETRY_CNT; /* retry count */
qp_attr.rnr_retry = SMC_QP_RNR_RETRY; /* RNR retries, 7=infinite */
qp... | [
1,
0
] |
Linux Kernel | net/smc/smc_ib.c |
int smc_ib_modify_qp_error(struct smc_link *lnk) {
struct ib_qp_attr qp_attr;
memset(&qp_attr, 0, sizeof(qp_attr));
qp_attr.qp_state = IB_QPS_ERR;
return ib_modify_qp(lnk->roce_qp, &qp_attr, IB_QP_STATE);
} | [
1,
0
] |
Linux Kernel | net/smc/smc_ib.c |
static void smc_ib_init_local_systemid(void) {
get_random_bytes(&local_systemid[0], 2);
} | [
0,
0
] |
Linux Kernel | net/smc/smc_ib.c | static int smc_ib_remember_port_attr(struct smc_ib_device *smcibdev,
u8 ibport) {
int rc;
memset(&smcibdev->pattr[ibport - 1], 0, sizeof(smcibdev->pattr[ibport - 1]));
rc = ib_query_port(smcibdev->ibdev, ibport, &smcibdev->pattr[ibport - 1]);
if (rc)
goto out;
rc = s... | [
1,
0
] |
Linux Kernel | net/smc/smc_ib.c |
static int smc_nl_handle_dev_port(struct sk_buff *skb, struct ib_device *ibdev,
struct smc_ib_device *smcibdev, int port) {
char smc_pnet[SMC_MAX_PNETID_LEN + 1];
struct nlattr *port_attrs;
unsigned char port_state;
int lnk_count = 0;
port_attrs = nla_nest_start(skb, SMC_NL... | [
1,
0
] |
Linux Kernel | net/smc/smc_ib.c |
static bool smc_nl_handle_pci_values(const struct smc_pci_dev *smc_pci_dev,
struct sk_buff *skb) {
if (nla_put_u32(skb, SMC_NLA_DEV_PCI_FID, smc_pci_dev->pci_fid))
return false;
if (nla_put_u16(skb, SMC_NLA_DEV_PCI_CHID, smc_pci_dev->pci_pchid))
return false;
if (nla_... | [
0,
0
] |
Linux Kernel | net/smc/smc_ib.c | void smc_ib_sync_sg_for_device(struct smc_link *lnk,
struct smc_buf_desc *buf_slot,
enum dma_data_direction data_direction) {
struct scatterlist *sg;
unsigned int i;
if (!(buf_slot->is_dma_need_sync & (1U << lnk->link_idx)))
return;
for_each_sg... | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.