/* Hashes ip_vs_conn in ip_vs_conn_tab by proto,addr,port. returns bool success.  */
static int ip_vs_conn_hash(struct ip_vs_conn *cp)
/* Hashes ip_vs_conn in ip_vs_conn_tab by proto,addr,port. returns bool success.  */
static int ip_vs_conn_hash(struct ip_vs_conn *cp)
{
	unsigned hash;
	int ret;
	hash = ip_vs_conn_hashkey(cp->af, cp->protocol, &cp->caddr, cp->cport);
	ct_write_lock(hash);
	if (!(cp->flags & IP_VS_CONN_F_HASHED)) {
		list_add(&cp->c_list, &ip_vs_conn_tab[hash]);
		cp->flags |= IP_VS_CONN_F_HASHED;
		atomic_inc(&cp->refcnt);
		ret = 1;
	} else {
		pr_err("%s(): request for already hashed, called from %pF\n",
		       __func__, __builtin_return_address(0));
		ret = 0;
	}
	ct_write_unlock(hash);
	return ret;
}