<commit_before>/* Copyright (c) 2016, ENEA Software AB
 * Copyright (c) 2016, Nokia
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#pragma once

#include "ofpi_in_pcb.h"
#include "ofpi_callout.h"
#include "ofpi_tcp_var.h"
#include "ofpi_tcp_syncache.h"

/*
 * Shared data format
 */
struct ofp_tcp_var_mem {
	VNET_DEFINE(struct inpcbhead, ofp_tcb);/* queue of active tcpcb's */
	VNET_DEFINE(struct inpcbinfo, ofp_tcbinfo);
	VNET_DEFINE(OFP_TAILQ_HEAD(, tcptw), twq_2msl);

/* Target size of TCP PCB hash tables. Must be a power of two.*/
#define TCBHASHSIZE			1024
	struct inpcbhead	ofp_hashtbl[TCBHASHSIZE];
	struct inpcbporthead	ofp_porthashtbl[TCBHASHSIZE];

#define TCP_SYNCACHE_HASHSIZE		1024
	struct syncache_head	syncache[TCP_SYNCACHE_HASHSIZE];

	VNET_DEFINE(uma_zone_t, tcp_reass_zone);
	VNET_DEFINE(uma_zone_t, tcp_syncache_zone);
	VNET_DEFINE(uma_zone_t, tcpcb_zone);
	VNET_DEFINE(uma_zone_t, tcptw_zone);
	VNET_DEFINE(uma_zone_t, ofp_sack_hole_zone);
};
extern __thread struct ofp_tcp_var_mem *shm_tcp;

#define	V_tcb			VNET(shm_tcp->ofp_tcb)
#define	V_tcbinfo		VNET(shm_tcp->ofp_tcbinfo)
#define	V_tcp_reass_zone	VNET(shm_tcp->tcp_reass_zone)
#define	V_tcpcb_zone		VNET(shm_tcp->tcpcb_zone)
#define	V_tcptw_zone		VNET(shm_tcp->tcptw_zone)
#define	V_twq_2msl		VNET(shm_tcp->twq_2msl)
#define	V_tcp_syncache_zone	VNET(shm_tcp->tcp_syncache_zone)
#define	V_sack_hole_zone	VNET(shm_tcp->ofp_sack_hole_zone)
<commit_msg>TCP: ofp_tcp_var_mem shm: V_tcb, V_tcbinfo and V_twq_2msl, per core<commit_after>/* Copyright (c) 2016, ENEA Software AB
 * Copyright (c) 2016, Nokia
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#pragma once

#include "ofpi_in_pcb.h"
#include "ofpi_callout.h"
#include "ofpi_tcp_var.h"
#include "ofpi_tcp_syncache.h"

/*
 * Shared data format
 */
struct ofp_tcp_var_mem {
#ifdef OFP_RSS
	VNET_DEFINE(struct inpcbhead, ofp_tcb[OFP_MAX_NUM_CPU]);
	VNET_DEFINE(struct inpcbinfo, ofp_tcbinfo[OFP_MAX_NUM_CPU]);
	VNET_DEFINE(OFP_TAILQ_HEAD(, tcptw), twq_2msl[OFP_MAX_NUM_CPU]);
#else
	VNET_DEFINE(struct inpcbhead, ofp_tcb);/* queue of active tcpcb's */
	VNET_DEFINE(struct inpcbinfo, ofp_tcbinfo);
	VNET_DEFINE(OFP_TAILQ_HEAD(, tcptw), twq_2msl);
#endif

/* Target size of TCP PCB hash tables. Must be a power of two.*/
#define TCBHASHSIZE			1024
	struct inpcbhead	ofp_hashtbl[TCBHASHSIZE];
	struct inpcbporthead	ofp_porthashtbl[TCBHASHSIZE];

#define TCP_SYNCACHE_HASHSIZE		1024
	struct syncache_head	syncache[TCP_SYNCACHE_HASHSIZE];

	VNET_DEFINE(uma_zone_t, tcp_reass_zone);
	VNET_DEFINE(uma_zone_t, tcp_syncache_zone);
	VNET_DEFINE(uma_zone_t, tcpcb_zone);
	VNET_DEFINE(uma_zone_t, tcptw_zone);
	VNET_DEFINE(uma_zone_t, ofp_sack_hole_zone);
};
extern __thread struct ofp_tcp_var_mem *shm_tcp;

#ifdef OFP_RSS
#define	V_tcb			VNET(shm_tcp->ofp_tcb[odp_cpu_id()])
#define	V_tcbinfo		VNET(shm_tcp->ofp_tcbinfo[odp_cpu_id()])
#define	V_twq_2msl		VNET(shm_tcp->twq_2msl[odp_cpu_id()])
#else
#define	V_tcb			VNET(shm_tcp->ofp_tcb)
#define	V_tcbinfo		VNET(shm_tcp->ofp_tcbinfo)
#define	V_twq_2msl		VNET(shm_tcp->twq_2msl)
#endif

#define	V_tcp_reass_zone	VNET(shm_tcp->tcp_reass_zone)
#define	V_tcpcb_zone		VNET(shm_tcp->tcpcb_zone)
#define	V_tcptw_zone		VNET(shm_tcp->tcptw_zone)
#define	V_tcp_syncache_zone	VNET(shm_tcp->tcp_syncache_zone)
#define	V_sack_hole_zone	VNET(shm_tcp->ofp_sack_hole_zone)

{'fraction_non_alphanumeric': 0.10401891252955082, 'fraction_numerical': 0.013002364066193853, 'mean_word_length': 7.021327014218009, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5072882', 'n_tokens_mistral': 1655, 'n_tokens_neox': 1603, 'n_words': 256}