Skip to content

Commit

Permalink
Merge pull request iqiyi#1 from jwu26/master
Browse files Browse the repository at this point in the history
clean tabs in code
  • Loading branch information
beacer authored Oct 10, 2017
2 parents ee2099a + 75b1cea commit 2cb859e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
6 changes: 3 additions & 3 deletions include/dpdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
#include <rte_icmp.h>
#include <rte_string_fns.h>
#include <rte_malloc.h>
#include <rte_rwlock.h>
#include <rte_timer.h>
#include <rte_jhash.h>
#include <rte_rwlock.h>
#include <rte_timer.h>
#include <rte_jhash.h>
#include <rte_kni.h>
#include <rte_ip_frag.h>
#include <rte_eth_bond.h>
Expand Down
2 changes: 1 addition & 1 deletion src/ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ static inline int sockopt_msg_recv(int clt_fd, struct dpvs_sock_msg **pmsg)
//printf("%d bytes header recieved: msg-id = %u, msg-data-len = %zu\n",
// res, msg_hdr.id, msg_hdr.len);

*pmsg = rte_malloc("sockopt_msg",
*pmsg = rte_malloc("sockopt_msg",
sizeof(struct dpvs_sock_msg) + msg_hdr.len, RTE_CACHE_LINE_SIZE);
if (unlikely(NULL == *pmsg)) {
RTE_LOG(ERR, MSGMGR, "[%s] no memory\n", __func__);
Expand Down
14 changes: 7 additions & 7 deletions src/ip_vs_dest.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ struct dp_vs_dest *dp_vs_trash_get_dest(struct dp_vs_service *svc,
(svc->fwmark ||
(inet_addr_equal(svc->af, &dest->vaddr, &svc->addr) &&
dest->vport == svc->port))) {
return dest;
return dest;
}
if (rte_atomic32_read(&dest->refcnt) == 1) {
RTE_LOG(DEBUG, SERVICE, "%s: Removing destination from trash.\n", __func__);
Expand All @@ -160,7 +160,7 @@ void dp_vs_trash_cleanup(void)
list_del(&dest->n_list);
//dp_vs_dst_reset(dest);
__dp_vs_unbind_svc(dest);

dp_vs_del_stats(dest->stats);
rte_free(dest);
}
Expand All @@ -170,7 +170,7 @@ static void __dp_vs_update_dest(struct dp_vs_service *svc,
struct dp_vs_dest *dest, struct dp_vs_dest_conf *udest)
{
int conn_flags;

rte_atomic16_set(&dest->weight, udest->weight);
conn_flags = udest->conn_flags | DPVS_CONN_F_INACTIVE;

Expand All @@ -194,13 +194,13 @@ static void __dp_vs_update_dest(struct dp_vs_service *svc,
__dp_vs_bind_svc(dest, svc);
}
}

dest->flags |= DPVS_DEST_F_AVAILABLE;

if (udest->max_conn == 0 || udest->max_conn > dest->max_conn)
dest->flags &= ~DPVS_DEST_F_OVERLOAD;
dest->max_conn = udest->max_conn;
dest->min_conn = udest->min_conn;
dest->min_conn = udest->min_conn;
}


Expand All @@ -211,7 +211,7 @@ int dp_vs_new_dest(struct dp_vs_service *svc, struct dp_vs_dest_conf *udest,
struct dp_vs_dest *dest;
#ifdef CONFIG_IP_VS_IPV6
#endif
size = RTE_CACHE_LINE_ROUNDUP(sizeof(struct dp_vs_dest));
size = RTE_CACHE_LINE_ROUNDUP(sizeof(struct dp_vs_dest));
dest = rte_zmalloc("dpvs_new_dest", size, 0);
if(dest == NULL){
RTE_LOG(DEBUG, SERVICE, "%s: no memory.\n", __func__);
Expand All @@ -231,7 +231,7 @@ int dp_vs_new_dest(struct dp_vs_service *svc, struct dp_vs_dest_conf *udest,
rte_atomic32_set(&dest->inactconns, 0);
rte_atomic32_set(&dest->persistconns, 0);
rte_atomic32_set(&dest->refcnt, 0);

INIT_LIST_HEAD(&dest->d_list);

dp_vs_new_stats(&(dest->stats));
Expand Down
2 changes: 1 addition & 1 deletion src/ip_vs_wlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static inline unsigned int dp_vs_wlc_dest_overhead(struct dp_vs_dest *dest)
rte_atomic32_read(&dest->inactconns);
}

static struct dp_vs_dest *dp_vs_wlc_schedule(struct dp_vs_service *svc,
static struct dp_vs_dest *dp_vs_wlc_schedule(struct dp_vs_service *svc,
const struct rte_mbuf *mbuf)
{
struct dp_vs_dest *dest, *least;
Expand Down
44 changes: 22 additions & 22 deletions src/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ void install_ipv4_keywords(void)
static struct list_head inet_hooks[INET_HOOK_NUMHOOKS];
/**
* if remove this inet_hook_lock for performance,
* it assume all hook registeration are done
* during initialization, there's no race condition
* it assume all hook registeration are done
* during initialization, there's no race condition
* at that time. and never changed after that.
*/
#ifdef CONFIG_DPVS_IPV4_INET_HOOK
Expand All @@ -94,7 +94,7 @@ struct ip4_stats ip4_statistics;
rte_spinlock_t ip4_stats_lock;
#endif

int INET_HOOK(unsigned int hook, struct rte_mbuf *mbuf,
int INET_HOOK(unsigned int hook, struct rte_mbuf *mbuf,
struct netif_port *in, struct netif_port *out,
int (*okfn)(struct rte_mbuf *mbuf))
{
Expand Down Expand Up @@ -154,9 +154,9 @@ static void ip4_dump_hdr(const struct ipv4_hdr *iph, portid_t port)

fprintf(stderr, "lcore %u port%u ipv4 hl %u tos %u tot %u "
"id %u ttl %u prot %u src %s dst %s\n",
lcore, port, IPV4_HDR_IHL_MASK & iph->version_ihl,
iph->type_of_service, ntohs(iph->total_length),
ntohs(iph->packet_id), iph->time_to_live,
lcore, port, IPV4_HDR_IHL_MASK & iph->version_ihl,
iph->type_of_service, ntohs(iph->total_length),
ntohs(iph->packet_id), iph->time_to_live,
iph->next_proto_id, saddr, daddr);

return;
Expand Down Expand Up @@ -201,16 +201,16 @@ static int ipv4_local_in_fin(struct rte_mbuf *mbuf)
mbuf->userdata = NULL;
}

/*
/*
* give a change for upper layer to get IP header.
* skb uses ->data, ->transport_header, ->network_header, etc.
* but mbuf do not. Consider the length of header is variable
* (e.g., IPv4 options), it's not make sence for every layer
* (e.g., IPv4 options), it's not make sence for every layer
* to parse lower layer's headers.
* note if mbuf->userdata is not suitable, we can use 'extened'
* note if mbuf->userdata is not suitable, we can use 'extened'
* mbuf to save offsets like skb.
*
* BTW, if netif_port_get() called too many times we can also
* BTW, if netif_port_get() called too many times we can also
* use 'extend' mbuf to save 'netif_port *dev'.
*/
mbuf->userdata = iph;
Expand Down Expand Up @@ -242,7 +242,7 @@ static int ipv4_local_in(struct rte_mbuf *mbuf)
}
}

return INET_HOOK(INET_HOOK_LOCAL_IN, mbuf,
return INET_HOOK(INET_HOOK_LOCAL_IN, mbuf,
netif_port_get(mbuf->port), NULL, ipv4_local_in_fin);
}

Expand Down Expand Up @@ -290,7 +290,7 @@ int ipv4_output(struct rte_mbuf *mbuf)

IP4_UPD_PO_STATS(out, mbuf->pkt_len);

return INET_HOOK(INET_HOOK_POST_ROUTING, mbuf,
return INET_HOOK(INET_HOOK_POST_ROUTING, mbuf,
NULL, rt->port, ipv4_output_fin);
}

Expand All @@ -317,7 +317,7 @@ static int ipv4_forward(struct rte_mbuf *mbuf)
}

mtu = rt->mtu;
if (mbuf->pkt_len > mtu
if (mbuf->pkt_len > mtu
&& (iph->fragment_offset & htons(IPV4_HDR_DF_FLAG))) {
IP4_INC_STATS(fragfails);
icmp_send(mbuf, ICMP_DEST_UNREACH, ICMP_UNREACH_NEEDFRAG, htonl(mtu));
Expand All @@ -330,7 +330,7 @@ static int ipv4_forward(struct rte_mbuf *mbuf)
iph->hdr_checksum = (uint16_t)(csum + (csum >= 0xffff));
iph->time_to_live--;

return INET_HOOK(INET_HOOK_FORWARD, mbuf,
return INET_HOOK(INET_HOOK_FORWARD, mbuf,
netif_port_get(mbuf->port), rt->port, ipv4_forward_fin);

drop:
Expand All @@ -353,8 +353,8 @@ static int ipv4_rcv_fin(struct rte_mbuf *mbuf)
eth_type_t etype = mbuf->packet_type; /* FIXME: use other field ? */

/* input route decision */
rt = route4_input(mbuf, (struct in_addr *)&iph->dst_addr,
(struct in_addr *)&iph->src_addr,
rt = route4_input(mbuf, (struct in_addr *)&iph->dst_addr,
(struct in_addr *)&iph->src_addr,
iph->type_of_service, netif_port_get(mbuf->port));
if (unlikely(!rt))
return EDPVS_KNICONTINUE; /* KNI may like it, don't drop */
Expand All @@ -366,7 +366,7 @@ static int ipv4_rcv_fin(struct rte_mbuf *mbuf)
goto drop;
}
}

/* use extended mbuf if have more data then @rt */
mbuf->userdata = (void *)rt;

Expand Down Expand Up @@ -468,7 +468,7 @@ int ipv4_init(void)
{
int err, i;

ip4_idents = rte_malloc(NULL, IP4_IDENTS_SZ * sizeof(*ip4_idents),
ip4_idents = rte_malloc(NULL, IP4_IDENTS_SZ * sizeof(*ip4_idents),
RTE_CACHE_LINE_SIZE);
if (!ip4_idents)
return EDPVS_NOMEM;
Expand Down Expand Up @@ -593,15 +593,15 @@ int ipv4_xmit(struct rte_mbuf *mbuf, const struct flow4 *fl4)
if (iph->src_addr == htonl(INADDR_ANY)) {
union inet_addr saddr;

inet_addr_select(AF_INET, rt->port, (union inet_addr *)&fl4->daddr,
inet_addr_select(AF_INET, rt->port, (union inet_addr *)&fl4->daddr,
fl4->scope, &saddr);
iph->src_addr = saddr.in.s_addr;
}

return ipv4_local_out(mbuf);
}

int ipv4_register_protocol(struct inet_protocol *prot,
int ipv4_register_protocol(struct inet_protocol *prot,
unsigned char protocol)
{
int err = EDPVS_OK;
Expand All @@ -616,7 +616,7 @@ int ipv4_register_protocol(struct inet_protocol *prot,
return err;
}

int ipv4_unregister_protocol(struct inet_protocol *prot,
int ipv4_unregister_protocol(struct inet_protocol *prot,
unsigned char protocol)
{
int err = EDPVS_OK;
Expand All @@ -631,7 +631,7 @@ int ipv4_unregister_protocol(struct inet_protocol *prot,
return err;
}

static int __inet_register_hooks(struct list_head *head,
static int __inet_register_hooks(struct list_head *head,
struct inet_hook_ops *reg)
{
struct inet_hook_ops *elem;
Expand Down

0 comments on commit 2cb859e

Please sign in to comment.