port = hsr_port_get_rcu(skb->dev); if (!port) goto finish_pass;
hsr = port->hsr;
if (hsr_addr_is_self(port->hsr, eth_hdr(skb)->h_source)) { /* Directly kill frames sent by ourselves */
kfree_skb(skb); goto finish_consume;
}
/* For HSR, only tagged frames are expected (unless the device offloads * HSR tag removal), but for PRP there could be non tagged frames as * well from Single attached nodes (SANs).
*/
protocol = eth_hdr(skb)->h_proto;
/* Only the frames received over the interlink port will assign a * sequence number and require synchronisation vs other sender.
*/ if (port->type == HSR_PT_INTERLINK) {
spin_lock_bh(&hsr->seqnr_lock);
hsr_forward_skb(skb, port);
spin_unlock_bh(&hsr->seqnr_lock);
} else {
hsr_forward_skb(skb, port);
}
staticint hsr_check_dev_ok(struct net_device *dev, struct netlink_ext_ack *extack)
{ /* Don't allow HSR on non-ethernet like devices */ if ((dev->flags & IFF_LOOPBACK) || dev->type != ARPHRD_ETHER ||
dev->addr_len != ETH_ALEN) {
NL_SET_ERR_MSG_MOD(extack, "Cannot use loopback or non-ethernet device as HSR slave."); return -EINVAL;
}
/* Don't allow enslaving hsr devices */ if (is_hsr_master(dev)) {
NL_SET_ERR_MSG_MOD(extack, "Cannot create trees of HSR devices."); return -EINVAL;
}
if (hsr_port_exists(dev)) {
NL_SET_ERR_MSG_MOD(extack, "This device is already a HSR slave."); return -EINVAL;
}
if (is_vlan_dev(dev)) {
NL_SET_ERR_MSG_MOD(extack, "HSR on top of VLAN is not yet supported in this driver."); return -EINVAL;
}
if (dev->priv_flags & IFF_DONT_BRIDGE) {
NL_SET_ERR_MSG_MOD(extack, "This device does not support bridging."); return -EOPNOTSUPP;
}
/* HSR over bonded devices has not been tested, but I'm not sure it * won't work...
*/
return 0;
}
/* Setup device to be added to the HSR bridge. */ staticint hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev, struct hsr_port *port, struct netlink_ext_ack *extack)
{ struct net_device *hsr_dev; struct hsr_port *master; int res;
/* Don't use promiscuous mode for offload since L2 frame forward * happens at the offloaded hardware.
*/ if (!port->hsr->fwd_offloaded) {
res = dev_set_promiscuity(dev, 1); if (res) return res;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.