Lines Matching refs:tx
286 static struct tipc_aead *tipc_crypto_key_pick_tx(struct tipc_crypto *tx,
847 struct tipc_crypto *tx = aead->crypto; in tipc_aead_encrypt_done() local
848 struct net *net = tx->net; in tipc_aead_encrypt_done()
852 this_cpu_inc(tx->stats->stat[STAT_ASYNC_OK]); in tipc_aead_encrypt_done()
863 this_cpu_inc(tx->stats->stat[STAT_ASYNC_NOK]); in tipc_aead_encrypt_done()
1213 struct tipc_crypto *tx, *rx; in tipc_crypto_key_flush() local
1220 tx = tipc_net(rx->net)->crypto_tx; in tipc_crypto_key_flush()
1230 tipc_aead_users_dec(tx->aead[k], 0); in tipc_crypto_key_flush()
1232 tx->timer1 = jiffies; in tipc_crypto_key_flush()
1319 static struct tipc_aead *tipc_crypto_key_pick_tx(struct tipc_crypto *tx, in tipc_crypto_key_pick_tx() argument
1326 struct tipc_key key = tx->key; in tipc_crypto_key_pick_tx()
1340 spin_lock(&tx->lock); in tipc_crypto_key_pick_tx()
1342 aead = tipc_aead_rcu_ptr(tx->aead[KEY_MASTER], &tx->lock); in tipc_crypto_key_pick_tx()
1350 aead = tipc_aead_rcu_ptr(tx->aead[k], &tx->lock); in tipc_crypto_key_pick_tx()
1370 spin_unlock(&tx->lock); in tipc_crypto_key_pick_tx()
1393 struct tipc_crypto *tx = tipc_net(rx->net)->crypto_tx; in tipc_crypto_key_synch() local
1404 tx->legacy_user = 1; in tipc_crypto_key_synch()
1413 tx->timer2 = jiffies; in tipc_crypto_key_synch()
1415 if (tx->key.keys && in tipc_crypto_key_synch()
1420 if (queue_delayed_work(tx->wq, &rx->work, delay)) in tipc_crypto_key_synch()
1431 if (tx->key.keys && in tipc_crypto_key_synch()
1435 tipc_aead_users_inc(tx->aead[new], INT_MAX); in tipc_crypto_key_synch()
1437 tipc_aead_users_dec(tx->aead[cur], 0); in tipc_crypto_key_synch()
1441 tx->timer1 = jiffies; in tipc_crypto_key_synch()
1444 tx->name, cur, new, rx->name); in tipc_crypto_key_synch()
1450 struct tipc_crypto *tx = tipc_net(net)->crypto_tx; in tipc_crypto_key_revoke() local
1453 spin_lock_bh(&tx->lock); in tipc_crypto_key_revoke()
1454 key = tx->key; in tipc_crypto_key_revoke()
1458 tipc_crypto_key_set_state(tx, key.passive, 0, key.pending); in tipc_crypto_key_revoke()
1459 tipc_crypto_key_detach(tx->aead[key.active], &tx->lock); in tipc_crypto_key_revoke()
1460 spin_unlock_bh(&tx->lock); in tipc_crypto_key_revoke()
1462 pr_warn("%s: key is revoked\n", tx->name); in tipc_crypto_key_revoke()
1554 struct tipc_crypto *tx = tn->crypto_tx; in tipc_crypto_timeout() local
1559 spin_lock(&tx->lock); in tipc_crypto_timeout()
1560 key = tx->key; in tipc_crypto_timeout()
1561 if (key.active && tipc_aead_users(tx->aead[key.active]) > 0) in tipc_crypto_timeout()
1563 if (!key.pending || tipc_aead_users(tx->aead[key.pending]) <= 0) in tipc_crypto_timeout()
1565 if (time_before(jiffies, tx->timer1 + TIPC_TX_LASTING_TIME)) in tipc_crypto_timeout()
1568 tipc_crypto_key_set_state(tx, key.passive, key.pending, 0); in tipc_crypto_timeout()
1570 tipc_crypto_key_detach(tx->aead[key.active], &tx->lock); in tipc_crypto_timeout()
1571 this_cpu_inc(tx->stats->stat[STAT_SWITCHES]); in tipc_crypto_timeout()
1572 pr_info("%s: key[%d] is activated\n", tx->name, key.pending); in tipc_crypto_timeout()
1575 spin_unlock(&tx->lock); in tipc_crypto_timeout()
1638 if (time_after(jiffies, tx->timer2 + TIPC_TX_GRACE_PERIOD)) in tipc_crypto_timeout()
1639 tx->legacy_user = 0; in tipc_crypto_timeout()
1694 struct tipc_crypto *tx = tipc_net(net)->crypto_tx; in tipc_crypto_xmit() local
1695 struct tipc_crypto_stats __percpu *stats = tx->stats; in tipc_crypto_xmit()
1697 struct tipc_key key = tx->key; in tipc_crypto_xmit()
1705 if (!tx->working) in tipc_crypto_xmit()
1711 if (!tx->key_master && !key.active) in tipc_crypto_xmit()
1716 pr_debug("%s: probing for key[%d]\n", tx->name, in tipc_crypto_xmit()
1726 if (tx->key_master) { in tipc_crypto_xmit()
1731 pr_debug("%s: gracing for msg (%d %d)\n", tx->name, in tipc_crypto_xmit()
1738 time_before(jiffies, tx->timer2 + TIPC_TX_GRACE_PERIOD)) { in tipc_crypto_xmit()
1743 if (likely(!tx->legacy_user)) in tipc_crypto_xmit()
1760 aead = tipc_aead_get(tx->aead[tx_key]); in tipc_crypto_xmit()
1817 struct tipc_crypto *tx = tipc_net(net)->crypto_tx; in tipc_crypto_rcv() local
1844 aead = tipc_crypto_key_pick_tx(tx, rx, *skb, tx_key); in tipc_crypto_rcv()
1857 stats = ((rx) ?: tx)->stats; in tipc_crypto_rcv()
2010 struct tipc_crypto *tx = tn->crypto_tx, *rx; in tipc_crypto_do_cmd() local
2031 tipc_crypto_key_dump(tx, buf)); in tipc_crypto_do_cmd()
2053 stat = per_cpu_ptr(tx->stats, cpu)->stat[i]; in tipc_crypto_do_cmd()
2200 int tipc_crypto_key_distr(struct tipc_crypto *tx, u8 key, in tipc_crypto_key_distr() argument
2212 aead = tipc_aead_get(tx->aead[key]); in tipc_crypto_key_distr()
2214 rc = tipc_crypto_key_xmit(tx->net, aead->key, in tipc_crypto_key_distr()
2289 struct tipc_crypto *tx = tipc_net(rx->net)->crypto_tx; in tipc_crypto_key_rcv() local
2342 if (likely(skey && queue_delayed_work(tx->wq, &rx->work, 0))) in tipc_crypto_key_rcv()
2359 struct tipc_crypto *tx = tipc_net(rx->net)->crypto_tx; in tipc_crypto_work_rx() local
2370 key = tx->key.pending ?: tx->key.active; in tipc_crypto_work_rx()
2371 rc = tipc_crypto_key_distr(tx, key, rx->node); in tipc_crypto_work_rx()
2374 tx->name, key, tipc_node_get_id_str(rx->node), in tipc_crypto_work_rx()
2403 if (resched && queue_delayed_work(tx->wq, &rx->work, delay)) in tipc_crypto_work_rx()
2415 void tipc_crypto_rekeying_sched(struct tipc_crypto *tx, bool changed, in tipc_crypto_rekeying_sched() argument
2425 tx->rekeying_intv = new_intv; in tipc_crypto_rekeying_sched()
2426 cancel_delayed_work_sync(&tx->work); in tipc_crypto_rekeying_sched()
2429 if (tx->rekeying_intv || now) { in tipc_crypto_rekeying_sched()
2430 delay = (now) ? 0 : tx->rekeying_intv * 60 * 1000; in tipc_crypto_rekeying_sched()
2431 queue_delayed_work(tx->wq, &tx->work, msecs_to_jiffies(delay)); in tipc_crypto_rekeying_sched()
2447 struct tipc_crypto *tx = container_of(dwork, struct tipc_crypto, work); in tipc_crypto_work_tx() local
2449 struct tipc_key key = tx->key; in tipc_crypto_work_tx()
2458 aead = rcu_dereference(tx->aead[key.active ?: KEY_MASTER]); in tipc_crypto_work_tx()
2472 tipc_crypto_key_init(tx, skey, PER_NODE_KEY, false); in tipc_crypto_work_tx()
2474 rc = tipc_crypto_key_distr(tx, rc, NULL); in tipc_crypto_work_tx()
2479 pr_warn_ratelimited("%s: rekeying returns %d\n", tx->name, rc); in tipc_crypto_work_tx()
2483 tipc_crypto_rekeying_sched(tx, false, 0); in tipc_crypto_work_tx()