/* * Copyright (c) by Jaroslav Kysela * GUS's memory access via proc filesystem * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include struct gus_proc_private { int rom; /* data are in ROM */ unsigned int address; unsigned int size; struct snd_gus_card * gus; }; static ssize_t snd_gf1_mem_proc_dump(struct snd_info_entry *entry, void *file_private_data, struct file *file, char __user *buf, size_t count, loff_t pos) { struct gus_proc_private *priv = entry->private_data; struct snd_gus_card *gus = priv->gus; int err; err = snd_gus_dram_read(gus, buf, pos, count, priv->rom); if (err < 0) return err; return count; } static void snd_gf1_mem_proc_free(struct snd_info_entry *entry) { struct gus_proc_private *priv = entry->private_data; kfree(priv); } static struct snd_info_entry_ops snd_gf1_mem_proc_ops = { .read = snd_gf1_mem_proc_dump, }; int snd_gf1_mem_proc_init(struct snd_gus_card * gus) { int idx; char name[16]; struct gus_proc_private *priv; struct snd_info_entry *entry; for (idx = 0; idx < 4; idx++) { if (gus->gf1.mem_alloc.banks_8[idx].size > 0) { priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (priv == NULL) return -ENOMEM; priv->gus = gus; sprintf(name, "gus-ram-%i", idx); if (! snd_card_proc_new(gus->card, name, &entry)) { entry->content = SNDRV_INFO_CONTENT_DATA; entry->private_data = priv; entry->private_free = snd_gf1_mem_proc_free; entry->c.ops = &snd_gf1_mem_proc_ops; priv->address = gus->gf1.mem_alloc.banks_8[idx].address; priv->size = entry->size = gus->gf1.mem_alloc.banks_8[idx].size; } } } for (idx = 0; idx < 4; idx++) { if (gus->gf1.rom_present & (1 << idx)) { priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (priv == NULL) return -ENOMEM; priv->rom = 1; priv->gus = gus; sprintf(name, "gus-rom-%i", idx); if (! snd_card_proc_new(gus->card, name, &entry)) { entry->content = SNDRV_INFO_CONTENT_DATA; entry->private_data = priv; entry->private_free = snd_gf1_mem_proc_free; entry->c.ops = &snd_gf1_mem_proc_ops; priv->address = idx * 4096 * 1024; priv->size = entry->size = gus->gf1.rom_memory; } } } return 0; } 2ea9f66d3f9f96bc0f41d94b4830c0b2d0a50&showmsg=1'>bridge/br_netlink.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-07net: bridge: remove redundant check to see if err is setColin Ian King1-3/+0
The error check on err is redundant as it is being checked previously each time it has been updated. Remove this redundant check. Detected with CoverityScan, CID#140030("Logically dead code") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-02-06bridge: move to workqueue gcNikolay Aleksandrov1-1/+1
Move the fdb garbage collector to a workqueue which fires at least 10 milliseconds apart and cleans chain by chain allowing for other tasks to run in the meantime. When having thousands of fdbs the system is much more responsive. Most importantly remove the need to check if the matched entry has expired in __br_fdb_get that causes false-sharing and is completely unnecessary if we cleanup entries, at worst we'll get 10ms of traffic for that entry before it gets deleted. Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-02-03bridge: per vlan dst_metadata netlink supportRoopa Prabhu1-45/+95
This patch adds support to attach per vlan tunnel info dst metadata. This enables bridge driver to map vlan to tunnel_info at ingress and egress. It uses the kernel dst_metadata infrastructure. The initial use case is vlan to vni bridging, but the api is generic to extend to any tunnel_info in the future: - Uapi to configure/unconfigure/dump per vlan tunnel data - netlink functions to configure vlan and tunnel_info mapping - Introduces bridge port flag BR_LWT_VLAN to enable attach/detach dst_metadata to bridged packets on ports. off by default. - changes to existing code is mainly refactor some existing vlan handling netlink code + hooks for new vlan tunnel code - I have kept the vlan tunnel code isolated in separate files. - most of the netlink vlan tunnel code is handling of vlan-tunid ranges (follows the vlan range handling code). To conserve space vlan-tunid by default are always dumped in ranges if applicable. Use case: example use for this is a vxlan bridging gateway or vtep which maps vlans to vn-segments (or vnis). iproute2 example (patched and pruned iproute2 output to just show relevant fdb entries): example shows same host mac learnt on two vni's and vlan 100 maps to vni 1000, vlan 101 maps to vni 1001 before (netdev per vni): $bridge fdb show | grep "00:02:00:00:00:03" 00:02:00:00:00:03 dev vxlan1001 vlan 101 master bridge 00:02:00:00:00:03 dev vxlan1001 dst 12.0.0.8 self 00:02:00:00:00:03 dev vxlan1000 vlan 100 master bridge 00:02:00:00:00:03 dev vxlan1000 dst 12.0.0.8 self after this patch with collect metdata in bridged mode (single netdev): $bridge fdb show | grep "00:02:00:00:00:03" 00:02:00:00:00:03 dev vxlan0 vlan 101 master bridge 00:02:00:00:00:03 dev vxlan0 src_vni 1001 dst 12.0.0.8 self 00:02:00:00:00:03 dev vxlan0 vlan 100 master bridge 00:02:00:00:00:03 dev vxlan0 src_vni 1000 dst 12.0.0.8 self CC: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>