Skip to content

Commit

Permalink
IB/opa-vnic: VNIC Ethernet Management Agent (VEMA) function
Browse files Browse the repository at this point in the history
OPA VEMA function interfaces with the Infiniband MAD stack to exchange the
management information packets with the Ethernet Manager (EM).
It interfaces with the OPA VNIC netdev function to SET/GET the management
information. The information exchanged with the EM includes class port
details, encapsulation configuration, various counters, unicast and
multicast MAC list and the MAC table. It also supports sending traps
to the EM.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Sadanand Warrier <sadanand.warrier@intel.com>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Vishwanathapura, Niranjana authored and Doug Ledford committed Apr 20, 2017
1 parent cfd34f8 commit 1bd671a
Show file tree
Hide file tree
Showing 5 changed files with 1,106 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/infiniband/ulp/opa_vnic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
obj-$(CONFIG_INFINIBAND_OPA_VNIC) += opa_vnic.o

opa_vnic-y := opa_vnic_netdev.o opa_vnic_encap.o opa_vnic_ethtool.o \
opa_vnic_vema_iface.o
opa_vnic_vema.o opa_vnic_vema_iface.o
12 changes: 12 additions & 0 deletions drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ static struct vnic_stats vnic_gstrings_stats[] = {

#define VNIC_STATS_LEN ARRAY_SIZE(vnic_gstrings_stats)

/* vnic_get_drvinfo - get driver info */
static void vnic_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *drvinfo)
{
strlcpy(drvinfo->driver, opa_vnic_driver_name, sizeof(drvinfo->driver));
strlcpy(drvinfo->version, opa_vnic_driver_version,
sizeof(drvinfo->version));
strlcpy(drvinfo->bus_info, dev_name(netdev->dev.parent),
sizeof(drvinfo->bus_info));
}

/* vnic_get_sset_count - get string set count */
static int vnic_get_sset_count(struct net_device *netdev, int sset)
{
Expand Down Expand Up @@ -162,6 +173,7 @@ static void vnic_get_strings(struct net_device *netdev, u32 stringset, u8 *data)

/* ethtool ops */
static const struct ethtool_ops opa_vnic_ethtool_ops = {
.get_drvinfo = vnic_get_drvinfo,
.get_link = ethtool_op_get_link,
.get_strings = vnic_get_strings,
.get_sset_count = vnic_get_sset_count,
Expand Down
17 changes: 14 additions & 3 deletions drivers/infiniband/ulp/opa_vnic/opa_vnic_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,12 @@ struct __opa_veswport_trap {
* struct opa_vnic_ctrl_port - OPA virtual NIC control port
* @ibdev: pointer to ib device
* @ops: opa vnic control operations
* @num_ports: number of opa ports
*/
struct opa_vnic_ctrl_port {
struct ib_device *ibdev;
struct opa_vnic_ctrl_ops *ops;
u8 num_ports;
};

/**
Expand All @@ -187,6 +189,8 @@ struct opa_vnic_ctrl_port {
* @mactbl_lock: mac table lock
* @stats_lock: statistics lock
* @flow_tbl: flow to default port redirection table
* @trap_timeout: trap timeout
* @trap_count: no. of traps allowed within timeout period
*/
struct opa_vnic_adapter {
struct net_device *netdev;
Expand All @@ -213,6 +217,9 @@ struct opa_vnic_adapter {
struct mutex stats_lock;

u8 flow_tbl[OPA_VNIC_FLOW_TBL_SIZE];

unsigned long trap_timeout;
u8 trap_count;
};

/* Same as opa_veswport_mactable_entry, but without bitwise attribute */
Expand Down Expand Up @@ -247,6 +254,8 @@ struct opa_vnic_mac_tbl_node {
dev_err(&cport->ibdev->dev, format, ## arg)
#define c_info(format, arg...) \
dev_info(&cport->ibdev->dev, format, ## arg)
#define c_dbg(format, arg...) \
dev_dbg(&cport->ibdev->dev, format, ## arg)

/* The maximum allowed entries in the mac table */
#define OPA_VNIC_MAC_TBL_MAX_ENTRIES 2048
Expand Down Expand Up @@ -281,6 +290,9 @@ struct opa_vnic_mac_tbl_node {
!obj && (bkt) < OPA_VNIC_MAC_TBL_SIZE; (bkt)++) \
hlist_for_each_entry(obj, &name[bkt], member)

extern char opa_vnic_driver_name[];
extern const char opa_vnic_driver_version[];

struct opa_vnic_adapter *opa_vnic_add_netdev(struct ib_device *ibdev,
u8 port_num, u8 vport_num);
void opa_vnic_rem_netdev(struct opa_vnic_adapter *adapter);
Expand Down Expand Up @@ -310,9 +322,8 @@ void opa_vnic_get_per_veswport_info(struct opa_vnic_adapter *adapter,
void opa_vnic_set_per_veswport_info(struct opa_vnic_adapter *adapter,
struct opa_per_veswport_info *info);
void opa_vnic_vema_report_event(struct opa_vnic_adapter *adapter, u8 event);
struct opa_vnic_adapter *opa_vnic_add_vport(struct opa_vnic_ctrl_port *cport,
u8 port_num, u8 vport_num);
void opa_vnic_rem_vport(struct opa_vnic_adapter *adapter);
void opa_vnic_set_ethtool_ops(struct net_device *netdev);
void opa_vnic_vema_send_trap(struct opa_vnic_adapter *adapter,
struct __opa_veswport_trap *data, u32 lid);

#endif /* _OPA_VNIC_INTERNAL_H */
Loading

0 comments on commit 1bd671a

Please sign in to comment.