MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sp4_init

Function sp4_init

dpdk/examples/ipsec-secgw/sp4.c:554–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554void
555sp4_init(struct socket_ctx *ctx, int32_t socket_id)
556{
557 const char *name;
558
559 if (ctx == NULL)
560 rte_exit(EXIT_FAILURE, "NULL context.\n");
561
562 if (ctx->sp_ip4_in != NULL)
563 rte_exit(EXIT_FAILURE, "Inbound SP DB for socket %u already "
564 "initialized\n", socket_id);
565
566 if (ctx->sp_ip4_out != NULL)
567 rte_exit(EXIT_FAILURE, "Outbound SP DB for socket %u already "
568 "initialized\n", socket_id);
569
570 if (check_spi_value(ctx->sa_in, 1) < 0)
571 rte_exit(EXIT_FAILURE,
572 "Inbound IPv4 SP DB has unmatched in SAD SPIs\n");
573
574 if (check_spi_value(ctx->sa_out, 0) < 0)
575 rte_exit(EXIT_FAILURE,
576 "Outbound IPv4 SP DB has unmatched in SAD SPIs\n");
577
578 if (nb_acl4_rules_in > 0) {
579 name = "sp_ip4_in";
580 ctx->sp_ip4_in = (struct sp_ctx *)acl4_init(name,
581 socket_id, acl4_rules_in, nb_acl4_rules_in);
582 } else
583 RTE_LOG(WARNING, IPSEC, "No IPv4 SP Inbound rule "
584 "specified\n");
585
586 if (nb_acl4_rules_out > 0) {
587 name = "sp_ip4_out";
588 ctx->sp_ip4_out = (struct sp_ctx *)acl4_init(name,
589 socket_id, acl4_rules_out, nb_acl4_rules_out);
590 } else
591 RTE_LOG(WARNING, IPSEC, "No IPv4 SP Outbound rule "
592 "specified\n");
593}
594
595static int
596sp_cmp(const void *p, const void *q)

Callers 1

mainFunction · 0.85

Calls 3

rte_exitFunction · 0.85
acl4_initFunction · 0.85
check_spi_valueFunction · 0.70

Tested by

no test coverage detected