Commit 1bd671ab authored by Vishwanathapura, Niranjana's avatar Vishwanathapura, Niranjana Committed by Doug Ledford

IB/opa-vnic: VNIC Ethernet Management Agent (VEMA) function

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: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarSadanand Warrier <sadanand.warrier@intel.com>
Signed-off-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: default avatarSudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent cfd34f8e
......@@ -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
......@@ -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)
{
......@@ -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,
......
......@@ -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;
};
/**
......@@ -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;
......@@ -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 */
......@@ -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
......@@ -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);
......@@ -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 */
This diff is collapsed.
......@@ -70,7 +70,7 @@ void opa_vnic_vema_report_event(struct opa_vnic_adapter *adapter, u8 event)
trap_data.veswportindex = adapter->vport_num;
trap_data.opcode = event;
/* Need to send trap here */
opa_vnic_vema_send_trap(adapter, &trap_data, info->vport.encap_slid);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment