ncsi-netlink.c (30596ec32e2cd141d73ee8701386887def9e98c0) | ncsi-netlink.c (062b3e1b6d4f2a33c1d0fd7ae9b4550da5cf7e4b) |
---|---|
1/* 2 * Copyright Samuel Mendoza-Jonas, IBM Corporation 2018. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 */ --- 44 unchanged lines hidden (view full) --- 53 dev_put(dev); 54 return ndp; 55} 56 57static int ncsi_write_channel_info(struct sk_buff *skb, 58 struct ncsi_dev_priv *ndp, 59 struct ncsi_channel *nc) 60{ | 1/* 2 * Copyright Samuel Mendoza-Jonas, IBM Corporation 2018. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 */ --- 44 unchanged lines hidden (view full) --- 53 dev_put(dev); 54 return ndp; 55} 56 57static int ncsi_write_channel_info(struct sk_buff *skb, 58 struct ncsi_dev_priv *ndp, 59 struct ncsi_channel *nc) 60{ |
61 struct nlattr *vid_nest; 62 struct ncsi_channel_filter *ncf; | 61 struct ncsi_channel_vlan_filter *ncf; |
63 struct ncsi_channel_mode *m; | 62 struct ncsi_channel_mode *m; |
64 u32 *data; | 63 struct nlattr *vid_nest; |
65 int i; 66 67 nla_put_u32(skb, NCSI_CHANNEL_ATTR_ID, nc->id); 68 m = &nc->modes[NCSI_MODE_LINK]; 69 nla_put_u32(skb, NCSI_CHANNEL_ATTR_LINK_STATE, m->data[2]); 70 if (nc->state == NCSI_CHANNEL_ACTIVE) 71 nla_put_flag(skb, NCSI_CHANNEL_ATTR_ACTIVE); 72 if (ndp->force_channel == nc) 73 nla_put_flag(skb, NCSI_CHANNEL_ATTR_FORCED); 74 75 nla_put_u32(skb, NCSI_CHANNEL_ATTR_VERSION_MAJOR, nc->version.version); 76 nla_put_u32(skb, NCSI_CHANNEL_ATTR_VERSION_MINOR, nc->version.alpha2); 77 nla_put_string(skb, NCSI_CHANNEL_ATTR_VERSION_STR, nc->version.fw_name); 78 79 vid_nest = nla_nest_start(skb, NCSI_CHANNEL_ATTR_VLAN_LIST); 80 if (!vid_nest) 81 return -ENOMEM; | 64 int i; 65 66 nla_put_u32(skb, NCSI_CHANNEL_ATTR_ID, nc->id); 67 m = &nc->modes[NCSI_MODE_LINK]; 68 nla_put_u32(skb, NCSI_CHANNEL_ATTR_LINK_STATE, m->data[2]); 69 if (nc->state == NCSI_CHANNEL_ACTIVE) 70 nla_put_flag(skb, NCSI_CHANNEL_ATTR_ACTIVE); 71 if (ndp->force_channel == nc) 72 nla_put_flag(skb, NCSI_CHANNEL_ATTR_FORCED); 73 74 nla_put_u32(skb, NCSI_CHANNEL_ATTR_VERSION_MAJOR, nc->version.version); 75 nla_put_u32(skb, NCSI_CHANNEL_ATTR_VERSION_MINOR, nc->version.alpha2); 76 nla_put_string(skb, NCSI_CHANNEL_ATTR_VERSION_STR, nc->version.fw_name); 77 78 vid_nest = nla_nest_start(skb, NCSI_CHANNEL_ATTR_VLAN_LIST); 79 if (!vid_nest) 80 return -ENOMEM; |
82 ncf = nc->filters[NCSI_FILTER_VLAN]; | 81 ncf = &nc->vlan_filter; |
83 i = -1; | 82 i = -1; |
84 if (ncf) { 85 while ((i = find_next_bit((void *)&ncf->bitmap, ncf->total, 86 i + 1)) < ncf->total) { 87 data = ncsi_get_filter(nc, NCSI_FILTER_VLAN, i); 88 /* Uninitialised channels will have 'zero' vlan ids */ 89 if (!data || !*data) 90 continue; | 83 while ((i = find_next_bit((void *)&ncf->bitmap, ncf->n_vids, 84 i + 1)) < ncf->n_vids) { 85 if (ncf->vids[i]) |
91 nla_put_u16(skb, NCSI_CHANNEL_ATTR_VLAN_ID, | 86 nla_put_u16(skb, NCSI_CHANNEL_ATTR_VLAN_ID, |
92 *(u16 *)data); 93 } | 87 ncf->vids[i]); |
94 } 95 nla_nest_end(skb, vid_nest); 96 97 return 0; 98} 99 100static int ncsi_write_package_info(struct sk_buff *skb, 101 struct ncsi_dev_priv *ndp, unsigned int id) --- 326 unchanged lines hidden --- | 88 } 89 nla_nest_end(skb, vid_nest); 90 91 return 0; 92} 93 94static int ncsi_write_package_info(struct sk_buff *skb, 95 struct ncsi_dev_priv *ndp, unsigned int id) --- 326 unchanged lines hidden --- |