Scott Feldman | dc488f8 | 2015-03-13 21:09:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * QEMU rocker switch emulation - front-panel ports |
| 3 | * |
| 4 | * Copyright (c) 2014 Scott Feldman <sfeldma@gmail.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | */ |
| 16 | |
Markus Armbruster | 2a6a407 | 2016-06-29 13:47:03 +0200 | [diff] [blame] | 17 | #ifndef ROCKER_FP_H |
| 18 | #define ROCKER_FP_H |
Scott Feldman | dc488f8 | 2015-03-13 21:09:30 -0700 | [diff] [blame] | 19 | |
| 20 | #include "net/net.h" |
| 21 | #include "qemu/iov.h" |
| 22 | |
| 23 | #define ROCKER_FP_PORTS_MAX 62 |
| 24 | |
| 25 | typedef struct fp_port FpPort; |
| 26 | |
| 27 | int fp_port_eg(FpPort *port, const struct iovec *iov, int iovcnt); |
| 28 | |
David Ahern | 7734953 | 2015-06-10 18:21:18 -0700 | [diff] [blame] | 29 | char *fp_port_get_name(FpPort *port); |
Scott Feldman | dc488f8 | 2015-03-13 21:09:30 -0700 | [diff] [blame] | 30 | bool fp_port_get_link_up(FpPort *port); |
Scott Feldman | fafa4d5 | 2015-06-10 18:21:21 -0700 | [diff] [blame] | 31 | void fp_port_get_info(FpPort *port, RockerPortList *info); |
Scott Feldman | dc488f8 | 2015-03-13 21:09:30 -0700 | [diff] [blame] | 32 | void fp_port_get_macaddr(FpPort *port, MACAddr *macaddr); |
| 33 | void fp_port_set_macaddr(FpPort *port, MACAddr *macaddr); |
| 34 | uint8_t fp_port_get_learning(FpPort *port); |
| 35 | void fp_port_set_learning(FpPort *port, uint8_t learning); |
| 36 | int fp_port_get_settings(FpPort *port, uint32_t *speed, |
| 37 | uint8_t *duplex, uint8_t *autoneg); |
| 38 | int fp_port_set_settings(FpPort *port, uint32_t speed, |
| 39 | uint8_t duplex, uint8_t autoneg); |
| 40 | bool fp_port_from_pport(uint32_t pport, uint32_t *port); |
| 41 | World *fp_port_get_world(FpPort *port); |
| 42 | void fp_port_set_world(FpPort *port, World *world); |
Jiri Pirko | 0ab9cd9 | 2016-02-25 15:31:55 +0100 | [diff] [blame] | 43 | bool fp_port_check_world(FpPort *port, World *world); |
Scott Feldman | dc488f8 | 2015-03-13 21:09:30 -0700 | [diff] [blame] | 44 | bool fp_port_enabled(FpPort *port); |
| 45 | void fp_port_enable(FpPort *port); |
| 46 | void fp_port_disable(FpPort *port); |
| 47 | |
| 48 | FpPort *fp_port_alloc(Rocker *r, char *sw_name, |
| 49 | MACAddr *start_mac, unsigned int index, |
| 50 | NICPeers *peers); |
| 51 | void fp_port_free(FpPort *port); |
| 52 | void fp_port_reset(FpPort *port); |
| 53 | |
Markus Armbruster | 2a6a407 | 2016-06-29 13:47:03 +0200 | [diff] [blame] | 54 | #endif /* ROCKER_FP_H */ |