MACsec Intel FPGA System Design User Guide

ID 767516
Date 6/26/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

6.7.3.4. Netlink Interface

The MACsec IP driver accesses memory mapped MACsec IP registers over the AXI bus. This module communicates with user-space over netlink socket. The details of netlink structure, family, and API's are as follows:

NETLINK STRUCTURE

The CLI talks with linux kernel module over a netlink communication channel. The netlink family used to establish this communication is "GENERIC_NETLINK". There are 4 main netlink commands used for configuring the MACsec IP. These are:
  1. INTEL_MACSEC_C_GETATTR
  2. INTEL_MACSEC_C_SETATTR
  3. INTEL_MACSEC_C_GETSAATTR
  4. INTEL_MACSEC_C_SETSAATTR

The above netlink commands are responsible for handling macsec_get_attr(), macsec_set_attr(), macsec_get_sa_attr() and macsec_set_sa_attr() APIs based on invokation from the CLI.

The 2 additional commands, which are used to write/read the MACsec PPBB IP device registers directly, are:
  1. INTEL_MACSEC_C_PPBB_READREG
  2. INTEL_MACSEC_C_PPBB_WRITEREG
Apart from the commands above, there are 2 additional commands, which are used to peek-and-poke MACsec IP device registers directly. This read-write functionality is helpful in debugging. These commands are:
  1. INTEL_MACSEC_C_READREG
  2. INTEL_MACSEC_C_WRITEREG
The netlink protocol is a socket based communication. The socket attributes used for exchange of information between the CLI and Kernel are:
  1. INTEL_MACSEC_A_PORT
  2. INTEL_MACSEC_A_ATTR
  3. INTEL_MACSEC_A_RW_VAL
  4. INTEL_MACSEC_A_SC
  5. INTEL_MACSEC_A_SA

The above netlink attributes correspond to the MACsec ip port value, MACsec ip command attribute, read/write value for a particular command attribute, MACsec ip secure channel value, and MACsec ip secure association value.

Apart from the main attributes above there is 1 additional attribute used for debugging. This helps program offset the device register to be programmed. The attribute is:
  • INTEL_MACSEC_A_OFFSET

NETLINK FAMILY

The linux kernel module registers a generic netlink family name, on which the kernel routes any user-space interaction. A Linux kernel can have multiple netlink families registered at a time. A User-space application has to mention the corresponding name to interact with a particular netlink channel.

The MACsec IP kernel module registers with "intel_MACsec" as a netlink family name, which is used by the CLI to interact with the Kernel module.

NETLINK HANDLER FUNCTIONS

The linux kernel module registers 6 handlers for all of the above netlink commands. These handler functions are:
  1. genl_get_attr()
  2. genl_set_attr()
  3. genl_get_sa_attr()
  4. genl_set_sa_attr()
  5. genl_ppbb_read_reg()
  6. genl_ppbb_write_reg()
  7. genl_read_reg()
  8. genl_write_reg()

All of the above handlers receive socket buffer information from the CLI, invoke the respective MACsec IP API, on success return the data received from the API, on failure returns the error code back to the CLI.