Lines Matching refs:tx
286 static struct tipc_aead *tipc_crypto_key_pick_tx(struct tipc_crypto *tx,
850 struct tipc_crypto *tx = aead->crypto; in tipc_aead_encrypt_done() local
851 struct net *net = tx->net; in tipc_aead_encrypt_done()
855 this_cpu_inc(tx->stats->stat[STAT_ASYNC_OK]); in tipc_aead_encrypt_done()
866 this_cpu_inc(tx->stats->stat[STAT_ASYNC_NOK]); in tipc_aead_encrypt_done()
1215 struct tipc_crypto *tx, *rx; in tipc_crypto_key_flush() local
1222 tx = tipc_net(rx->net)->crypto_tx; in tipc_crypto_key_flush()
1232 tipc_aead_users_dec(tx->aead[k], 0); in tipc_crypto_key_flush()
1234 tx->timer1 = jiffies; in tipc_crypto_key_flush()
1321 static struct tipc_aead *tipc_crypto_key_pick_tx(struct tipc_crypto *tx, in tipc_crypto_key_pick_tx() argument
1328 struct tipc_key key = tx->key; in tipc_crypto_key_pick_tx()
1342 spin_lock(&tx->lock); in tipc_crypto_key_pick_tx()
1344 aead = tipc_aead_rcu_ptr(tx->aead[KEY_MASTER], &tx->lock); in tipc_crypto_key_pick_tx()
1352 aead = tipc_aead_rcu_ptr(tx->aead[k], &tx->lock); in tipc_crypto_key_pick_tx()
1372 spin_unlock(&tx->lock); in tipc_crypto_key_pick_tx()
1395 struct tipc_crypto *tx = tipc_net(rx->net)->crypto_tx; in tipc_crypto_key_synch() local
1406 tx->legacy_user = 1; in tipc_crypto_key_synch()
1415 tx->timer2 = jiffies; in tipc_crypto_key_synch()
1417 if (tx->key.keys && in tipc_crypto_key_synch()
1422 if (queue_delayed_work(tx->wq, &rx->work, delay)) in tipc_crypto_key_synch()
1433 if (tx->key.keys && in tipc_crypto_key_synch()
1437 tipc_aead_users_inc(tx->aead[new], INT_MAX); in tipc_crypto_key_synch()
1439 tipc_aead_users_dec(tx->aead[cur], 0); in tipc_crypto_key_synch()
1443 tx->timer1 = jiffies; in tipc_crypto_key_synch()
1446 tx->name, cur, new, rx->name); in tipc_crypto_key_synch()
1452 struct tipc_crypto *tx = tipc_net(net)->crypto_tx; in tipc_crypto_key_revoke() local
1455 spin_lock_bh(&tx->lock); in tipc_crypto_key_revoke()
1456 key = tx->key; in tipc_crypto_key_revoke()
1460 tipc_crypto_key_set_state(tx, key.passive, 0, key.pending); in tipc_crypto_key_revoke()
1461 tipc_crypto_key_detach(tx->aead[key.active], &tx->lock); in tipc_crypto_key_revoke()
1462 spin_unlock_bh(&tx->lock); in tipc_crypto_key_revoke()
1464 pr_warn("%s: key is revoked\n", tx->name); in tipc_crypto_key_revoke()
1556 struct tipc_crypto *tx = tn->crypto_tx; in tipc_crypto_timeout() local
1561 spin_lock(&tx->lock); in tipc_crypto_timeout()
1562 key = tx->key; in tipc_crypto_timeout()
1563 if (key.active && tipc_aead_users(tx->aead[key.active]) > 0) in tipc_crypto_timeout()
1565 if (!key.pending || tipc_aead_users(tx->aead[key.pending]) <= 0) in tipc_crypto_timeout()
1567 if (time_before(jiffies, tx->timer1 + TIPC_TX_LASTING_TIME)) in tipc_crypto_timeout()
1570 tipc_crypto_key_set_state(tx, key.passive, key.pending, 0); in tipc_crypto_timeout()
1572 tipc_crypto_key_detach(tx->aead[key.active], &tx->lock); in tipc_crypto_timeout()
1573 this_cpu_inc(tx->stats->stat[STAT_SWITCHES]); in tipc_crypto_timeout()
1574 pr_info("%s: key[%d] is activated\n", tx->name, key.pending); in tipc_crypto_timeout()
1577 spin_unlock(&tx->lock); in tipc_crypto_timeout()
1640 if (time_after(jiffies, tx->timer2 + TIPC_TX_GRACE_PERIOD)) in tipc_crypto_timeout()
1641 tx->legacy_user = 0; in tipc_crypto_timeout()
1696 struct tipc_crypto *tx = tipc_net(net)->crypto_tx; in tipc_crypto_xmit() local
1697 struct tipc_crypto_stats __percpu *stats = tx->stats; in tipc_crypto_xmit()
1699 struct tipc_key key = tx->key; in tipc_crypto_xmit()
1707 if (!tx->working) in tipc_crypto_xmit()
1713 if (!tx->key_master && !key.active) in tipc_crypto_xmit()
1718 pr_debug("%s: probing for key[%d]\n", tx->name, in tipc_crypto_xmit()
1728 if (tx->key_master) { in tipc_crypto_xmit()
1733 pr_debug("%s: gracing for msg (%d %d)\n", tx->name, in tipc_crypto_xmit()
1740 time_before(jiffies, tx->timer2 + TIPC_TX_GRACE_PERIOD)) { in tipc_crypto_xmit()
1745 if (likely(!tx->legacy_user)) in tipc_crypto_xmit()
1762 aead = tipc_aead_get(tx->aead[tx_key]); in tipc_crypto_xmit()
1819 struct tipc_crypto *tx = tipc_net(net)->crypto_tx; in tipc_crypto_rcv() local
1846 aead = tipc_crypto_key_pick_tx(tx, rx, *skb, tx_key); in tipc_crypto_rcv()
1859 stats = ((rx) ?: tx)->stats; in tipc_crypto_rcv()
2012 struct tipc_crypto *tx = tn->crypto_tx, *rx; in tipc_crypto_do_cmd() local
2033 tipc_crypto_key_dump(tx, buf)); in tipc_crypto_do_cmd()
2055 stat = per_cpu_ptr(tx->stats, cpu)->stat[i]; in tipc_crypto_do_cmd()
2202 int tipc_crypto_key_distr(struct tipc_crypto *tx, u8 key, in tipc_crypto_key_distr() argument
2214 aead = tipc_aead_get(tx->aead[key]); in tipc_crypto_key_distr()
2216 rc = tipc_crypto_key_xmit(tx->net, aead->key, in tipc_crypto_key_distr()
2291 struct tipc_crypto *tx = tipc_net(rx->net)->crypto_tx; in tipc_crypto_key_rcv() local
2344 if (likely(skey && queue_delayed_work(tx->wq, &rx->work, 0))) in tipc_crypto_key_rcv()
2361 struct tipc_crypto *tx = tipc_net(rx->net)->crypto_tx; in tipc_crypto_work_rx() local
2372 key = tx->key.pending ?: tx->key.active; in tipc_crypto_work_rx()
2373 rc = tipc_crypto_key_distr(tx, key, rx->node); in tipc_crypto_work_rx()
2376 tx->name, key, tipc_node_get_id_str(rx->node), in tipc_crypto_work_rx()
2405 if (resched && queue_delayed_work(tx->wq, &rx->work, delay)) in tipc_crypto_work_rx()
2417 void tipc_crypto_rekeying_sched(struct tipc_crypto *tx, bool changed, in tipc_crypto_rekeying_sched() argument
2427 tx->rekeying_intv = new_intv; in tipc_crypto_rekeying_sched()
2428 cancel_delayed_work_sync(&tx->work); in tipc_crypto_rekeying_sched()
2431 if (tx->rekeying_intv || now) { in tipc_crypto_rekeying_sched()
2432 delay = (now) ? 0 : tx->rekeying_intv * 60 * 1000; in tipc_crypto_rekeying_sched()
2433 queue_delayed_work(tx->wq, &tx->work, msecs_to_jiffies(delay)); in tipc_crypto_rekeying_sched()
2449 struct tipc_crypto *tx = container_of(dwork, struct tipc_crypto, work); in tipc_crypto_work_tx() local
2451 struct tipc_key key = tx->key; in tipc_crypto_work_tx()
2460 aead = rcu_dereference(tx->aead[key.active ?: KEY_MASTER]); in tipc_crypto_work_tx()
2474 tipc_crypto_key_init(tx, skey, PER_NODE_KEY, false); in tipc_crypto_work_tx()
2476 rc = tipc_crypto_key_distr(tx, rc, NULL); in tipc_crypto_work_tx()
2481 pr_warn_ratelimited("%s: rekeying returns %d\n", tx->name, rc); in tipc_crypto_work_tx()
2485 tipc_crypto_rekeying_sched(tx, false, 0); in tipc_crypto_work_tx()