aboutsummaryrefslogtreecommitdiff
path: root/include/net/switchdev.h
AgeCommit message (Collapse)AuthorFilesLines
2016-01-06switchdev: add bridge vlan_filtering attributeElad Raz1-0/+2
Adding vlan_filtering attribute to allow hardware vendor to support vlan-aware bridges. Vlan_filtering is a per-bridge attribute. Signed-off-by: Elad Raz <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-12-15switchdev: Pass original device to port netdev driverIdo Schimmel1-0/+2
switchdev drivers need to know the netdev on which the switchdev op was invoked. For example, the STP state of a VLAN interface configured on top of a port can change while being member in a bridge. In this case, the underlying driver should only change the STP state of that particular VLAN and not of all the VLANs configured on the port. However, current switchdev infrastructure only passes the port netdev down to the driver. Solve that by passing the original device down to the driver as part of the required switchdev object / attribute. This doesn't entail any change in current switchdev drivers. It simply enables those supporting stacked devices to know the originating device and act accordingly. Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-11-16net: switchdev: fix return code of fdb_dump stubDragos Tatulea1-1/+1
rtnl_fdb_dump always expects an index to be returned by the ndo_fdb_dump op, but when CONFIG_NET_SWITCHDEV is off, it returns an error. Fix that by returning the given unmodified idx. A similar fix was 0890cf6cb6ab ("switchdev: fix return value of switchdev_port_fdb_dump in case of error") but for the CONFIG_NET_SWITCHDEV=y case. Fixes: 45d4122ca7cd ("switchdev: add support for fdb add/del/dump via switchdev_port_obj ops.") Signed-off-by: Dragos Tatulea <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-15switchdev: introduce possibility to defer obj_add/delJiri Pirko1-0/+1
Similar to the attr usecase, the caller knows if he is holding RTNL and is in atomic section. So let the called to decide the correct call variant. This allows drivers to sleep inside their ops and wait for hw to get the operation status. Then the status is propagated into switchdev core. This avoids silent errors in drivers. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-15switchdev: remove pointers from switchdev objectsJiri Pirko1-4/+3
When object is used in deferred work, we cannot use pointers in switchdev object structures because the memory they point at may be already used by someone else. So rather do local copy of the value. Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Scott Feldman <[email protected]> Reviewed-by: John Fastabend <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-15switchdev: allow caller to explicitly request attr_set as deferredJiri Pirko1-0/+1
Caller should know if he can call attr_set directly (when holding RTNL) or if he has to defer the att_set processing for later. This also allows drivers to sleep inside attr_set and report operation status back to switchdev core. Switchdev core then warns if status is not ok, instead of silent errors happening in drivers. Benefit from newly introduced switchdev deferred ops infrastructure. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-15switchdev: make struct switchdev_attr parameter const for attr_set callsJiri Pirko1-3/+3
Signed-off-by: Jiri Pirko <[email protected]> Reviewed-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-15switchdev: introduce switchdev deferred ops infrastructureJiri Pirko1-0/+5
Introduce infrastructure which will be used internally to defer ops. Note that the deferred ops are queued up and either are processed by scheduled work or explicitly by user calling deferred_process function. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-12switchdev: skip over ports returning -EOPNOTSUPP when recursing portsScott Feldman1-0/+1
This allows us to recurse over all the ports, skipping over unsupporting ports. Without the change, the recursion would stop at first unsupported port. Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-12switchdev: add bridge ageing_time attributeScott Feldman1-0/+2
Setting the stage to push bridge-level attributes down to port driver so hardware can be programmed accordingly. Bridge-level attribute example is ageing_time. This is a per-bridge attribute, not a per-bridge-port attr. Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-03switchdev: push object ID back to object structureJiri Pirko1-10/+4
Suggested-by: Scott Feldman <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Scott Feldman <[email protected]> Reviewed-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-03switchdev: bring back switchdev_obj and use it as a generic object paramJiri Pirko1-11/+31
Replace "void *obj" with a generic structure. Introduce couple of helpers along that. Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Scott Feldman <[email protected]> Reviewed-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-03switchdev: rename switchdev_obj_fdb to switchdev_obj_port_fdbJiri Pirko1-1/+1
Make the struct name in sync with object id name. Suggested-by: Vivien Didelot <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Scott Feldman <[email protected]> Reviewed-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-03switchdev: rename switchdev_obj_vlan to switchdev_obj_port_vlanJiri Pirko1-1/+1
Make the struct name in sync with object id name. Suggested-by: Vivien Didelot <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Scott Feldman <[email protected]> Reviewed-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-03switchdev: rename SWITCHDEV_ATTR_* enum values to SWITCHDEV_ATTR_ID_*Jiri Pirko1-4/+4
To be aligned with obj. Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Scott Feldman <[email protected]> Reviewed-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-03switchdev: rename SWITCHDEV_OBJ_* enum values to SWITCHDEV_OBJ_ID_*Jiri Pirko1-7/+7
Suggested-by: Vivien Didelot <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Scott Feldman <[email protected]> Reviewed-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-09-29net: switchdev: extract struct switchdev_obj_*Vivien Didelot1-27/+26
Now that switchdev and its drivers directly use specific switchdev_obj_* structures, move them out of the switchdev_obj union and get rif of this outer structure. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-09-29net: switchdev: abstract object in add/del opsVivien Didelot1-6/+12
Similar to the notifier_call callback of a notifier_block, change the function signature of switchdev add and del operations to: int switchdev_port_obj_add/del(struct net_device *dev, enum switchdev_obj_id id, void *obj); This allows the caller to pass a specific switchdev_obj_* structure instead of the generic switchdev_obj one. Drivers implementation of these operations and switchdev have been changed accordingly. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-09-29net: switchdev: pass callback to dump operationVivien Didelot1-3/+6
Similar to the notifier_call callback of a notifier_block, change the function signature of switchdev dump operation to: int switchdev_port_obj_dump(struct net_device *dev, enum switchdev_obj_id id, void *obj, int (*cb)(void *obj)); This allows the caller to pass and expect back a specific switchdev_obj_* structure instead of the generic switchdev_obj one. Drivers implementation of dump operation can now expect this specific structure and call the callback with it. Drivers have been changed accordingly. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-09-29net: switchdev: remove dev from switchdev_obj cbVivien Didelot1-1/+1
The net_device associated to a dump operation does not have to be passed to the callback. switchdev stores it in a superset struct, if needed. Also some drivers (such as DSA drivers) may not have easy access to it. This will simplify pushing the callback function down to the drivers. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-09-24switchdev: reduce transaction phase enum down to a booleanJiri Pirko1-8/+3
Now, since we have only 2 values for transaction phase, just use bool. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-09-24switchdev: remove "ABORT" transaction phaseJiri Pirko1-1/+0
No longer used by drivers, as transaction queue with item destructors takes care of abort phase internally in switchdev code. So kill it. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-09-24switchdev: remove "NONE" transaction phaseJiri Pirko1-1/+0
Shouldn't have been there in the first place. Now it is unused, kill it. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-09-24switchdev: add switchdev_trans_ph_prepare/commit helpersJiri Pirko1-0/+10
Add helpers which should be used int attr_set/obj_add switchdev ops to check the phase of transaction. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-09-24switchdev: move transaction phase enum under transaction structureJiri Pirko1-2/+1
Before it disappears completely, move transaction phase enum under transaction structure and make attr/obj structures a bit cleaner. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-09-24switchdev: introduce transaction item queue for attr_set and obj_addJiri Pirko1-3/+21
Now, the memory allocation in prepare/commit state is done separatelly in each driver (rocker). Introduce the similar mechanism in generic switchdev code, in form of queue. That can be used not only for memory allocations, but also for different items. Abort item destruction is handled as well. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-09-24switchdev: rename "trans" to "trans_ph".Jiri Pirko1-3/+3
This is temporary, name "trans" will be used for something else and "trans_ph" will eventually disappear. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-08-11net: switchdev: support static FDB addressesVivien Didelot1-0/+1
This patch adds an ndm_state member to the switchdev_obj_fdb structure, in order to support static FDB addresses. Set Rocker ndm_state to NUD_REACHABLE. Signed-off-by: Vivien Didelot <[email protected]> Acked-by: Scott Feldman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-08-11Revert "Merge branch 'mv88e6xxx-switchdev-fdb'"David S. Miller1-2/+1
This reverts commit f1d5ca434413b20cd3f8c18ff2b634b7782149a5, reversing changes made to 4933d85c5173832ebd261756522095837583c458. I applied v2 instead of v3. Signed-off-by: David S. Miller <[email protected]>
2015-08-09net: switchdev: support static FDB addressesVivien Didelot1-0/+1
This patch adds a is_static boolean to the switchdev_obj_fdb structure, in order to set the ndm_state to either NUD_NOARP or NUD_REACHABLE. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-08-09net: switchdev: change fdb addr for a byte arrayVivien Didelot1-1/+1
The address in the switchdev_obj_fdb structure is currently represented as a pointer. Replacing it for a 6-byte array allows switchdev to carry addresses directly read from hardware registers, not stored by the switch chip driver (as in Rocker). Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-07-20switchdev: add offload_fwd_mark generator helperScott Feldman1-0/+9
skb->offload_fwd_mark and dev->offload_fwd_mark are 32-bit and should be unique for device and may even be unique for a sub-set of ports within device, so add switchdev helper function to generate unique marks based on port's switch ID and group_ifindex. group_ifindex would typically be the container dev's ifindex, such as the bridge's ifindex. The generator uses a global hash table to store offload_fwd_marks hashed by {switch ID, group_ifindex} key. Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-06-23switchdev: rename vlan vid_start to vid_beginScott Feldman1-1/+1
Use vid_begin/end to be consistent with BRIDGE_VLAN_INFO_RANGE_BEGIN/END. Signed-off-by: Scott Feldman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-17switchdev: add support for fdb add/del/dump via switchdev_port_obj ops.Samudrala, Sridhar1-0/+50
- introduce port fdb obj and generic switchdev_port_fdb_add/del/dump() - use switchdev_port_fdb_add/del/dump in rocker/team/bonding ndo ops. - add support for fdb obj in switchdev_port_obj_add/del/dump() - switch rocker to implement fdb ops via switchdev_ops v3: updated to sync with named union changes. Signed-off-by: Sridhar Samudrala <[email protected]> Signed-off-by: Scott Feldman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-13switchdev: don't use anonymous union on switchdev attr/obj structsScott Feldman1-2/+2
Older gcc versions (e.g. gcc version 4.4.6) don't like anonymous unions which was causing build issues on the newly added switchdev attr/obj structs. Fix this by using named union on structs. Signed-off-by: Scott Feldman <[email protected]> Reported-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-13switchdev: align comment with other comments in blockScott Feldman1-1/+1
Signed-off-by: Scott Feldman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: convert fib_ipv4_add/del over to switchdev_port_obj_add/delScott Feldman1-11/+10
The IPv4 FIB ops convert nicely to the switchdev objs and we're left with only four switchdev ops: port get/set and port add/del. Other objs will follow, such as FDB. So go ahead and convert IPv4 FIB over to switchdev obj for consistency, anticipating more objs to come. Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: add new switchdev_port_bridge_getlinkScott Feldman1-0/+10
Like bridge_setlink, add switchdev wrapper to handle bridge_getlink and call into port driver to get port attrs. For now, only BR_LEARNING and BR_LEARNING_SYNC are returned. To add more, we'll probably want to break away from ndo_dflt_bridge_getlink() and build the netlink skb directly in the switchdev code. Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: remove unused switchdev_port_bridge_dellinkScott Feldman1-15/+0
Now we can remove old wrappers for dellink. Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: add new switchdev_port_bridge_dellinkScott Feldman1-0/+6
Same change as setlink. Provide the wrapper op for SELF ndo_bridge_dellink and call into the switchdev driver to delete afspec VLANs. Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: remove old switchdev_port_bridge_setlinkScott Feldman1-9/+0
New attr-based bridge_setlink can recurse lower devs and recover on err, so remove old wrapper (including ndo_dflt_switchdev_port_bridge_setlink). Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: add bridge port flags attrScott Feldman1-0/+2
rocker: use switchdev get/set attr for bridge port flags Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: add port vlan objScott Feldman1-0/+8
VLAN obj has flags (PVID and untagged) as well as start and end vid ranges. The switchdev driver can optimize programing the device using the ranges. Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: introduce switchdev add/del obj opsScott Feldman1-0/+31
Like switchdev attr get/set, add new switchdev obj add/del. switchdev objs will be things like VLANs or FIB entries, so add/del fits better for objects than get/set used for attributes. Use same two-phase prepare-commit transaction model as in attr set. Signed-off-by: Scott Feldman <[email protected]> Acked-by: Sridhar Samudrala <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: convert STP update to switchdev attr setScott Feldman1-11/+2
STP update is just a settable port attribute, so convert switchdev_port_stp_update to an attr set. For DSA, the prepare phase is skipped and STP updates are only done in the commit phase. This is because currently the DSA drivers don't need to allocate any memory for STP updates and the STP update will not fail to HW (unless something horrible goes wrong on the MDIO bus, in which case the prepare phase wouldn't have been able to predict anyway). Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: convert parent_id_get to switchdev attr getScott Feldman1-14/+4
Switch ID is just a gettable port attribute. Convert switchdev op switchdev_parent_id_get to a switchdev attr. Note: for sysfs and netlink interfaces, SWITCHDEV_ATTR_PORT_PARENT_ID is called with SWITCHDEV_F_NO_RECUSE to limit switch ID user-visiblity to only port netdevs. So when a port is stacked under bond/bridge, the user can only query switch id via the switch ports, but not via the upper devices Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: introduce get/set attrs opsScott Feldman1-0/+43
Add two new swdev ops for get/set switch port attributes. Most swdev interactions on a port are gets or sets on port attributes, so rather than adding ops for each attribute, let's define clean get/set ops for all attributes, and then we can have clear, consistent rules on how attributes propagate on stacked devs. Add the basic algorithms for get/set attr ops. Use the same recusive algo to walk lower devs we've used for STP updates, for example. For get, compare attr value for each lower dev and only return success if attr values match across all lower devs. For sets, set the same attr value for all lower devs. We'll use a two-phase prepare-commit transaction model for sets. In the first phase, the driver(s) are asked if attr set is OK. If all OK, the commit attr set in second phase. A driver would NACK the prepare phase if it can't set the attr due to lack of resources or support, within it's control. RTNL lock must be held across both phases because we'll recurse all lower devs first in prepare phase, and then recurse all lower devs again in commit phase. If any lower dev fails the prepare phase, we need to abort the transaction for all lower devs. If lower dev recusion isn't desired, allow a flag SWITCHDEV_F_NO_RECURSE to indicate get/set only work on port (lowest) device. Signed-off-by: Scott Feldman <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: s/swdev_/switchdev_/Jiri Pirko1-15/+15
Turned out that "switchdev" sticks. So just unify all related terms to use this prefix. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: Scott Feldman <[email protected]> Acked-by: Roopa Prabhu <[email protected]> Acked-by: Andy Gospodarek <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-12switchdev: s/netdev_switch_/switchdev_/ and s/NETDEV_SWITCH_/SWITCHDEV_/Jiri Pirko1-55/+56
Turned out that "switchdev" sticks. So just unify all related terms to use this prefix. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: Scott Feldman <[email protected]> Acked-by: Roopa Prabhu <[email protected]> Acked-by: Andy Gospodarek <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-20switchdev: kernel-doc cleanup on swithdev opsScott Feldman1-16/+7
Suggested-by: Ben Hutchings <[email protected]> Signed-off-by: Scott Feldman <[email protected]> Signed-off-by: David S. Miller <[email protected]>