mcg.c (62b31a045757eac81fed94b19df47418a0818528) mcg.c (45808361d4491217de11cdf0661d657081f8f422)
1/*
2 * Copyright (c) 2012 Mellanox Technologies. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 974 unchanged lines hidden (view full) ---

983 default:
984 mcg_warn("In multiplex, port %d, func %d: unexpected MCMember method: 0x%x, dropping\n",
985 port, slave, sa_mad->mad_hdr.method);
986 return 1; /* consumed */
987 }
988}
989
990static ssize_t sysfs_show_group(struct device *dev,
1/*
2 * Copyright (c) 2012 Mellanox Technologies. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 974 unchanged lines hidden (view full) ---

983 default:
984 mcg_warn("In multiplex, port %d, func %d: unexpected MCMember method: 0x%x, dropping\n",
985 port, slave, sa_mad->mad_hdr.method);
986 return 1; /* consumed */
987 }
988}
989
990static ssize_t sysfs_show_group(struct device *dev,
991 struct device_attribute *attr, char *buf)
991 struct device_attribute *attr, char *buf)
992{
993 struct mcast_group *group =
994 container_of(attr, struct mcast_group, dentry);
995 struct mcast_req *req = NULL;
992{
993 struct mcast_group *group =
994 container_of(attr, struct mcast_group, dentry);
995 struct mcast_req *req = NULL;
996 char pending_str[40];
997 char state_str[40];
996 char state_str[40];
998 ssize_t len = 0;
999 int f;
997 char pending_str[40];
998 int len;
999 int i;
1000 u32 hoplimit;
1000
1001 if (group->state == MCAST_IDLE)
1001
1002 if (group->state == MCAST_IDLE)
1002 sprintf(state_str, "%s", get_state_string(group->state));
1003 scnprintf(state_str, sizeof(state_str), "%s",
1004 get_state_string(group->state));
1003 else
1005 else
1004 sprintf(state_str, "%s(TID=0x%llx)",
1005 get_state_string(group->state),
1006 be64_to_cpu(group->last_req_tid));
1006 scnprintf(state_str, sizeof(state_str), "%s(TID=0x%llx)",
1007 get_state_string(group->state),
1008 be64_to_cpu(group->last_req_tid));
1009
1007 if (list_empty(&group->pending_list)) {
1010 if (list_empty(&group->pending_list)) {
1008 sprintf(pending_str, "No");
1011 scnprintf(pending_str, sizeof(pending_str), "No");
1009 } else {
1012 } else {
1010 req = list_first_entry(&group->pending_list, struct mcast_req, group_list);
1011 sprintf(pending_str, "Yes(TID=0x%llx)",
1012 be64_to_cpu(req->sa_mad.mad_hdr.tid));
1013 req = list_first_entry(&group->pending_list, struct mcast_req,
1014 group_list);
1015 scnprintf(pending_str, sizeof(pending_str), "Yes(TID=0x%llx)",
1016 be64_to_cpu(req->sa_mad.mad_hdr.tid));
1013 }
1017 }
1014 len += sprintf(buf + len, "%1d [%02d,%02d,%02d] %4d %4s %5s ",
1015 group->rec.scope_join_state & 0xf,
1016 group->members[2], group->members[1], group->members[0],
1017 atomic_read(&group->refcount),
1018 pending_str,
1019 state_str);
1020 for (f = 0; f < MAX_VFS; ++f)
1021 if (group->func[f].state == MCAST_MEMBER)
1022 len += sprintf(buf + len, "%d[%1x] ",
1023 f, group->func[f].join_state);
1024
1018
1025 len += sprintf(buf + len, "\t\t(%4hx %4x %2x %2x %2x %2x %2x "
1026 "%4x %4x %2x %2x)\n",
1027 be16_to_cpu(group->rec.pkey),
1028 be32_to_cpu(group->rec.qkey),
1029 (group->rec.mtusel_mtu & 0xc0) >> 6,
1030 group->rec.mtusel_mtu & 0x3f,
1031 group->rec.tclass,
1032 (group->rec.ratesel_rate & 0xc0) >> 6,
1033 group->rec.ratesel_rate & 0x3f,
1034 (be32_to_cpu(group->rec.sl_flowlabel_hoplimit) & 0xf0000000) >> 28,
1035 (be32_to_cpu(group->rec.sl_flowlabel_hoplimit) & 0x0fffff00) >> 8,
1036 be32_to_cpu(group->rec.sl_flowlabel_hoplimit) & 0x000000ff,
1037 group->rec.proxy_join);
1019 len = sysfs_emit(buf, "%1d [%02d,%02d,%02d] %4d %4s %5s ",
1020 group->rec.scope_join_state & 0xf,
1021 group->members[2],
1022 group->members[1],
1023 group->members[0],
1024 atomic_read(&group->refcount),
1025 pending_str,
1026 state_str);
1038
1027
1028 for (i = 0; i < MAX_VFS; i++) {
1029 if (group->func[i].state == MCAST_MEMBER)
1030 len += sysfs_emit_at(buf, len, "%d[%1x] ", i,
1031 group->func[i].join_state);
1032 }
1033
1034 hoplimit = be32_to_cpu(group->rec.sl_flowlabel_hoplimit);
1035 len += sysfs_emit_at(buf, len,
1036 "\t\t(%4hx %4x %2x %2x %2x %2x %2x %4x %4x %2x %2x)\n",
1037 be16_to_cpu(group->rec.pkey),
1038 be32_to_cpu(group->rec.qkey),
1039 (group->rec.mtusel_mtu & 0xc0) >> 6,
1040 (group->rec.mtusel_mtu & 0x3f),
1041 group->rec.tclass,
1042 (group->rec.ratesel_rate & 0xc0) >> 6,
1043 (group->rec.ratesel_rate & 0x3f),
1044 (hoplimit & 0xf0000000) >> 28,
1045 (hoplimit & 0x0fffff00) >> 8,
1046 (hoplimit & 0x000000ff),
1047 group->rec.proxy_join);
1048
1039 return len;
1040}
1041
1042int mlx4_ib_mcg_port_init(struct mlx4_ib_demux_ctx *ctx)
1043{
1044 char name[20];
1045
1046 atomic_set(&ctx->tid, 0);

--- 211 unchanged lines hidden ---
1049 return len;
1050}
1051
1052int mlx4_ib_mcg_port_init(struct mlx4_ib_demux_ctx *ctx)
1053{
1054 char name[20];
1055
1056 atomic_set(&ctx->tid, 0);

--- 211 unchanged lines hidden ---