aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/s390/include/asm/css_chars.h2
-rw-r--r--arch/s390/include/asm/qdio.h33
-rw-r--r--drivers/s390/cio/chsc.c33
-rw-r--r--drivers/s390/cio/chsc.h51
-rw-r--r--drivers/s390/cio/qdio_main.c91
5 files changed, 209 insertions, 1 deletions
diff --git a/arch/s390/include/asm/css_chars.h b/arch/s390/include/asm/css_chars.h
index 7e1c917bbba2..09d1dd46bd57 100644
--- a/arch/s390/include/asm/css_chars.h
+++ b/arch/s390/include/asm/css_chars.h
@@ -29,6 +29,8 @@ struct css_general_char {
29 u32 fcx : 1; /* bit 88 */ 29 u32 fcx : 1; /* bit 88 */
30 u32 : 19; 30 u32 : 19;
31 u32 alt_ssi : 1; /* bit 108 */ 31 u32 alt_ssi : 1; /* bit 108 */
32 u32:1;
33 u32 narf:1; /* bit 110 */
32} __packed; 34} __packed;
33 35
34extern struct css_general_char css_general_characteristics; 36extern struct css_general_char css_general_characteristics;
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
index 57d0d7e794b1..0a1abf1e69af 100644
--- a/arch/s390/include/asm/qdio.h
+++ b/arch/s390/include/asm/qdio.h
@@ -378,6 +378,34 @@ struct qdio_initialize {
378 struct qdio_outbuf_state *output_sbal_state_array; 378 struct qdio_outbuf_state *output_sbal_state_array;
379}; 379};
380 380
381/**
382 * enum qdio_brinfo_entry_type - type of address entry for qdio_brinfo_desc()
383 * @l3_ipv6_addr: entry contains IPv6 address
384 * @l3_ipv4_addr: entry contains IPv4 address
385 * @l2_addr_lnid: entry contains MAC address and VLAN ID
386 */
387enum qdio_brinfo_entry_type {l3_ipv6_addr, l3_ipv4_addr, l2_addr_lnid};
388
389/**
390 * struct qdio_brinfo_entry_XXX - Address entry for qdio_brinfo_desc()
391 * @nit: Network interface token
392 * @addr: Address of one of the three types
393 *
394 * The struct is passed to the callback function by qdio_brinfo_desc()
395 */
396struct qdio_brinfo_entry_l3_ipv6 {
397 u64 nit;
398 struct { unsigned char _s6_addr[16]; } addr;
399} __packed;
400struct qdio_brinfo_entry_l3_ipv4 {
401 u64 nit;
402 struct { uint32_t _s_addr; } addr;
403} __packed;
404struct qdio_brinfo_entry_l2 {
405 u64 nit;
406 struct { u8 mac[6]; u16 lnid; } addr_lnid;
407} __packed;
408
381#define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */ 409#define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */
382#define QDIO_STATE_ESTABLISHED 0x00000004 /* after qdio_establish */ 410#define QDIO_STATE_ESTABLISHED 0x00000004 /* after qdio_establish */
383#define QDIO_STATE_ACTIVE 0x00000008 /* after qdio_activate */ 411#define QDIO_STATE_ACTIVE 0x00000008 /* after qdio_activate */
@@ -399,5 +427,10 @@ extern int qdio_get_next_buffers(struct ccw_device *, int, int *, int *);
399extern int qdio_shutdown(struct ccw_device *, int); 427extern int qdio_shutdown(struct ccw_device *, int);
400extern int qdio_free(struct ccw_device *); 428extern int qdio_free(struct ccw_device *);
401extern int qdio_get_ssqd_desc(struct ccw_device *, struct qdio_ssqd_desc *); 429extern int qdio_get_ssqd_desc(struct ccw_device *, struct qdio_ssqd_desc *);
430extern int qdio_pnso_brinfo(struct subchannel_id schid,
431 int cnc, u16 *response,
432 void (*cb)(void *priv, enum qdio_brinfo_entry_type type,
433 void *entry),
434 void *priv);
402 435
403#endif /* __QDIO_H__ */ 436#endif /* __QDIO_H__ */
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index eee70cb8730b..f6b9188c5af5 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -55,6 +55,7 @@ int chsc_error_from_response(int response)
55 case 0x0004: 55 case 0x0004:
56 return -EOPNOTSUPP; 56 return -EOPNOTSUPP;
57 case 0x000b: 57 case 0x000b:
58 case 0x0107: /* "Channel busy" for the op 0x003d */
58 return -EBUSY; 59 return -EBUSY;
59 case 0x0100: 60 case 0x0100:
60 case 0x0102: 61 case 0x0102:
@@ -1202,3 +1203,35 @@ out:
1202 return ret; 1203 return ret;
1203} 1204}
1204EXPORT_SYMBOL_GPL(chsc_scm_info); 1205EXPORT_SYMBOL_GPL(chsc_scm_info);
1206
1207/**
1208 * chsc_pnso_brinfo() - Perform Network-Subchannel Operation, Bridge Info.
1209 * @schid: id of the subchannel on which PNSO is performed
1210 * @brinfo_area: request and response block for the operation
1211 * @resume_token: resume token for multiblock response
1212 * @cnc: Boolean change-notification control
1213 *
1214 * brinfo_area must be allocated by the caller with get_zeroed_page(GFP_KERNEL)
1215 *
1216 * Returns 0 on success.
1217 */
1218int chsc_pnso_brinfo(struct subchannel_id schid,
1219 struct chsc_pnso_area *brinfo_area,
1220 struct chsc_brinfo_resume_token resume_token,
1221 int cnc)
1222{
1223 memset(brinfo_area, 0, sizeof(*brinfo_area));
1224 brinfo_area->request.length = 0x0030;
1225 brinfo_area->request.code = 0x003d; /* network-subchannel operation */
1226 brinfo_area->m = schid.m;
1227 brinfo_area->ssid = schid.ssid;
1228 brinfo_area->sch = schid.sch_no;
1229 brinfo_area->cssid = schid.cssid;
1230 brinfo_area->oc = 0; /* Store-network-bridging-information list */
1231 brinfo_area->resume_token = resume_token;
1232 brinfo_area->n = (cnc != 0);
1233 if (chsc(brinfo_area))
1234 return -EIO;
1235 return chsc_error_from_response(brinfo_area->response.code);
1236}
1237EXPORT_SYMBOL_GPL(chsc_pnso_brinfo);
diff --git a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h
index 23d072e70eb2..7e53a9c8b0b9 100644
--- a/drivers/s390/cio/chsc.h
+++ b/drivers/s390/cio/chsc.h
@@ -61,7 +61,9 @@ struct css_chsc_char {
61 u32 : 20; 61 u32 : 20;
62 u32 scssc : 1; /* bit 107 */ 62 u32 scssc : 1; /* bit 107 */
63 u32 scsscf : 1; /* bit 108 */ 63 u32 scsscf : 1; /* bit 108 */
64 u32 : 19; 64 u32:7;
65 u32 pnso:1; /* bit 116 */
66 u32:11;
65}__attribute__((packed)); 67}__attribute__((packed));
66 68
67extern struct css_chsc_char css_chsc_characteristics; 69extern struct css_chsc_char css_chsc_characteristics;
@@ -188,6 +190,53 @@ struct chsc_scm_info {
188 190
189int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token); 191int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
190 192
193struct chsc_brinfo_resume_token {
194 u64 t1;
195 u64 t2;
196} __packed;
197
198struct chsc_brinfo_naihdr {
199 struct chsc_brinfo_resume_token resume_token;
200 u32:32;
201 u32 instance;
202 u32:24;
203 u8 naids;
204 u32 reserved[3];
205} __packed;
206
207struct chsc_pnso_area {
208 struct chsc_header request;
209 u8:2;
210 u8 m:1;
211 u8:5;
212 u8:2;
213 u8 ssid:2;
214 u8 fmt:4;
215 u16 sch;
216 u8:8;
217 u8 cssid;
218 u16:16;
219 u8 oc;
220 u32:24;
221 struct chsc_brinfo_resume_token resume_token;
222 u32 n:1;
223 u32:31;
224 u32 reserved[3];
225 struct chsc_header response;
226 u32:32;
227 struct chsc_brinfo_naihdr naihdr;
228 union {
229 struct qdio_brinfo_entry_l3_ipv6 l3_ipv6[0];
230 struct qdio_brinfo_entry_l3_ipv4 l3_ipv4[0];
231 struct qdio_brinfo_entry_l2 l2[0];
232 } entries;
233} __packed;
234
235int chsc_pnso_brinfo(struct subchannel_id schid,
236 struct chsc_pnso_area *brinfo_area,
237 struct chsc_brinfo_resume_token resume_token,
238 int cnc);
239
191#ifdef CONFIG_SCM_BUS 240#ifdef CONFIG_SCM_BUS
192int scm_update_information(void); 241int scm_update_information(void);
193int scm_process_availability_information(void); 242int scm_process_availability_information(void);
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index 3e602e8affa7..c883a085c059 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -1752,6 +1752,97 @@ int qdio_stop_irq(struct ccw_device *cdev, int nr)
1752} 1752}
1753EXPORT_SYMBOL(qdio_stop_irq); 1753EXPORT_SYMBOL(qdio_stop_irq);
1754 1754
1755/**
1756 * qdio_pnso_brinfo() - perform network subchannel op #0 - bridge info.
1757 * @schid: Subchannel ID.
1758 * @cnc: Boolean Change-Notification Control
1759 * @response: Response code will be stored at this address
1760 * @cb: Callback function will be executed for each element
1761 * of the address list
1762 * @priv: Pointer passed from the caller to qdio_pnso_brinfo()
1763 * @type: Type of the address entry passed to the callback
1764 * @entry: Entry containg the address of the specified type
1765 * @priv: Pointer to pass to the callback function.
1766 *
1767 * Performs "Store-network-bridging-information list" operation and calls
1768 * the callback function for every entry in the list. If "change-
1769 * notification-control" is set, further changes in the address list
1770 * will be reported via the IPA command.
1771 */
1772int qdio_pnso_brinfo(struct subchannel_id schid,
1773 int cnc, u16 *response,
1774 void (*cb)(void *priv, enum qdio_brinfo_entry_type type,
1775 void *entry),
1776 void *priv)
1777{
1778 struct chsc_pnso_area *rr;
1779 int rc;
1780 u32 prev_instance = 0;
1781 int isfirstblock = 1;
1782 int i, size, elems;
1783
1784 rr = (struct chsc_pnso_area *)get_zeroed_page(GFP_KERNEL);
1785 if (rr == NULL)
1786 return -ENOMEM;
1787 do {
1788 /* on the first iteration, naihdr.resume_token will be zero */
1789 rc = chsc_pnso_brinfo(schid, rr, rr->naihdr.resume_token, cnc);
1790 if (rc != 0 && rc != -EBUSY)
1791 goto out;
1792 if (rr->response.code != 1) {
1793 rc = -EIO;
1794 continue;
1795 } else
1796 rc = 0;
1797
1798 if (cb == NULL)
1799 continue;
1800
1801 size = rr->naihdr.naids;
1802 elems = (rr->response.length -
1803 sizeof(struct chsc_header) -
1804 sizeof(struct chsc_brinfo_naihdr)) /
1805 size;
1806
1807 if (!isfirstblock && (rr->naihdr.instance != prev_instance)) {
1808 /* Inform the caller that they need to scrap */
1809 /* the data that was already reported via cb */
1810 rc = -EAGAIN;
1811 break;
1812 }
1813 isfirstblock = 0;
1814 prev_instance = rr->naihdr.instance;
1815 for (i = 0; i < elems; i++)
1816 switch (size) {
1817 case sizeof(struct qdio_brinfo_entry_l3_ipv6):
1818 (*cb)(priv, l3_ipv6_addr,
1819 &rr->entries.l3_ipv6[i]);
1820 break;
1821 case sizeof(struct qdio_brinfo_entry_l3_ipv4):
1822 (*cb)(priv, l3_ipv4_addr,
1823 &rr->entries.l3_ipv4[i]);
1824 break;
1825 case sizeof(struct qdio_brinfo_entry_l2):
1826 (*cb)(priv, l2_addr_lnid,
1827 &rr->entries.l2[i]);
1828 break;
1829 default:
1830 WARN_ON_ONCE(1);
1831 rc = -EIO;
1832 goto out;
1833 }
1834 } while (rr->response.code == 0x0107 || /* channel busy */
1835 (rr->response.code == 1 && /* list stored */
1836 /* resume token is non-zero => list incomplete */
1837 (rr->naihdr.resume_token.t1 || rr->naihdr.resume_token.t2)));
1838 (*response) = rr->response.code;
1839
1840out:
1841 free_page((unsigned long)rr);
1842 return rc;
1843}
1844EXPORT_SYMBOL_GPL(qdio_pnso_brinfo);
1845
1755static int __init init_QDIO(void) 1846static int __init init_QDIO(void)
1756{ 1847{
1757 int rc; 1848 int rc;