/* Hashes a service in the ip_vs_svc_table by <proto,addr,port> or in the ip_vs_svc_fwm_table by fwmark. Should be called with locked tables.  */
static int ip_vs_svc_hash(struct ip_vs_service *svc)
/* Hashes a service in the ip_vs_svc_table by <proto,addr,port> or in the ip_vs_svc_fwm_table by fwmark. Should be called with locked tables.  */
static int ip_vs_svc_hash(struct ip_vs_service *svc)
{
	unsigned hash;
	if (svc->flags & IP_VS_SVC_F_HASHED) {
		pr_err("%s(): request for already hashed, called from %pF\n",
		       __func__, __builtin_return_address(0));
		return 0;
	}
	if (svc->fwmark == 0) {
		hash = ip_vs_svc_hashkey(svc->af, svc->protocol, &svc->addr,
					 svc->port);
		list_add(&svc->s_list, &ip_vs_svc_table[hash]);
	} else {
		hash = ip_vs_svc_fwm_hashkey(svc->fwmark);
		list_add(&svc->f_list, &ip_vs_svc_fwm_table[hash]);
	}
	svc->flags |= IP_VS_SVC_F_HASHED;
	atomic_inc(&svc->refcnt);
	return 1;
}