-
Notifications
You must be signed in to change notification settings - Fork 753
dpvs session synchronization #476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
weiyanhua100
wants to merge
4
commits into
iqiyi:devel
Choose a base branch
from
weiyanhua100:sync
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f394d1b
make it possible to bind laddr to lcore by adding laddr_lcore_mapping
066bc17
session_sync: Add session sync to decrease the connection break due t…
kldeng f73ea54
Add identifiers for Synchronized sessions.
a3130ed
add readme for session sync.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -371,4 +371,5 @@ ipvs_defs { | |
| ! sa_pool config | ||
| sa_pool { | ||
| pool_hash_size 16 | ||
| pool_mode laddr_lcore_mapping | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -245,4 +245,5 @@ ipvs_defs { | |
|
|
||
| sa_pool { | ||
| <init> pool_hash_size 16 <16, 1-128> | ||
| <init> pool_mode laddr_lcore_mapping | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -276,4 +276,5 @@ ipvs_defs { | |
| ! sa_pool config | ||
| sa_pool { | ||
| pool_hash_size 16 | ||
| pool_mode laddr_lcore_mapping | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -249,4 +249,5 @@ ipvs_defs { | |
| ! sa_pool config | ||
| sa_pool { | ||
| pool_hash_size 16 | ||
| pool_mode laddr_lcore_mapping | ||
| } | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| /* | ||
| * DPVS is a software load balancer (Virtual Server) based on DPDK. | ||
| * | ||
| * Copyright (C) 2017 iQIYI (www.iqiyi.com). | ||
| * All Rights Reserved. | ||
| * | ||
| * This program is free software; you can redistribute it and/or | ||
| * modify it under the terms of the GNU General Public License | ||
| * as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| */ | ||
| #ifndef __DPVS_SYNC_H__ | ||
| #define __DPVS_SYNC_H__ | ||
|
|
||
| #include "common.h" | ||
| #include "list.h" | ||
| #include "ipvs/conn.h" | ||
|
|
||
| #define RTE_LOGTYPE_SYNC RTE_LOGTYPE_USER1 | ||
|
|
||
| #define CONN_SYNC_RING_SIZE 2048 | ||
|
|
||
| /* maximum pkt number at a single burst */ | ||
| #define CONN_SYNC_MAX_PKT_BURST 32 | ||
|
|
||
| /* | ||
| * DPVS sync connection entry | ||
| */ | ||
| struct dp_vs_sync_conn { | ||
| uint8_t reserved; | ||
|
|
||
| int af; | ||
| uint8_t proto; | ||
| union inet_addr caddr; /* Client address */ | ||
| union inet_addr vaddr; /* Virtual address */ | ||
| union inet_addr laddr; /* director Local address */ | ||
| union inet_addr daddr; /* Destination (RS) address */ | ||
| uint16_t cport; | ||
| uint16_t vport; | ||
| uint16_t lport; | ||
| uint16_t dport; | ||
| queueid_t qid; | ||
| lcoreid_t lcore; | ||
|
|
||
| /* Flags and state transition */ | ||
| uint16_t flags; /* status flags */ | ||
| uint16_t state; /* state info */ | ||
|
|
||
| /* The sequence options start here */ | ||
| struct dp_vs_seq fnat_seq; | ||
| uint32_t rs_end_seq; | ||
| uint32_t rs_end_ack; | ||
| uint16_t syncid; | ||
| }; | ||
|
|
||
| struct dp_vs_sync_head { | ||
| uint8_t type; | ||
| uint8_t syncid; | ||
| uint16_t size; | ||
| }; | ||
|
|
||
| struct dp_vs_sync_mesg { | ||
| struct dp_vs_sync_head head; | ||
| uint8_t nr_conns; | ||
| }; | ||
weiyanhua100 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| struct dp_vs_sync_nego { | ||
| struct dp_vs_sync_head head; | ||
| uint32_t code; | ||
| uint8_t peer_syncid; | ||
| uint64_t uptime; | ||
| }; | ||
|
|
||
| struct dp_vs_sync_peer { | ||
| uint8_t syncid; | ||
| uint64_t uptime; | ||
| struct sockaddr_in addr; | ||
| }; | ||
|
|
||
| struct dp_vs_sync_buff { | ||
| struct list_head list; | ||
| uint64_t firstuse; | ||
|
|
||
| /* pointers for the message data */ | ||
| struct dp_vs_sync_mesg *mesg; | ||
| unsigned char *head; | ||
| unsigned char *end; | ||
| }; | ||
|
|
||
| struct dp_vs_sync_fwd_core { | ||
| int cid; | ||
| int last_index; | ||
| bool start; | ||
| bool end; | ||
| }; | ||
|
|
||
| struct dp_vs_sync_core { | ||
| int core_cnt; | ||
| struct dp_vs_sync_fwd_core fwd_core[DPVS_MAX_LCORE]; | ||
| }; | ||
|
|
||
| typedef enum { | ||
| DP_VS_SYNC_MCAST = 0, | ||
| DP_VS_SYNC_UNICAST = 1, | ||
| DP_VS_SYNC_MAX = 2, | ||
| } dp_vs_sync_type; | ||
|
|
||
| struct dp_vs_sync_conf { | ||
| lcoreid_t sync_rx_lcore; | ||
| lcoreid_t sync_tx_lcore; | ||
| int syncid; | ||
| int sync_enable; | ||
| int sync_conn_elapse; | ||
| int sync_buff_delay; | ||
| int sync_per_time_cnt; | ||
| int send_mesg_maxlen; | ||
| int recv_mesg_maxlen; | ||
| char laddr_ifname[IFNAMSIZ]; | ||
| }; | ||
|
|
||
| #define DP_VS_SYNC_CONN_SIZE (sizeof(struct dp_vs_sync_conn)) | ||
| #define DP_VS_SYNC_MESG_HEADER_LEN (sizeof(struct dp_vs_sync_mesg)) | ||
|
|
||
| #define DP_VS_SYNC_CONN_INFO (0) | ||
| #define DP_VS_SYNC_NEGO_INFO (1) | ||
|
|
||
| #define DP_VS_SYNC_INFO_PROBE_CODE (0) | ||
| #define DP_VS_SYNC_INFO_REPLY_CODE (1) | ||
| #define DP_VS_SYNC_INFO_FETCH_CODE (2) | ||
| #define DP_VS_SYNC_INFO_DONE_CODE (3) | ||
|
|
||
| #define DP_VS_SYNC_DELAY_SECONDS (2) | ||
| #define DP_VS_SYNC_CONN_CNT_PER_TIME (128) | ||
|
|
||
| #define MAX(x, y) ((x) > (y) ? (x) : (y)) | ||
|
|
||
| extern struct dp_vs_sync_core g_dp_vs_sync_fwd_core; | ||
| #define DP_VS_SYNC_FULL_IS_START(cid) \ | ||
| (g_dp_vs_sync_fwd_core.fwd_core[cid].start == true) | ||
|
|
||
| #define DP_VS_SYNC_FULL_IS_END(cid) \ | ||
| (g_dp_vs_sync_fwd_core.fwd_core[cid].end == true) | ||
|
|
||
| #define DP_VS_SYNC_FULL_SET_LAST_INDEX(cid, index) \ | ||
| (g_dp_vs_sync_fwd_core.fwd_core[cid].last_index = index) | ||
|
|
||
| #define DP_VS_SYNC_FULL_GET_LAST_INDEX(cid) \ | ||
| (g_dp_vs_sync_fwd_core.fwd_core[cid].last_index) | ||
|
|
||
| extern struct dp_vs_sync_conf g_dp_vs_sync_conf; | ||
| #define DP_VS_SYNC_FULL_CNT_PER_TIME \ | ||
| g_dp_vs_sync_conf.sync_per_time_cnt | ||
|
|
||
| void dp_vs_sync_conn_enqueue(struct dp_vs_conn *cp, dp_vs_sync_type type); | ||
| int dp_vs_sync_conn_handler(struct dp_vs_conn *conn, int new_state); | ||
| int dp_vs_sync_lcore_process_rx_msg(lcoreid_t cid); | ||
| int dp_vs_sync_set_rx_core(lcoreid_t cid); | ||
| int dp_vs_sync_set_tx_core(lcoreid_t cid); | ||
| void dp_vs_sync_run_loop(lcoreid_t cid); | ||
| int dp_vs_sync_init(void); | ||
| int dp_vs_sync_term(void); | ||
|
|
||
| int dp_vs_sync_recv_nego(const char * buf, int len, | ||
| struct sockaddr_in* remote_addr); | ||
| int dp_vs_sync_full_end(lcoreid_t cid); | ||
| int dp_vs_sync_full_start(lcoreid_t cid); | ||
| int dp_vs_sync_conn_start(void); | ||
| char* dp_vs_sync_laddr_ifname(void); | ||
| void install_session_sync_keywords(void); | ||
|
|
||
| #endif /* __DPVS_SYNC_H__ */ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.