[dpdk-dev] [PATCH v4 10/12] net/ixgbe: enable inline ipsec

Ananyev, Konstantin konstantin.ananyev at intel.com
Thu Oct 19 11:04:46 CEST 2017



> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 14b9c53..fcabd5e 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -61,6 +61,7 @@
>  #include <rte_random.h>
>  #include <rte_dev.h>
>  #include <rte_hash_crc.h>
> +#include <rte_security_driver.h>
> 
>  #include "ixgbe_logs.h"
>  #include "base/ixgbe_api.h"
> @@ -1132,6 +1133,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
>  		IXGBE_DEV_PRIVATE_TO_FILTER_INFO(eth_dev->data->dev_private);
>  	struct ixgbe_bw_conf *bw_conf =
>  		IXGBE_DEV_PRIVATE_TO_BW_CONF(eth_dev->data->dev_private);
> +	struct rte_security_ctx *security_instance;
>  	uint32_t ctrl_ext;
>  	uint16_t csum;
>  	int diag, i;
> @@ -1139,6 +1141,17 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
>  	PMD_INIT_FUNC_TRACE();
> 
>  	eth_dev->dev_ops = &ixgbe_eth_dev_ops;
> +	security_instance = rte_malloc("rte_security_instances_ops",
> +				sizeof(struct rte_security_ctx), 0);
> +	if (security_instance == NULL)
> +		return -ENOMEM;
> +	security_instance->state = RTE_SECURITY_INSTANCE_VALID;
> +	security_instance->device = (void *)eth_dev;
> +	security_instance->ops = &ixgbe_security_ops;
> +	security_instance->sess_cnt = 0;
> +

As another nit - can we move the code above into a separate function
into ixgbe_ipsec.c?
Something like ixgbe_ipsec_ctx_create() or so?
Konstantin

> +	eth_dev->data->security_ctx = security_instance;
> +
>  	eth_dev->rx_pkt_burst = &ixgbe_recv_pkts;
>  	eth_dev->tx_pkt_burst = &ixgbe_xmit_pkts;
>  	eth_dev->tx_pkt_prepare = &ixgbe_prep_pkts;
> @@ -1169,6 +1182,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
> 
>  	rte_eth_copy_pci_info(eth_dev, pci_dev);
>  	eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
> +	eth_dev->data->dev_flags |= RTE_ETH_DEV_SECURITY;
> 
>  	/* Vendor and Device ID need to be set before init of shared code */
>  	hw->device_id = pci_dev->id.device_id;
> @@ -1401,6 +1415,8 @@ eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
>  	/* Remove all Traffic Manager configuration */
>  	ixgbe_tm_conf_uninit(eth_dev);
> 
> +	rte_free(eth_dev->data->security_ctx);
> +
>  	return 0;
>  }
> 


More information about the dev mailing list