forked from iqiyi/dpvs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ipvs: add connection redirect support in fnat/snat/nat modes.
Since IPv6 flow director is not well-supported by ixgbe driver and only one single local IPv6 address can be set in "signature" mode, the below solution of connection redirect provides the way to support IPv6 packet processing with multiple local IPv6 addresses configured in "signature" mode. o Add the switch to enable or disable connection redirect. o In the case connection redirect is enabled, during the system boots up, the below resource is pre-allcoated. - Per-socket based connection redirect cache; - Per-socket based global connection redirect hash table; - Each lcore allocates its respective packet redirect rings for each other lcores to avoid the contention of enqueuing the packets in the same ring. o When a connection is created and hashed in fnat/nat/snat modes, the related redirect is allocated and hashed accordingly. o When a connection expires to be unhashed and freed in fnat/nat/snat modes, the related redirect is unhashed and freed accordingly. o In the stage of PRE_ROUTING, if the packet does not match any dpvs connection, then check if it matches any connection redirect entry. If matched, enqueue the packet into the packet redirect ring of the rediret owner core; otherwise, continue to process it on the current lcore. o Within lcore_job_recv_fwd(), add the task of dequeuing the packets from all the packet redirect rings owned by the current lcore and process them accordingly.
- Loading branch information
zhuangyan
committed
Jan 11, 2019
1 parent
70741bb
commit a9d16e3
Showing
12 changed files
with
974 additions
and
238 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,61 @@ | ||
/* | ||
* 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_REDIRECT_H__ | ||
#define __DPVS_REDIRECT_H__ | ||
#include "common.h" | ||
#include "list.h" | ||
#include "dpdk.h" | ||
#include "netif.h" | ||
#include "ipvs/conn.h" | ||
#include "ipvs/dest.h" | ||
|
||
/* | ||
* The conneciton redirect tuple is only for the reverse tuple | ||
* (inside -> outside) in nat-mode. | ||
*/ | ||
struct dp_vs_redirect { | ||
struct list_head list; | ||
|
||
uint8_t af; | ||
uint8_t proto; | ||
lcoreid_t cid; | ||
uint8_t padding; | ||
|
||
union inet_addr saddr; | ||
union inet_addr daddr; | ||
uint16_t sport; | ||
uint16_t dport; | ||
|
||
struct rte_mempool *redirect_pool; | ||
} __rte_cache_aligned; | ||
|
||
struct dp_vs_redirect *dp_vs_redirect_alloc(enum dpvs_fwd_mode fwdmode); | ||
void dp_vs_redirect_free(struct dp_vs_conn *conn); | ||
void dp_vs_redirect_hash(struct dp_vs_conn *conn); | ||
void dp_vs_redirect_unhash(struct dp_vs_conn *conn); | ||
struct dp_vs_redirect *dp_vs_redirect_get(int af, uint16_t proto, | ||
const union inet_addr *saddr, const union inet_addr *daddr, | ||
uint16_t sport, uint16_t dport); | ||
void dp_vs_redirect_init(struct dp_vs_conn *conn); | ||
int dp_vs_redirect_table_init(void); | ||
int dp_vs_redirect_pkt(struct rte_mbuf *mbuf, lcoreid_t peer_cid); | ||
void dp_vs_redirect_ring_proc(struct netif_queue_conf *qconf, lcoreid_t cid); | ||
int dp_vs_redirects_init(void); | ||
int dp_vs_redirects_term(void); | ||
|
||
#endif /* __DPVS_REDIRECT_H__ */ |
This file contains 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
Oops, something went wrong.