* Re: [net-next PATCH 1/2] dcbnl: Aggregated CEE GET operation
From: John Fastabend @ 2011-07-03 18:09 UTC (permalink / raw)
To: Shmulik Ravid; +Cc: davem@davemloft.net, netdev@vger.kernel.org
In-Reply-To: <1309624423.15528.43.camel@lb-tlvb-shmulik.il.broadcom.com>
On 7/2/2011 9:33 AM, Shmulik Ravid wrote:
> The following couple of patches add dcbnl an unsolicited notification of
> the the DCB configuration for the CEE flavor of the DCBX protocol. This
> is useful when the user-mode DCB client is not responsible for
> conducting and resolving the DCBX negotiation (either because the DCBX
> stack is embedded in the HW or the negotiation is handled by another
> agent in he host), but still needs to get the negotiated parameters.
> This functionality already exists for the IEEE flavor of the DCBX
> protocol and these patches add it to the older CEE flavor.
>
> The first patch extends the CEE attribute GET operation to include not
> only the peer information, but also all the pertinent local
> configuration (negotiated parameters). The second patch adds and export
> a CEE specific notification routine.
>
> Signed-off-by: Shmulik Ravid <shmulikr@broadcom.com>
> ---
> include/linux/dcbnl.h | 20 ++++++-
> net/dcb/dcbnl.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 168 insertions(+), 8 deletions(-)
>
> diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
> index 66a6723..c875244 100644
> --- a/include/linux/dcbnl.h
> +++ b/include/linux/dcbnl.h
> @@ -333,15 +333,26 @@ enum ieee_attrs_app {
> #define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1)
>
> /**
> - * enum cee_attrs - CEE DCBX get attributes
> + * enum cee_attrs - CEE DCBX get attributes. An aggregated collection of the
> + * cee std negotiated parameters
> *
> * @DCB_ATTR_CEE_UNSPEC: unspecified
> + * @DCB_ATTR_CEE_FEAT: DCBX features flags (DCB_CMD_GFEATCFG)
> + * @DCB_ATTR_CEE_RX_PG: RX PG configuration (DCB_CMD_PGRX_GCFG)
> + * @DCB_ATTR_CEE_TX_PG: TX PG configuration (DCB_CMD_PGTX_GCFG)
> + * @DCB_ATTR_CEE_PFC: PFC configuration (DCB_CMD_PFC_GCFG)
> + * @DCB_ATTR_CEE_APP_TABLE: APP configuration (multi DCB_CMD_GAPP)
> * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only
> * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only
> * @DCB_ATTR_CEE_PEER_APP: peer APP tlv - get only
> */
> enum cee_attrs {
> DCB_ATTR_CEE_UNSPEC,
> + DCB_ATTR_CEE_TX_PG,
> + DCB_ATTR_CEE_RX_PG,
> + DCB_ATTR_CEE_PFC,
> + DCB_ATTR_CEE_APP_TABLE,
> + DCB_ATTR_CEE_FEAT,
> DCB_ATTR_CEE_PEER_PG,
> DCB_ATTR_CEE_PEER_PFC,
> DCB_ATTR_CEE_PEER_APP_TABLE,
PEER_PG, PEER_PFC, and PEER_APP_TABLE are already in kernel and user
space. So we shouldn't change their enum'd value. Put the new values
below them.
> @@ -357,6 +368,13 @@ enum peer_app_attr {
> };
> #define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1)
>
> +enum cee_attrs_app {
> + DCB_ATTR_CEE_APP_UNSPEC,
> + DCB_ATTR_CEE_APP,
> + __DCB_ATTR_CEE_APP_MAX
> +};
> +#define DCB_ATTR_CEE_APP_MAX (__DCB_ATTR_CEE_APP_MAX - 1)
> +
> /**
> * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
> *
> diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
> index fc56e85..5b75ed7 100644
> --- a/net/dcb/dcbnl.c
> +++ b/net/dcb/dcbnl.c
> @@ -1642,6 +1642,58 @@ err:
> return ret;
> }
>
> +static int dcbnl_cee_pg_fill(struct sk_buff *skb, struct net_device *dev,
> + int dir)
Why the 'dir'? Could you just pack both tx and rx together? It looks like all
cases pack TX then pack RX. Did I miss something?
> +{
> + u8 pgid, up_map, prio, tc_pct;
> + const struct dcbnl_rtnl_ops *ops = dev->dcbnl_ops;
> + int i = dir ? DCB_ATTR_CEE_TX_PG : DCB_ATTR_CEE_RX_PG;
> + struct nlattr *pg = nla_nest_start(skb, i);
I believe its preferred to put an empty line here. At least I prefer it.
> + if (!pg)
> + goto nla_put_failure;
> +
> + for (i = DCB_PG_ATTR_TC_0; i <= DCB_PG_ATTR_TC_7; i++) {
> + struct nlattr *tc_nest = nla_nest_start(skb, i);
same here.
> + if (!tc_nest)
> + goto nla_put_failure;
> +
> + pgid = DCB_ATTR_VALUE_UNDEFINED;
> + prio = DCB_ATTR_VALUE_UNDEFINED;
> + tc_pct = DCB_ATTR_VALUE_UNDEFINED;
> + up_map = DCB_ATTR_VALUE_UNDEFINED;
> +
> + if (!dir)
> + ops->getpgtccfgrx(dev, i - DCB_PG_ATTR_TC_0,
> + &prio, &pgid, &tc_pct, &up_map);
> + else
> + ops->getpgtccfgtx(dev, i - DCB_PG_ATTR_TC_0,
> + &prio, &pgid, &tc_pct, &up_map);
> +
Thanks for doing this. We should be able to get firmware CEE DCBX agents
working correctly with this.
//John
^ permalink raw reply
* Re: [Bugme-new] [Bug 38102] New: BUG kmalloc-2048: Poison overwritten
From: Eric Dumazet @ 2011-07-03 15:46 UTC (permalink / raw)
To: Alexey Zaytsev
Cc: Andrew Morton, netdev, Gary Zambrano, bugme-daemon,
David S. Miller, Pekka Pietikainen, Florian Schirmer,
Felix Fietkau, Michael Buesch
In-Reply-To: <CAB9v_DHXB6n07sEY_=HZ8S4zMO01Vs8B78dGyEWrm-hyRP82XA@mail.gmail.com>
Le dimanche 03 juillet 2011 à 01:25 +0400, Alexey Zaytsev a écrit :
> On Fri, Jul 1, 2011 at 10:01, Alexey Zaytsev <alexey.zaytsev@gmail.com> wrote:
> > On Thu, Jun 30, 2011 at 01:51, Andrew Morton <akpm@linux-foundation.org> wrote:
> >>
> >> (switched to email. Please respond via emailed reply-to-all, not via the
> >> bugzilla web interface).
> >>
> >> On Thu, 23 Jun 2011 17:33:54 GMT
> >> bugzilla-daemon@bugzilla.kernel.org wrote:
> >>
> >>> https://bugzilla.kernel.org/show_bug.cgi?id=38102
> >>>
> >>> Summary: BUG kmalloc-2048: Poison overwritten
> >>> Product: Drivers
> >>> Version: 2.5
> >>> Kernel Version: 3.0.0-rc4
> >>
> >> Looks like a 2.6.38->2.6.39 regression, perhaps a memory scribble in b44.
> >
> > Actually, not sure about the version. 39 was the first one I've been
> > using in the scenario. Checking older versions now.
> > And git-log does not show a lot of changes to the b44 driver, so it
> > might be something unrelated.
> >
>
> I've checked back as far as 2.6.27, and the problem is still there.
> I've also looked through the allocation-related code, and it seemed
> sane. I'm not sure I understand the 1GB dma workaround, but this path
> is never hit in my case. So adding the driver authors to CC. This
> could be something different, but I've been unable to reproduce using
> an other machine with an rtl8139 nic.
Hmm, looking at b44 code, I believe there is a race there.
Could you try following patch ?
Thanks
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index a69331e..80f2fdc 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -689,9 +689,9 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
ctrl |= DESC_CTRL_EOT;
dp = &bp->rx_ring[dest_idx];
- dp->ctrl = cpu_to_le32(ctrl);
dp->addr = cpu_to_le32((u32) mapping + bp->dma_offset);
-
+ wmb();
+ dp->ctrl = cpu_to_le32(ctrl);
if (bp->flags & B44_FLAG_RX_RING_HACK)
b44_sync_dma_desc_for_device(bp->sdev, bp->rx_ring_dma,
dest_idx * sizeof(*dp),
^ permalink raw reply related
* libpcap and tc filters
From: Adam Katz @ 2011-07-03 12:49 UTC (permalink / raw)
To: netdev
In-Reply-To: <CAA0qwj5Ktxi=v3XDAdTpKS_pWa+HjFL5XcN2qsK5m57JJ5G2Bg@mail.gmail.com>
Hi Everyone!
I'm attempting to use tc to shape traffic sent using libpcap (more
precisely tcpreplay, based on libpcap). I'm doing this for a research
project.
Ii have a prio scheduler with a default band 2:
tc qdisc add dev eth0 root handle 1: prio priomap 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2
with two filters attached to it:
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip dport
80 0xffff flowid 1:1
tc filter add dev eth0 protocol ip parent 1: prio 2 u32 match ip dport
443 0xffff flowid 1:2
(disregard the port numbers, they're here just as an example)
When sending actual traffic, the filters work and I see the
appropriate traffic entering the right class. BUT when replaying
captured traffic (with the appropriate port numbers) over eth0 using
tcpreplay, all packets end up in the default band 2 as if the filters
simply refuse to work.
Can anyone suggest a solution?
Thanks!
^ permalink raw reply
* CAN I TRUST YOU?
From: PETER CHOW @ 2011-07-03 11:37 UTC (permalink / raw)
Dear Friend,
I bring you greetings. I am PETER CHOW, I work with BANK OF CHINA, HONG KONG. I have a Business Proposal of $17.3M for you to handle with me from my bank.I need you to assist me in executing this Business Project from Hong Kong to your country.I need to know if you will be able to handle this with me before I explain to you in details. Should you be interested please send me the required information below;
(1). Full Names:
(2). Current Residential Address/Country:
(3). Private Telephone Number:
(4). Age:
I will want you to reach me on my private e-mail : ( chowp91@yahoo.com.hk ).Finally after that I shall provide you with more information.
Regards,
Peter Chow
^ permalink raw reply
* Re: [PATCH next] netfilter: nfqueue: batch verdict support
From: Eric Dumazet @ 2011-07-03 10:24 UTC (permalink / raw)
To: Florian Westphal, Patrick McHardy
Cc: netfilter-devel, Pablo Neira Ayuso, netdev, Eric Leblond
In-Reply-To: <1307657659-30266-1-git-send-email-fw@strlen.de>
Le vendredi 10 juin 2011 à 00:14 +0200, Florian Westphal a écrit :
> Introduces a new nfnetlink type that applies a given
> verdict to all queued packets with an id <= the id in the verdict
> message.
>
> If a mark is provided it is applied to all matched packets.
>
> This reduces the number of verdicts that have to be sent.
> Applications that make use of this feature need to maintain
> a timeout to send a batchverdict periodically to avoid starvation.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
The real question hidden here is : "Should packet ids be monotonic" in
current implementation and all future ones ?
Before we accept this patch, we should make sure packets id are
monotonic, and I am afraid its not the case right now.
I suggest following patch then.
[PATCH] netfilter: nfqueue: assert monotonic packet ids
Packet identifier is currently setup in nfqnl_build_packet_message(),
using one atomic_inc_return().
Problem is that since several cpus might concurrently call
nfqnl_enqueue_packet() for the same queue, we can deliver packets to
consumer in non monotonic way (packet N+1 being delivered after packet
N)
This patch moves the packet id setup from nfqnl_build_packet_message()
to nfqnl_enqueue_packet() to guarantee correct delivery order.
This also removes one atomic operation.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Florian Westphal <fw@strlen.de>
CC: Pablo Neira Ayuso <pablo@netfilter.org>
CC: Eric Leblond <eric@regit.org>
---
net/netfilter/nfnetlink_queue.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index fdd2faf..bccaf3b 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -58,7 +58,7 @@ struct nfqnl_instance {
*/
spinlock_t lock;
unsigned int queue_total;
- atomic_t id_sequence; /* 'sequence' of pkt ids */
+ unsigned int id_sequence; /* 'sequence' of pkt ids */
struct list_head queue_list; /* packets in queue */
};
@@ -213,13 +213,15 @@ nfqnl_flush(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn, unsigned long data)
static struct sk_buff *
nfqnl_build_packet_message(struct nfqnl_instance *queue,
- struct nf_queue_entry *entry)
+ struct nf_queue_entry *entry,
+ __be32 **packet_id_ptr)
{
sk_buff_data_t old_tail;
size_t size;
size_t data_len = 0;
struct sk_buff *skb;
- struct nfqnl_msg_packet_hdr pmsg;
+ struct nlattr *nla;
+ struct nfqnl_msg_packet_hdr *pmsg;
struct nlmsghdr *nlh;
struct nfgenmsg *nfmsg;
struct sk_buff *entskb = entry->skb;
@@ -272,12 +274,11 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
nfmsg->version = NFNETLINK_V0;
nfmsg->res_id = htons(queue->queue_num);
- entry->id = atomic_inc_return(&queue->id_sequence);
- pmsg.packet_id = htonl(entry->id);
- pmsg.hw_protocol = entskb->protocol;
- pmsg.hook = entry->hook;
-
- NLA_PUT(skb, NFQA_PACKET_HDR, sizeof(pmsg), &pmsg);
+ nla = __nla_reserve(skb, NFQA_PACKET_HDR, sizeof(*pmsg));
+ pmsg = nla_data(nla);
+ pmsg->hw_protocol = entskb->protocol;
+ pmsg->hook = entry->hook;
+ *packet_id_ptr = &pmsg->packet_id;
indev = entry->indev;
if (indev) {
@@ -389,6 +390,7 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
struct sk_buff *nskb;
struct nfqnl_instance *queue;
int err = -ENOBUFS;
+ __be32 *packet_id_ptr;
/* rcu_read_lock()ed by nf_hook_slow() */
queue = instance_lookup(queuenum);
@@ -402,7 +404,7 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
goto err_out;
}
- nskb = nfqnl_build_packet_message(queue, entry);
+ nskb = nfqnl_build_packet_message(queue, entry, &packet_id_ptr);
if (nskb == NULL) {
err = -ENOMEM;
goto err_out;
@@ -421,6 +423,8 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
queue->queue_total);
goto err_out_free_nskb;
}
+ entry->id = ++queue->id_sequence;
+ *packet_id_ptr = htonl(entry->id);
/* nfnetlink_unicast will either free the nskb or add it to a socket */
err = nfnetlink_unicast(nskb, &init_net, queue->peer_pid, MSG_DONTWAIT);
@@ -870,7 +874,7 @@ static int seq_show(struct seq_file *s, void *v)
inst->peer_pid, inst->queue_total,
inst->copy_mode, inst->copy_range,
inst->queue_dropped, inst->queue_user_dropped,
- atomic_read(&inst->id_sequence), 1);
+ inst->id_sequence, 1);
}
static const struct seq_operations nfqnl_seq_ops = {
^ permalink raw reply related
* [PATCH] net/fec: add device tree probe support
From: Shawn Guo @ 2011-07-03 8:06 UTC (permalink / raw)
To: netdev
Cc: linux-arm-kernel, devicetree-discuss, patches, Shawn Guo,
Jason Liu, David S. Miller, Grant Likely
It adds device tree probe support for fec driver.
Signed-off-by: Jason Liu <jason.hui@linaro.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Grant Likely <grant.likely@secretlab.ca>
---
Documentation/devicetree/bindings/net/fsl-fec.txt | 24 ++++
drivers/net/fec.c | 120 ++++++++++++++++++++-
2 files changed, 139 insertions(+), 5 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/fsl-fec.txt
diff --git a/Documentation/devicetree/bindings/net/fsl-fec.txt b/Documentation/devicetree/bindings/net/fsl-fec.txt
new file mode 100644
index 0000000..1dad888
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/fsl-fec.txt
@@ -0,0 +1,24 @@
+* Freescale Fast Ethernet Controller (FEC)
+
+Required properties:
+- compatible : Should be "fsl,<soc>-fec"
+- reg : Address and length of the register set for the device
+- interrupts : Should contain fec interrupt
+- phy-mode : String, operation mode of the PHY interface.
+ Supported values are: "mii", "gmii", "sgmii", "tbi", "rmii",
+ "rgmii", "rgmii-id", "rgmii-rxid", "rgmii-txid", "rtbi".
+- gpios : Should specify the gpio for phy reset
+
+Optional properties:
+- local-mac-address : 6 bytes, mac address
+
+Example:
+
+fec@83fec000 {
+ compatible = "fsl,imx51-fec", "fsl,imx27-fec";
+ reg = <0x83fec000 0x4000>;
+ interrupts = <87>;
+ phy-mode = "mii";
+ gpios = <&gpio1 14 0>; /* phy-reset, GPIO2_14 */
+ local-mac-address = [00 04 9F 01 1B B9];
+};
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 7ae3f28..3ee05ff 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -44,6 +44,9 @@
#include <linux/platform_device.h>
#include <linux/phy.h>
#include <linux/fec.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
#include <asm/cacheflush.h>
@@ -78,6 +81,17 @@ static struct platform_device_id fec_devtype[] = {
{ }
};
+enum fec_type {
+ IMX27_FEC,
+ IMX28_FEC,
+};
+
+static const struct of_device_id fec_dt_ids[] = {
+ { .compatible = "fsl,imx27-fec", .data = &fec_devtype[IMX27_FEC], },
+ { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], },
+ { /* sentinel */ },
+};
+
static unsigned char macaddr[ETH_ALEN];
module_param_array(macaddr, byte, NULL, 0);
MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
@@ -734,8 +748,25 @@ static void __inline__ fec_get_mac(struct net_device *ndev)
*/
iap = macaddr;
+#ifdef CONFIG_OF
+ /*
+ * 2) from device tree data
+ */
+ if (!is_valid_ether_addr(iap)) {
+ struct device_node *np = fep->pdev->dev.of_node;
+ if (np) {
+ const char *mac;
+ int err;
+ err = of_property_read_string(np,
+ "local-mac-address", &mac);
+ if (err)
+ iap = (unsigned char *) mac;
+ }
+ }
+#endif
+
/*
- * 2) from flash or fuse (via platform data)
+ * 3) from flash or fuse (via platform data)
*/
if (!is_valid_ether_addr(iap)) {
#ifdef CONFIG_M5272
@@ -748,7 +779,7 @@ static void __inline__ fec_get_mac(struct net_device *ndev)
}
/*
- * 3) FEC mac registers set by bootloader
+ * 4) FEC mac registers set by bootloader
*/
if (!is_valid_ether_addr(iap)) {
*((unsigned long *) &tmpaddr[0]) =
@@ -1358,6 +1389,72 @@ static int fec_enet_init(struct net_device *ndev)
return 0;
}
+#ifdef CONFIG_OF
+static int __devinit fec_get_phy_mode_dt(struct platform_device *pdev)
+{
+ struct device_node *np = pdev->dev.of_node;
+ int err, i;
+ const char *pm, *phy_modes[] = {
+ [PHY_INTERFACE_MODE_MII] = "mii",
+ [PHY_INTERFACE_MODE_GMII] = "gmii",
+ [PHY_INTERFACE_MODE_SGMII] = "sgmii",
+ [PHY_INTERFACE_MODE_TBI] = "tbi",
+ [PHY_INTERFACE_MODE_RMII] = "rmii",
+ [PHY_INTERFACE_MODE_RGMII] = "rgmii",
+ [PHY_INTERFACE_MODE_RGMII_ID] = "rgmii-id",
+ [PHY_INTERFACE_MODE_RGMII_RXID] = "rgmii-rxid",
+ [PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid",
+ [PHY_INTERFACE_MODE_RTBI] = "rtbi",
+ };
+
+ if (np) {
+ err = of_property_read_string(np, "phy-mode", &pm);
+ if (err)
+ return err;
+ for (i = 0; i < ARRAY_SIZE(phy_modes); i++)
+ if (!strcasecmp(pm, phy_modes[i]))
+ return i;
+ }
+
+ return -ENODEV;
+}
+
+static int __devinit fec_reset_phy(struct platform_device *pdev)
+{
+ int err, phy_reset;
+ struct device_node *np = pdev->dev.of_node;
+
+ if (!np)
+ return -ENODEV;
+
+ phy_reset = of_get_gpio(np, 0);
+ err = gpio_request_one(phy_reset, GPIOF_OUT_INIT_LOW, "phy-reset");
+ if (err) {
+ pr_warn("FEC: failed to get gpio phy-reset: %d\n", err);
+ return err;
+ }
+
+ msleep(1);
+ gpio_set_value(phy_reset, 1);
+
+ return 0;
+}
+#else /* CONFIG_OF */
+static inline int fec_get_phy_mode_dt(struct platform_device *pdev)
+{
+ return -ENODEV;
+}
+
+static inline int fec_reset_phy(struct platform_device *pdev)
+{
+ /*
+ * In case of platform probe, the reset has been done
+ * by machine code.
+ */
+ return 0;
+}
+#endif /* CONFIG_OF */
+
static int __devinit
fec_probe(struct platform_device *pdev)
{
@@ -1366,6 +1463,11 @@ fec_probe(struct platform_device *pdev)
struct net_device *ndev;
int i, irq, ret = 0;
struct resource *r;
+ const struct of_device_id *of_id;
+
+ of_id = of_match_device(fec_dt_ids, &pdev->dev);
+ if (of_id)
+ pdev->id_entry = (struct platform_device_id *) of_id->data;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r)
@@ -1397,9 +1499,16 @@ fec_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ndev);
- pdata = pdev->dev.platform_data;
- if (pdata)
- fep->phy_interface = pdata->phy;
+ fep->phy_interface = fec_get_phy_mode_dt(pdev);
+ if (fep->phy_interface == -ENODEV) {
+ pdata = pdev->dev.platform_data;
+ if (pdata)
+ fep->phy_interface = pdata->phy;
+ else
+ fep->phy_interface = PHY_INTERFACE_MODE_MII;
+ }
+
+ fec_reset_phy(pdev);
/* This device has up to three irqs on some platforms */
for (i = 0; i < 3; i++) {
@@ -1534,6 +1643,7 @@ static struct platform_driver fec_driver = {
#ifdef CONFIG_PM
.pm = &fec_pm_ops,
#endif
+ .of_match_table = fec_dt_ids,
},
.id_table = fec_devtype,
.probe = fec_probe,
--
1.7.4.1
^ permalink raw reply related
* Re: [E1000-devel] [PATCH] e1000: Allow the driver to be used on PA RISC C8000 workstation
From: Grant Grundler @ 2011-07-03 0:33 UTC (permalink / raw)
To: Matt Turner, Jesse Brandeburg, Kirsher, Jeffrey T
Cc: Rolf Eike Beer, Guy Martin, e1000-devel@lists.sourceforge.net,
linux-parisc@vger.kernel.org, mikulas@artax.karlin.mff.cuni.cz,
netdev
In-Reply-To: <BANLkTimbhOpp624KKU0dEE63mkAC1SDMAg@mail.gmail.com>
On Mon, Jun 27, 2011 at 03:33:43PM -0400, Matt Turner wrote:
> On Mon, Jun 27, 2011 at 2:42 PM, Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:
> > Rolf Eike Beer wrote:
> >> Am Freitag, 18. M?rz 2011, 17:39:57 schrieb Rolf Eike Beer:
> >> > Am Mittwoch, 2. M?rz 2011, 21:19:24 schrieb Jesse Brandeburg:
> >> > > On Mon, Feb 28, 2011 at 5:40 AM, Guy Martin <gmsoft@tuxicoman.be> wrote:
> >> > > > Hi Jeff,
> >> > > >
> >> > > > Any luck getting this into mainline ?
> >> > >
> >> > > Hi Guy, sorry for the delay,
> >> > > We haven't been able to get our contacts in HP to give us a decent
> >> > > response so far, we are following up with them to see whats up. ?We
> >> > > have not lost the patch and are still tracking it internally.
> >> > >
> >> > > Give us a couple more weeks if that is okay and we should be able to
> >> > > settle this by then.
> >> >
> >> > I wonder what exactly you are waiting for? This is a sanity check that
> >> > we
> >> > disable, so no working systems could get broken by this. And every
> >> > single
> >> > C8000 seems to be affected by this and is working fine with that patch.
> >> > So maybe people at HP might have a clue _why_ this is screwed, but
> >> > until then I don't see any point in waiting.
> >> >
> >> > So please just add my tested-by and push this upstream soon. Since this
> >> > is basically a hardware quirk I would like to get this into stable also
> >> > so we may run vanilla 2.6.38.1 or something like that on C8000.
> >> >
> >> > Tested-by: Rolf Eike Beer <eike-kernel@sf-tec.de>
> >>
> >> For the netdev folks: it's this patch we are talking about
> >>
> >> http://www.spinics.net/lists/linux-parisc/msg03091.html
> >>
> >> I would love to see that someone finally picks this up and pushes this
> >> upstream, CC stable. This is absolutely annoying as it breaks every time
> >> anyone touches the kernel on one of this machines.
> >>
> >> Jeff, David, James: can you please make a decision of who takes this and
> >> then just do it?
> >
> > Ping?
>
> Ping indeed. Waiting as if HP is going to say "yes, we fucked that up.
> Go ahead with the patch." is silly.
AFAIK, HP hasn't paid anyone to work on parisc-linux in almost 10 years.
Good luck finding someone in HP who knows about C8000, much less it's
NIC firmware.
Jesse or Jeff K. should be able to accept the patch as-is.
I don't see any problem with it.
hth,
grant (ex-HP employee: 1999-2002 parisc-linux and 2002-2006 ia64-linux drivers)
^ permalink raw reply
* Re: [RFC 31/72] tulip: Move the tulip drivers
From: Grant Grundler @ 2011-07-03 0:04 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: davem, netdev, Tobias Ringstrom
In-Reply-To: <1309010363-22750-32-git-send-email-jeffrey.t.kirsher@intel.com>
On Sat, Jun 25, 2011 at 06:58:42AM -0700, Jeff Kirsher wrote:
> Move the tulip driver into drivers/net/ethernet/tulip/ and make
> the necessary Kconfig and Makefile changes.
>
> CC: Tobias Ringstrom <tori@unhappy.mine.nu>
> CC: Grant Grundler <grundler@parisc-linux.org>
Acked-by: Grant Grundler <grundler@parisc-linux.org>
thanks,
grant
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> MAINTAINERS | 4 +-
> drivers/net/Kconfig | 2 -
> drivers/net/Makefile | 1 -
> drivers/net/ethernet/Kconfig | 2 +
> drivers/net/ethernet/Makefile | 1 +
> drivers/net/{ => ethernet}/tulip/21142.c | 0
> drivers/net/{ => ethernet}/tulip/Kconfig | 34 ++++++++++-------------
> drivers/net/{ => ethernet}/tulip/Makefile | 0
> drivers/net/{ => ethernet}/tulip/de2104x.c | 0
> drivers/net/{ => ethernet}/tulip/de4x5.c | 0
> drivers/net/{ => ethernet}/tulip/de4x5.h | 0
> drivers/net/{ => ethernet}/tulip/dmfe.c | 0
> drivers/net/{ => ethernet}/tulip/eeprom.c | 0
> drivers/net/{ => ethernet}/tulip/interrupt.c | 0
> drivers/net/{ => ethernet}/tulip/media.c | 0
> drivers/net/{ => ethernet}/tulip/pnic.c | 0
> drivers/net/{ => ethernet}/tulip/pnic2.c | 0
> drivers/net/{ => ethernet}/tulip/timer.c | 0
> drivers/net/{ => ethernet}/tulip/tulip.h | 0
> drivers/net/{ => ethernet}/tulip/tulip_core.c | 0
> drivers/net/{ => ethernet}/tulip/uli526x.c | 0
> drivers/net/{ => ethernet}/tulip/winbond-840.c | 0
> drivers/net/{ => ethernet}/tulip/xircom_cb.c | 0
> 23 files changed, 20 insertions(+), 24 deletions(-)
> rename drivers/net/{ => ethernet}/tulip/21142.c (100%)
> rename drivers/net/{ => ethernet}/tulip/Kconfig (93%)
> rename drivers/net/{ => ethernet}/tulip/Makefile (100%)
> rename drivers/net/{ => ethernet}/tulip/de2104x.c (100%)
> rename drivers/net/{ => ethernet}/tulip/de4x5.c (100%)
> rename drivers/net/{ => ethernet}/tulip/de4x5.h (100%)
> rename drivers/net/{ => ethernet}/tulip/dmfe.c (100%)
> rename drivers/net/{ => ethernet}/tulip/eeprom.c (100%)
> rename drivers/net/{ => ethernet}/tulip/interrupt.c (100%)
> rename drivers/net/{ => ethernet}/tulip/media.c (100%)
> rename drivers/net/{ => ethernet}/tulip/pnic.c (100%)
> rename drivers/net/{ => ethernet}/tulip/pnic2.c (100%)
> rename drivers/net/{ => ethernet}/tulip/timer.c (100%)
> rename drivers/net/{ => ethernet}/tulip/tulip.h (100%)
> rename drivers/net/{ => ethernet}/tulip/tulip_core.c (100%)
> rename drivers/net/{ => ethernet}/tulip/uli526x.c (100%)
> rename drivers/net/{ => ethernet}/tulip/winbond-840.c (100%)
> rename drivers/net/{ => ethernet}/tulip/xircom_cb.c (100%)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f72a8bd..26d1029 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2040,7 +2040,7 @@ DAVICOM FAST ETHERNET (DMFE) NETWORK DRIVER
> L: netdev@vger.kernel.org
> S: Orphan
> F: Documentation/networking/dmfe.txt
> -F: drivers/net/tulip/dmfe.c
> +F: drivers/net/ethernet/tulip/dmfe.c
>
> DC390/AM53C974 SCSI driver
> M: Kurt Garloff <garloff@suse.de>
> @@ -6278,7 +6278,7 @@ TULIP NETWORK DRIVERS
> M: Grant Grundler <grundler@parisc-linux.org>
> L: netdev@vger.kernel.org
> S: Maintained
> -F: drivers/net/tulip/
> +F: drivers/net/ethernet/tulip/
>
> TUN/TAP driver
> M: Maxim Krasnyansky <maxk@qualcomm.com>
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index 71efbe4..0846518 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -481,8 +481,6 @@ config DNET
> To compile this driver as a module, choose M here: the module
> will be called dnet.
>
> -source "drivers/net/tulip/Kconfig"
> -
> config AT1700
> tristate "AT1700/1720 support (EXPERIMENTAL)"
> depends on (ISA || MCA_LEGACY) && EXPERIMENTAL
> diff --git a/drivers/net/Makefile b/drivers/net/Makefile
> index 1ac4164..ec07331 100644
> --- a/drivers/net/Makefile
> +++ b/drivers/net/Makefile
> @@ -160,7 +160,6 @@ obj-$(CONFIG_USB_ZD1201) += usb/
> obj-$(CONFIG_USB_IPHETH) += usb/
>
> obj-$(CONFIG_WLAN) += wireless/
> -obj-$(CONFIG_NET_TULIP) += tulip/
> obj-$(CONFIG_HAMRADIO) += hamradio/
> obj-$(CONFIG_IRDA) += irda/
> obj-$(CONFIG_ETRAX_ETHERNET) += cris/
> diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
> index 6fb1625..369f5bb 100644
> --- a/drivers/net/ethernet/Kconfig
> +++ b/drivers/net/ethernet/Kconfig
> @@ -55,4 +55,6 @@ config TEHUTI
> ---help---
> Tehuti Networks 10G Ethernet NIC
>
> +source "drivers/net/ethernet/tulip/Kconfig"
> +
> endif # ETHERNET
> diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
> index 1123a3d..189d112 100644
> --- a/drivers/net/ethernet/Makefile
> +++ b/drivers/net/ethernet/Makefile
> @@ -31,3 +31,4 @@ obj-$(CONFIG_NET_VENDOR_SMSC) += smsc/
> obj-$(CONFIG_NET_VENDOR_STMICRO) += stmicro/
> obj-$(CONFIG_NET_VENDOR_SUN) += sun/
> obj-$(CONFIG_TEHUTI) += tehuti.o
> +obj-$(CONFIG_NET_TULIP) += tulip/
> diff --git a/drivers/net/tulip/21142.c b/drivers/net/ethernet/tulip/21142.c
> similarity index 100%
> rename from drivers/net/tulip/21142.c
> rename to drivers/net/ethernet/tulip/21142.c
> diff --git a/drivers/net/tulip/Kconfig b/drivers/net/ethernet/tulip/Kconfig
> similarity index 93%
> rename from drivers/net/tulip/Kconfig
> rename to drivers/net/ethernet/tulip/Kconfig
> index 1f8d4a8..c298a08 100644
> --- a/drivers/net/tulip/Kconfig
> +++ b/drivers/net/ethernet/tulip/Kconfig
> @@ -2,17 +2,15 @@
> # Tulip family network device configuration
> #
>
> -menuconfig NET_TULIP
> - bool "\"Tulip\" family network device support"
> +config NET_TULIP
> + bool "\"Tulip\" family network devices"
> depends on PCI || EISA || CARDBUS
> - help
> + ---help---
> This selects the "Tulip" family of EISA/PCI network cards.
>
> -if NET_TULIP
> -
> config DE2104X
> tristate "Early DECchip Tulip (dc2104x) PCI support"
> - depends on PCI
> + depends on NET_TULIP && PCI
> select CRC32
> ---help---
> This driver is developed for the SMC EtherPower series Ethernet
> @@ -32,7 +30,7 @@ config DE2104X_DSL
> depends on DE2104X
> range 0 31
> default 0
> - help
> + ---help---
> Setting this value allows to align ring buffer descriptors into their
> own cache lines. Value of 4 corresponds to the typical 32 byte line
> (the descriptor is 16 bytes). This is necessary on systems that lack
> @@ -41,7 +39,7 @@ config DE2104X_DSL
>
> config TULIP
> tristate "DECchip Tulip (dc2114x) PCI support"
> - depends on PCI
> + depends on NET_TULIP && PCI
> select CRC32
> ---help---
> This driver is developed for the SMC EtherPower series Ethernet
> @@ -59,7 +57,7 @@ config TULIP
> config TULIP_MWI
> bool "New bus configuration (EXPERIMENTAL)"
> depends on TULIP && EXPERIMENTAL
> - help
> + ---help---
> This configures your Tulip card specifically for the card and
> system cache line size type you are using.
>
> @@ -70,7 +68,7 @@ config TULIP_MWI
> config TULIP_MMIO
> bool "Use PCI shared mem for NIC registers"
> depends on TULIP
> - help
> + ---help---
> Use PCI shared memory for the NIC registers, rather than going through
> the Tulip's PIO (programmed I/O ports). Faster, but could produce
> obscure bugs if your mainboard has memory controller timing issues.
> @@ -79,7 +77,7 @@ config TULIP_MMIO
> config TULIP_NAPI
> bool "Use RX polling (NAPI)"
> depends on TULIP
> - help
> + ---help---
> NAPI is a new driver API designed to reduce CPU and interrupt load
> when the driver is receiving lots of packets from the card. It is
> still somewhat experimental and thus not yet enabled by default.
> @@ -107,7 +105,7 @@ config TULIP_DM910X
>
> config DE4X5
> tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA"
> - depends on PCI || EISA
> + depends on NET_TULIP && (PCI || EISA)
> select CRC32
> ---help---
> This is support for the DIGITAL series of PCI/EISA Ethernet cards.
> @@ -123,10 +121,10 @@ config DE4X5
>
> config WINBOND_840
> tristate "Winbond W89c840 Ethernet support"
> - depends on PCI
> + depends on NET_TULIP && PCI
> select CRC32
> select MII
> - help
> + ---help---
> This driver is for the Winbond W89c840 chip. It also works with
> the TX9882 chip on the Compex RL100-ATX board.
> More specific information and updates are available from
> @@ -134,7 +132,7 @@ config WINBOND_840
>
> config DM9102
> tristate "Davicom DM910x/DM980x support"
> - depends on PCI
> + depends on NET_TULIP && PCI
> select CRC32
> ---help---
> This driver is for DM9102(A)/DM9132/DM9801 compatible PCI cards from
> @@ -147,7 +145,7 @@ config DM9102
>
> config ULI526X
> tristate "ULi M526x controller support"
> - depends on PCI
> + depends on NET_TULIP && PCI
> select CRC32
> ---help---
> This driver is for ULi M5261/M5263 10/100M Ethernet Controller
> @@ -158,7 +156,7 @@ config ULI526X
>
> config PCMCIA_XIRCOM
> tristate "Xircom CardBus support"
> - depends on CARDBUS
> + depends on NET_TULIP && CARDBUS
> ---help---
> This driver is for the Digital "Tulip" Ethernet CardBus adapters.
> It should work with most DEC 21*4*-based chips/ethercards, as well
> @@ -167,5 +165,3 @@ config PCMCIA_XIRCOM
>
> To compile this driver as a module, choose M here. The module will
> be called xircom_cb. If unsure, say N.
> -
> -endif # NET_TULIP
> diff --git a/drivers/net/tulip/Makefile b/drivers/net/ethernet/tulip/Makefile
> similarity index 100%
> rename from drivers/net/tulip/Makefile
> rename to drivers/net/ethernet/tulip/Makefile
> diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/ethernet/tulip/de2104x.c
> similarity index 100%
> rename from drivers/net/tulip/de2104x.c
> rename to drivers/net/ethernet/tulip/de2104x.c
> diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/ethernet/tulip/de4x5.c
> similarity index 100%
> rename from drivers/net/tulip/de4x5.c
> rename to drivers/net/ethernet/tulip/de4x5.c
> diff --git a/drivers/net/tulip/de4x5.h b/drivers/net/ethernet/tulip/de4x5.h
> similarity index 100%
> rename from drivers/net/tulip/de4x5.h
> rename to drivers/net/ethernet/tulip/de4x5.h
> diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/ethernet/tulip/dmfe.c
> similarity index 100%
> rename from drivers/net/tulip/dmfe.c
> rename to drivers/net/ethernet/tulip/dmfe.c
> diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/ethernet/tulip/eeprom.c
> similarity index 100%
> rename from drivers/net/tulip/eeprom.c
> rename to drivers/net/ethernet/tulip/eeprom.c
> diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/ethernet/tulip/interrupt.c
> similarity index 100%
> rename from drivers/net/tulip/interrupt.c
> rename to drivers/net/ethernet/tulip/interrupt.c
> diff --git a/drivers/net/tulip/media.c b/drivers/net/ethernet/tulip/media.c
> similarity index 100%
> rename from drivers/net/tulip/media.c
> rename to drivers/net/ethernet/tulip/media.c
> diff --git a/drivers/net/tulip/pnic.c b/drivers/net/ethernet/tulip/pnic.c
> similarity index 100%
> rename from drivers/net/tulip/pnic.c
> rename to drivers/net/ethernet/tulip/pnic.c
> diff --git a/drivers/net/tulip/pnic2.c b/drivers/net/ethernet/tulip/pnic2.c
> similarity index 100%
> rename from drivers/net/tulip/pnic2.c
> rename to drivers/net/ethernet/tulip/pnic2.c
> diff --git a/drivers/net/tulip/timer.c b/drivers/net/ethernet/tulip/timer.c
> similarity index 100%
> rename from drivers/net/tulip/timer.c
> rename to drivers/net/ethernet/tulip/timer.c
> diff --git a/drivers/net/tulip/tulip.h b/drivers/net/ethernet/tulip/tulip.h
> similarity index 100%
> rename from drivers/net/tulip/tulip.h
> rename to drivers/net/ethernet/tulip/tulip.h
> diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/ethernet/tulip/tulip_core.c
> similarity index 100%
> rename from drivers/net/tulip/tulip_core.c
> rename to drivers/net/ethernet/tulip/tulip_core.c
> diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/ethernet/tulip/uli526x.c
> similarity index 100%
> rename from drivers/net/tulip/uli526x.c
> rename to drivers/net/ethernet/tulip/uli526x.c
> diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/ethernet/tulip/winbond-840.c
> similarity index 100%
> rename from drivers/net/tulip/winbond-840.c
> rename to drivers/net/ethernet/tulip/winbond-840.c
> diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/ethernet/tulip/xircom_cb.c
> similarity index 100%
> rename from drivers/net/tulip/xircom_cb.c
> rename to drivers/net/ethernet/tulip/xircom_cb.c
> --
> 1.7.5.4
^ permalink raw reply
* Re: [Bugme-new] [Bug 38102] New: BUG kmalloc-2048: Poison overwritten
From: Alexey Zaytsev @ 2011-07-02 21:25 UTC (permalink / raw)
To: Andrew Morton
Cc: netdev, Gary Zambrano, bugme-daemon, David S. Miller,
Pekka Pietikainen, Florian Schirmer, Felix Fietkau,
Michael Buesch
In-Reply-To: <BANLkTi=PxH8V58k-VycsM=1ZiE9hPqCN4Q@mail.gmail.com>
On Fri, Jul 1, 2011 at 10:01, Alexey Zaytsev <alexey.zaytsev@gmail.com> wrote:
> On Thu, Jun 30, 2011 at 01:51, Andrew Morton <akpm@linux-foundation.org> wrote:
>>
>> (switched to email. Please respond via emailed reply-to-all, not via the
>> bugzilla web interface).
>>
>> On Thu, 23 Jun 2011 17:33:54 GMT
>> bugzilla-daemon@bugzilla.kernel.org wrote:
>>
>>> https://bugzilla.kernel.org/show_bug.cgi?id=38102
>>>
>>> Summary: BUG kmalloc-2048: Poison overwritten
>>> Product: Drivers
>>> Version: 2.5
>>> Kernel Version: 3.0.0-rc4
>>
>> Looks like a 2.6.38->2.6.39 regression, perhaps a memory scribble in b44.
>
> Actually, not sure about the version. 39 was the first one I've been
> using in the scenario. Checking older versions now.
> And git-log does not show a lot of changes to the b44 driver, so it
> might be something unrelated.
>
I've checked back as far as 2.6.27, and the problem is still there.
I've also looked through the allocation-related code, and it seemed
sane. I'm not sure I understand the 1GB dma workaround, but this path
is never hit in my case. So adding the driver authors to CC. This
could be something different, but I've been unable to reproduce using
an other machine with an rtl8139 nic.
^ permalink raw reply
* Re: [PATCH 03/12] econet: Reduce switch/case indent
From: Phil Blundell @ 2011-07-02 17:04 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, David S. Miller, netdev
In-Reply-To: <e2f659cf95b88abbdf35c7447d8a4d00d5c424dc.1309549244.git.joe@perches.com>
On Fri, 2011-07-01 at 12:43 -0700, Joe Perches wrote:
> Make the case labels the same indent as the switch.
>
> Simplify a default case / return (unreached)
> Remove unnecessary break after return.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Phil Blundell <philb@gnu.org>
Thanks.
p.
^ permalink raw reply
* [net-next PATCH 2/2] dcbnl: Add CEE notification
From: Shmulik Ravid @ 2011-07-02 16:38 UTC (permalink / raw)
To: davem; +Cc: John Fastabend, netdev
This patch add an unsolicited notification of the DCBX negotiated
parameters for the CEE flavor of the DCBX protocol. The notification
message is identical to the aggregated CEE get operation and holds all
the pertinent local and peer information. The notification routine is
exported so it can be invoked by drivers supporting an embedded DCBX
stack.
Signed-off-by: Shmulik Ravid <shmulikr@broadcom.com>
---
include/net/dcbnl.h | 5 +-
net/dcb/dcbnl.c | 409 ++++++++++++++++++++++++++++-----------------------
2 files changed, 226 insertions(+), 188 deletions(-)
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index d5bbb79..f5aa399 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -34,7 +34,10 @@ int dcb_ieee_setapp(struct net_device *, struct dcb_app *);
int dcb_ieee_delapp(struct net_device *, struct dcb_app *);
u8 dcb_ieee_getapp_mask(struct net_device *, struct dcb_app *);
-int dcbnl_notify(struct net_device *dev, int event, int cmd, u32 seq, u32 pid);
+int dcbnl_ieee_notify(struct net_device *dev, int event, int cmd,
+ u32 seq, u32 pid);
+int dcbnl_cee_notify(struct net_device *dev, int event, int cmd,
+ u32 seq, u32 pid);
/*
* Ops struct for the netlink callbacks. Used by DCB-enabled drivers through
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 5b75ed7..1937f92 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1310,8 +1310,193 @@ nla_put_failure:
return err;
}
-int dcbnl_notify(struct net_device *dev, int event, int cmd,
- u32 seq, u32 pid)
+static int dcbnl_cee_pg_fill(struct sk_buff *skb, struct net_device *dev,
+ int dir)
+{
+ u8 pgid, up_map, prio, tc_pct;
+ const struct dcbnl_rtnl_ops *ops = dev->dcbnl_ops;
+ int i = dir ? DCB_ATTR_CEE_TX_PG : DCB_ATTR_CEE_RX_PG;
+ struct nlattr *pg = nla_nest_start(skb, i);
+ if (!pg)
+ goto nla_put_failure;
+
+ for (i = DCB_PG_ATTR_TC_0; i <= DCB_PG_ATTR_TC_7; i++) {
+ struct nlattr *tc_nest = nla_nest_start(skb, i);
+ if (!tc_nest)
+ goto nla_put_failure;
+
+ pgid = DCB_ATTR_VALUE_UNDEFINED;
+ prio = DCB_ATTR_VALUE_UNDEFINED;
+ tc_pct = DCB_ATTR_VALUE_UNDEFINED;
+ up_map = DCB_ATTR_VALUE_UNDEFINED;
+
+ if (!dir)
+ ops->getpgtccfgrx(dev, i - DCB_PG_ATTR_TC_0,
+ &prio, &pgid, &tc_pct, &up_map);
+ else
+ ops->getpgtccfgtx(dev, i - DCB_PG_ATTR_TC_0,
+ &prio, &pgid, &tc_pct, &up_map);
+
+ NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_PGID, pgid);
+ NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_UP_MAPPING, up_map);
+ NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_STRICT_PRIO, prio);
+ NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_BW_PCT, tc_pct);
+ nla_nest_end(skb, tc_nest);
+ }
+
+ for (i = DCB_PG_ATTR_BW_ID_0; i <= DCB_PG_ATTR_BW_ID_7; i++) {
+ tc_pct = DCB_ATTR_VALUE_UNDEFINED;
+
+ if (!dir)
+ ops->getpgbwgcfgrx(dev, i - DCB_PG_ATTR_BW_ID_0,
+ &tc_pct);
+ else
+ ops->getpgbwgcfgtx(dev, i - DCB_PG_ATTR_BW_ID_0,
+ &tc_pct);
+ NLA_PUT_U8(skb, i, tc_pct);
+ }
+ nla_nest_end(skb, pg);
+ return 0;
+
+nla_put_failure:
+ return -EMSGSIZE;
+}
+
+static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev)
+{
+ struct nlattr *cee, *app;
+ struct dcb_app_type *itr;
+ const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
+ int dcbx, i, err = -EMSGSIZE;
+ u8 value;
+
+ NLA_PUT_STRING(skb, DCB_ATTR_IFNAME, netdev->name);
+
+ cee = nla_nest_start(skb, DCB_ATTR_CEE);
+ if (!cee)
+ goto nla_put_failure;
+
+ /* local pg */
+ if (ops->getpgtccfgtx && ops->getpgbwgcfgtx) {
+ err = dcbnl_cee_pg_fill(skb, netdev, 1);
+ if (err)
+ goto nla_put_failure;
+ }
+
+ if (ops->getpgtccfgrx && ops->getpgbwgcfgrx) {
+ err = dcbnl_cee_pg_fill(skb, netdev, 0);
+ if (err)
+ goto nla_put_failure;
+ }
+
+ /* local pfc */
+ if (ops->getpfccfg) {
+ struct nlattr *pfc_nest = nla_nest_start(skb, DCB_ATTR_CEE_PFC);
+ if (!pfc_nest)
+ goto nla_put_failure;
+
+ for (i = DCB_PFC_UP_ATTR_0; i <= DCB_PFC_UP_ATTR_7; i++) {
+ ops->getpfccfg(netdev, i - DCB_PFC_UP_ATTR_0, &value);
+ NLA_PUT_U8(skb, i, value);
+ }
+ nla_nest_end(skb, pfc_nest);
+ }
+
+ /* local app */
+ spin_lock(&dcb_lock);
+ app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE);
+ if (!app)
+ goto nla_put_failure;
+
+ list_for_each_entry(itr, &dcb_app_list, list) {
+ if (strncmp(itr->name, netdev->name, IFNAMSIZ) == 0) {
+ struct nlattr *app_nest = nla_nest_start(skb,
+ DCB_ATTR_APP);
+ if (!app_nest)
+ goto dcb_unlock;
+
+ err = nla_put_u8(skb, DCB_APP_ATTR_IDTYPE,
+ itr->app.selector);
+ if (err)
+ goto dcb_unlock;
+
+ err = nla_put_u16(skb, DCB_APP_ATTR_ID,
+ itr->app.protocol);
+ if (err)
+ goto dcb_unlock;
+
+ err = nla_put_u8(skb, DCB_APP_ATTR_PRIORITY,
+ itr->app.priority);
+ if (err)
+ goto dcb_unlock;
+
+ nla_nest_end(skb, app_nest);
+ }
+ }
+ nla_nest_end(skb, app);
+
+ if (netdev->dcbnl_ops->getdcbx)
+ dcbx = netdev->dcbnl_ops->getdcbx(netdev);
+ else
+ dcbx = -EOPNOTSUPP;
+
+ spin_unlock(&dcb_lock);
+
+ /* features flags */
+ if (ops->getfeatcfg) {
+ struct nlattr *feat = nla_nest_start(skb, DCB_ATTR_CEE_FEAT);
+ if (!feat)
+ goto nla_put_failure;
+
+ for (i = DCB_FEATCFG_ATTR_ALL + 1; i <= DCB_FEATCFG_ATTR_MAX;
+ i++)
+ if (!ops->getfeatcfg(netdev, i, &value))
+ NLA_PUT_U8(skb, i, value);
+
+ nla_nest_end(skb, feat);
+ }
+
+ /* peer info if available */
+ if (ops->cee_peer_getpg) {
+ struct cee_pg pg;
+ err = ops->cee_peer_getpg(netdev, &pg);
+ if (!err)
+ NLA_PUT(skb, DCB_ATTR_CEE_PEER_PG, sizeof(pg), &pg);
+ }
+
+ if (ops->cee_peer_getpfc) {
+ struct cee_pfc pfc;
+ err = ops->cee_peer_getpfc(netdev, &pfc);
+ if (!err)
+ NLA_PUT(skb, DCB_ATTR_CEE_PEER_PFC, sizeof(pfc), &pfc);
+ }
+
+ if (ops->peer_getappinfo && ops->peer_getapptable) {
+ err = dcbnl_build_peer_app(netdev, skb,
+ DCB_ATTR_CEE_PEER_APP_TABLE,
+ DCB_ATTR_CEE_PEER_APP_INFO,
+ DCB_ATTR_CEE_PEER_APP);
+ if (err)
+ goto nla_put_failure;
+ }
+ nla_nest_end(skb, cee);
+
+ /* DCBX state */
+ if (dcbx >= 0) {
+ err = nla_put_u8(skb, DCB_ATTR_DCBX, dcbx);
+ if (err)
+ goto nla_put_failure;
+ }
+ return 0;
+
+dcb_unlock:
+ spin_unlock(&dcb_lock);
+nla_put_failure:
+ return err;
+}
+
+static int dcbnl_notify(struct net_device *dev, int event, int cmd,
+ u32 seq, u32 pid, int dcbx_ver)
{
struct net *net = dev_net(dev);
struct sk_buff *skb;
@@ -1337,7 +1522,11 @@ int dcbnl_notify(struct net_device *dev, int event, int cmd,
dcb->dcb_family = AF_UNSPEC;
dcb->cmd = cmd;
- err = dcbnl_ieee_fill(skb, dev);
+ if (dcbx_ver == DCB_CAP_DCBX_VER_IEEE)
+ err = dcbnl_ieee_fill(skb, dev);
+ else
+ err = dcbnl_cee_fill(skb, dev);
+
if (err < 0) {
/* Report error to broadcast listeners */
nlmsg_cancel(skb, nlh);
@@ -1351,7 +1540,20 @@ int dcbnl_notify(struct net_device *dev, int event, int cmd,
return err;
}
-EXPORT_SYMBOL(dcbnl_notify);
+
+int dcbnl_ieee_notify(struct net_device *dev, int event, int cmd,
+ u32 seq, u32 pid)
+{
+ return dcbnl_notify(dev, event, cmd, seq, pid, DCB_CAP_DCBX_VER_IEEE);
+}
+EXPORT_SYMBOL(dcbnl_ieee_notify);
+
+int dcbnl_cee_notify(struct net_device *dev, int event, int cmd,
+ u32 seq, u32 pid)
+{
+ return dcbnl_notify(dev, event, cmd, seq, pid, DCB_CAP_DCBX_VER_CEE);
+}
+EXPORT_SYMBOL(dcbnl_cee_notify);
/* Handle IEEE 802.1Qaz SET commands. If any requested operation can not
* be completed the entire msg is aborted and error value is returned.
@@ -1411,7 +1613,7 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlattr **tb,
err:
dcbnl_reply(err, RTM_SETDCB, DCB_CMD_IEEE_SET, DCB_ATTR_IEEE,
pid, seq, flags);
- dcbnl_notify(netdev, RTM_SETDCB, DCB_CMD_IEEE_SET, seq, 0);
+ dcbnl_ieee_notify(netdev, RTM_SETDCB, DCB_CMD_IEEE_SET, seq, 0);
return err;
}
@@ -1495,7 +1697,7 @@ static int dcbnl_ieee_del(struct net_device *netdev, struct nlattr **tb,
err:
dcbnl_reply(err, RTM_SETDCB, DCB_CMD_IEEE_DEL, DCB_ATTR_IEEE,
pid, seq, flags);
- dcbnl_notify(netdev, RTM_SETDCB, DCB_CMD_IEEE_DEL, seq, 0);
+ dcbnl_ieee_notify(netdev, RTM_SETDCB, DCB_CMD_IEEE_DEL, seq, 0);
return err;
}
@@ -1642,70 +1844,16 @@ err:
return ret;
}
-static int dcbnl_cee_pg_fill(struct sk_buff *skb, struct net_device *dev,
- int dir)
-{
- u8 pgid, up_map, prio, tc_pct;
- const struct dcbnl_rtnl_ops *ops = dev->dcbnl_ops;
- int i = dir ? DCB_ATTR_CEE_TX_PG : DCB_ATTR_CEE_RX_PG;
- struct nlattr *pg = nla_nest_start(skb, i);
- if (!pg)
- goto nla_put_failure;
-
- for (i = DCB_PG_ATTR_TC_0; i <= DCB_PG_ATTR_TC_7; i++) {
- struct nlattr *tc_nest = nla_nest_start(skb, i);
- if (!tc_nest)
- goto nla_put_failure;
-
- pgid = DCB_ATTR_VALUE_UNDEFINED;
- prio = DCB_ATTR_VALUE_UNDEFINED;
- tc_pct = DCB_ATTR_VALUE_UNDEFINED;
- up_map = DCB_ATTR_VALUE_UNDEFINED;
-
- if (!dir)
- ops->getpgtccfgrx(dev, i - DCB_PG_ATTR_TC_0,
- &prio, &pgid, &tc_pct, &up_map);
- else
- ops->getpgtccfgtx(dev, i - DCB_PG_ATTR_TC_0,
- &prio, &pgid, &tc_pct, &up_map);
-
- NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_PGID, pgid);
- NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_UP_MAPPING, up_map);
- NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_STRICT_PRIO, prio);
- NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_BW_PCT, tc_pct);
- nla_nest_end(skb, tc_nest);
- }
-
- for (i = DCB_PG_ATTR_BW_ID_0; i <= DCB_PG_ATTR_BW_ID_7; i++) {
- tc_pct = DCB_ATTR_VALUE_UNDEFINED;
-
- if (!dir)
- ops->getpgbwgcfgrx(dev, i - DCB_PG_ATTR_BW_ID_0,
- &tc_pct);
- else
- ops->getpgbwgcfgtx(dev, i - DCB_PG_ATTR_BW_ID_0,
- &tc_pct);
- NLA_PUT_U8(skb, i, tc_pct);
- }
- nla_nest_end(skb, pg);
- return 0;
-
-nla_put_failure:
- return -EMSGSIZE;
-}
-
/* Handle CEE DCBX GET commands. */
static int dcbnl_cee_get(struct net_device *netdev, struct nlattr **tb,
u32 pid, u32 seq, u16 flags)
{
+ struct net *net = dev_net(netdev);
struct sk_buff *skb;
struct nlmsghdr *nlh;
struct dcbmsg *dcb;
- struct nlattr *cee, *app;
- struct dcb_app_type *itr;
const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
- int dcbx, i, err = -EMSGSIZE;
- u8 value;
+ int err;
if (!ops)
return -EOPNOTSUPP;
@@ -1714,138 +1862,25 @@ static int dcbnl_cee_get(struct net_device *netdev, struct nlattr **tb,
if (!skb)
return -ENOBUFS;
- nlh = NLMSG_NEW(skb, pid, seq, RTM_GETDCB, sizeof(*dcb), flags);
+ nlh = nlmsg_put(skb, pid, seq, RTM_GETDCB, sizeof(*dcb), flags);
+ if (nlh == NULL) {
+ nlmsg_free(skb);
+ return -EMSGSIZE;
+ }
dcb = NLMSG_DATA(nlh);
dcb->dcb_family = AF_UNSPEC;
dcb->cmd = DCB_CMD_CEE_GET;
- NLA_PUT_STRING(skb, DCB_ATTR_IFNAME, netdev->name);
-
- cee = nla_nest_start(skb, DCB_ATTR_CEE);
- if (!cee)
- goto nla_put_failure;
-
- /* local pg */
- if (ops->getpgtccfgtx && ops->getpgbwgcfgtx) {
- err = dcbnl_cee_pg_fill(skb, netdev, 1);
- if (err)
- goto nla_put_failure;
- }
-
- if (ops->getpgtccfgrx && ops->getpgbwgcfgrx) {
- err = dcbnl_cee_pg_fill(skb, netdev, 0);
- if (err)
- goto nla_put_failure;
- }
-
- /* local pfc */
- if (ops->getpfccfg) {
- struct nlattr *pfc_nest = nla_nest_start(skb, DCB_ATTR_CEE_PFC);
- if (!pfc_nest)
- goto nla_put_failure;
-
- for (i = DCB_PFC_UP_ATTR_0; i <= DCB_PFC_UP_ATTR_7; i++) {
- ops->getpfccfg(netdev, i - DCB_PFC_UP_ATTR_0, &value);
- NLA_PUT_U8(skb, i, value);
- }
- nla_nest_end(skb, pfc_nest);
- }
-
- /* local app */
- spin_lock(&dcb_lock);
- app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE);
- if (!app)
- goto nla_put_failure;
-
- list_for_each_entry(itr, &dcb_app_list, list) {
- if (strncmp(itr->name, netdev->name, IFNAMSIZ) == 0) {
- struct nlattr *app_nest = nla_nest_start(skb,
- DCB_ATTR_APP);
- if (!app_nest)
- goto dcb_unlock;
-
- err = nla_put_u8(skb, DCB_APP_ATTR_IDTYPE,
- itr->app.selector);
- if (err)
- goto dcb_unlock;
-
- err = nla_put_u16(skb, DCB_APP_ATTR_ID,
- itr->app.protocol);
- if (err)
- goto dcb_unlock;
-
- err = nla_put_u8(skb, DCB_APP_ATTR_PRIORITY,
- itr->app.priority);
- if (err)
- goto dcb_unlock;
-
- nla_nest_end(skb, app_nest);
- }
- }
- nla_nest_end(skb, app);
-
- if (netdev->dcbnl_ops->getdcbx)
- dcbx = netdev->dcbnl_ops->getdcbx(netdev);
- else
- dcbx = -EOPNOTSUPP;
-
- spin_unlock(&dcb_lock);
-
- /* features flags */
- if (ops->getfeatcfg) {
- struct nlattr *feat = nla_nest_start(skb, DCB_ATTR_CEE_FEAT);
- if (!feat)
- goto nla_put_failure;
+ err = dcbnl_cee_fill(skb, netdev);
- for (i = DCB_FEATCFG_ATTR_ALL + 1; i <= DCB_FEATCFG_ATTR_MAX;
- i++)
- if (!ops->getfeatcfg(netdev, i, &value))
- NLA_PUT_U8(skb, i, value);
-
- nla_nest_end(skb, feat);
- }
-
- /* peer info if available */
- if (ops->cee_peer_getpg) {
- struct cee_pg pg;
- err = ops->cee_peer_getpg(netdev, &pg);
- if (!err)
- NLA_PUT(skb, DCB_ATTR_CEE_PEER_PG, sizeof(pg), &pg);
- }
-
- if (ops->cee_peer_getpfc) {
- struct cee_pfc pfc;
- err = ops->cee_peer_getpfc(netdev, &pfc);
- if (!err)
- NLA_PUT(skb, DCB_ATTR_CEE_PEER_PFC, sizeof(pfc), &pfc);
- }
-
- if (ops->peer_getappinfo && ops->peer_getapptable) {
- err = dcbnl_build_peer_app(netdev, skb,
- DCB_ATTR_CEE_PEER_APP_TABLE,
- DCB_ATTR_CEE_PEER_APP_INFO,
- DCB_ATTR_CEE_PEER_APP);
- if (err)
- goto nla_put_failure;
- }
- nla_nest_end(skb, cee);
-
- /* DCBX state */
- if (dcbx >= 0) {
- err = nla_put_u8(skb, DCB_ATTR_DCBX, dcbx);
- if (err)
- goto nla_put_failure;
+ if (err < 0) {
+ nlmsg_cancel(skb, nlh);
+ nlmsg_free(skb);
+ } else {
+ nlmsg_end(skb, nlh);
+ err = rtnl_unicast(skb, net, pid);
}
- nlmsg_end(skb, nlh);
- return rtnl_unicast(skb, &init_net, pid);
-
-dcb_unlock:
- spin_unlock(&dcb_lock);
-nla_put_failure:
- nlmsg_cancel(skb, nlh);
-nlmsg_failure:
- nlmsg_free(skb);
return err;
}
--
1.7.3.5
^ permalink raw reply related
* [net-next PATCH 1/2] dcbnl: Aggregated CEE GET operation
From: Shmulik Ravid @ 2011-07-02 16:33 UTC (permalink / raw)
To: davem; +Cc: John Fastabend, netdev
The following couple of patches add dcbnl an unsolicited notification of
the the DCB configuration for the CEE flavor of the DCBX protocol. This
is useful when the user-mode DCB client is not responsible for
conducting and resolving the DCBX negotiation (either because the DCBX
stack is embedded in the HW or the negotiation is handled by another
agent in he host), but still needs to get the negotiated parameters.
This functionality already exists for the IEEE flavor of the DCBX
protocol and these patches add it to the older CEE flavor.
The first patch extends the CEE attribute GET operation to include not
only the peer information, but also all the pertinent local
configuration (negotiated parameters). The second patch adds and export
a CEE specific notification routine.
Signed-off-by: Shmulik Ravid <shmulikr@broadcom.com>
---
include/linux/dcbnl.h | 20 ++++++-
net/dcb/dcbnl.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 168 insertions(+), 8 deletions(-)
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index 66a6723..c875244 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -333,15 +333,26 @@ enum ieee_attrs_app {
#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1)
/**
- * enum cee_attrs - CEE DCBX get attributes
+ * enum cee_attrs - CEE DCBX get attributes. An aggregated collection of the
+ * cee std negotiated parameters
*
* @DCB_ATTR_CEE_UNSPEC: unspecified
+ * @DCB_ATTR_CEE_FEAT: DCBX features flags (DCB_CMD_GFEATCFG)
+ * @DCB_ATTR_CEE_RX_PG: RX PG configuration (DCB_CMD_PGRX_GCFG)
+ * @DCB_ATTR_CEE_TX_PG: TX PG configuration (DCB_CMD_PGTX_GCFG)
+ * @DCB_ATTR_CEE_PFC: PFC configuration (DCB_CMD_PFC_GCFG)
+ * @DCB_ATTR_CEE_APP_TABLE: APP configuration (multi DCB_CMD_GAPP)
* @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only
* @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only
* @DCB_ATTR_CEE_PEER_APP: peer APP tlv - get only
*/
enum cee_attrs {
DCB_ATTR_CEE_UNSPEC,
+ DCB_ATTR_CEE_TX_PG,
+ DCB_ATTR_CEE_RX_PG,
+ DCB_ATTR_CEE_PFC,
+ DCB_ATTR_CEE_APP_TABLE,
+ DCB_ATTR_CEE_FEAT,
DCB_ATTR_CEE_PEER_PG,
DCB_ATTR_CEE_PEER_PFC,
DCB_ATTR_CEE_PEER_APP_TABLE,
@@ -357,6 +368,13 @@ enum peer_app_attr {
};
#define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1)
+enum cee_attrs_app {
+ DCB_ATTR_CEE_APP_UNSPEC,
+ DCB_ATTR_CEE_APP,
+ __DCB_ATTR_CEE_APP_MAX
+};
+#define DCB_ATTR_CEE_APP_MAX (__DCB_ATTR_CEE_APP_MAX - 1)
+
/**
* enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
*
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index fc56e85..5b75ed7 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1642,6 +1642,58 @@ err:
return ret;
}
+static int dcbnl_cee_pg_fill(struct sk_buff *skb, struct net_device *dev,
+ int dir)
+{
+ u8 pgid, up_map, prio, tc_pct;
+ const struct dcbnl_rtnl_ops *ops = dev->dcbnl_ops;
+ int i = dir ? DCB_ATTR_CEE_TX_PG : DCB_ATTR_CEE_RX_PG;
+ struct nlattr *pg = nla_nest_start(skb, i);
+ if (!pg)
+ goto nla_put_failure;
+
+ for (i = DCB_PG_ATTR_TC_0; i <= DCB_PG_ATTR_TC_7; i++) {
+ struct nlattr *tc_nest = nla_nest_start(skb, i);
+ if (!tc_nest)
+ goto nla_put_failure;
+
+ pgid = DCB_ATTR_VALUE_UNDEFINED;
+ prio = DCB_ATTR_VALUE_UNDEFINED;
+ tc_pct = DCB_ATTR_VALUE_UNDEFINED;
+ up_map = DCB_ATTR_VALUE_UNDEFINED;
+
+ if (!dir)
+ ops->getpgtccfgrx(dev, i - DCB_PG_ATTR_TC_0,
+ &prio, &pgid, &tc_pct, &up_map);
+ else
+ ops->getpgtccfgtx(dev, i - DCB_PG_ATTR_TC_0,
+ &prio, &pgid, &tc_pct, &up_map);
+
+ NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_PGID, pgid);
+ NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_UP_MAPPING, up_map);
+ NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_STRICT_PRIO, prio);
+ NLA_PUT_U8(skb, DCB_TC_ATTR_PARAM_BW_PCT, tc_pct);
+ nla_nest_end(skb, tc_nest);
+ }
+
+ for (i = DCB_PG_ATTR_BW_ID_0; i <= DCB_PG_ATTR_BW_ID_7; i++) {
+ tc_pct = DCB_ATTR_VALUE_UNDEFINED;
+
+ if (!dir)
+ ops->getpgbwgcfgrx(dev, i - DCB_PG_ATTR_BW_ID_0,
+ &tc_pct);
+ else
+ ops->getpgbwgcfgtx(dev, i - DCB_PG_ATTR_BW_ID_0,
+ &tc_pct);
+ NLA_PUT_U8(skb, i, tc_pct);
+ }
+ nla_nest_end(skb, pg);
+ return 0;
+
+nla_put_failure:
+ return -EMSGSIZE;
+}
+
/* Handle CEE DCBX GET commands. */
static int dcbnl_cee_get(struct net_device *netdev, struct nlattr **tb,
u32 pid, u32 seq, u16 flags)
@@ -1649,9 +1701,11 @@ static int dcbnl_cee_get(struct net_device *netdev, struct nlattr **tb,
struct sk_buff *skb;
struct nlmsghdr *nlh;
struct dcbmsg *dcb;
- struct nlattr *cee;
+ struct nlattr *cee, *app;
+ struct dcb_app_type *itr;
const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
- int err;
+ int dcbx, i, err = -EMSGSIZE;
+ u8 value;
if (!ops)
return -EOPNOTSUPP;
@@ -1672,7 +1726,87 @@ static int dcbnl_cee_get(struct net_device *netdev, struct nlattr **tb,
if (!cee)
goto nla_put_failure;
- /* get peer info if available */
+ /* local pg */
+ if (ops->getpgtccfgtx && ops->getpgbwgcfgtx) {
+ err = dcbnl_cee_pg_fill(skb, netdev, 1);
+ if (err)
+ goto nla_put_failure;
+ }
+
+ if (ops->getpgtccfgrx && ops->getpgbwgcfgrx) {
+ err = dcbnl_cee_pg_fill(skb, netdev, 0);
+ if (err)
+ goto nla_put_failure;
+ }
+
+ /* local pfc */
+ if (ops->getpfccfg) {
+ struct nlattr *pfc_nest = nla_nest_start(skb, DCB_ATTR_CEE_PFC);
+ if (!pfc_nest)
+ goto nla_put_failure;
+
+ for (i = DCB_PFC_UP_ATTR_0; i <= DCB_PFC_UP_ATTR_7; i++) {
+ ops->getpfccfg(netdev, i - DCB_PFC_UP_ATTR_0, &value);
+ NLA_PUT_U8(skb, i, value);
+ }
+ nla_nest_end(skb, pfc_nest);
+ }
+
+ /* local app */
+ spin_lock(&dcb_lock);
+ app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE);
+ if (!app)
+ goto nla_put_failure;
+
+ list_for_each_entry(itr, &dcb_app_list, list) {
+ if (strncmp(itr->name, netdev->name, IFNAMSIZ) == 0) {
+ struct nlattr *app_nest = nla_nest_start(skb,
+ DCB_ATTR_APP);
+ if (!app_nest)
+ goto dcb_unlock;
+
+ err = nla_put_u8(skb, DCB_APP_ATTR_IDTYPE,
+ itr->app.selector);
+ if (err)
+ goto dcb_unlock;
+
+ err = nla_put_u16(skb, DCB_APP_ATTR_ID,
+ itr->app.protocol);
+ if (err)
+ goto dcb_unlock;
+
+ err = nla_put_u8(skb, DCB_APP_ATTR_PRIORITY,
+ itr->app.priority);
+ if (err)
+ goto dcb_unlock;
+
+ nla_nest_end(skb, app_nest);
+ }
+ }
+ nla_nest_end(skb, app);
+
+ if (netdev->dcbnl_ops->getdcbx)
+ dcbx = netdev->dcbnl_ops->getdcbx(netdev);
+ else
+ dcbx = -EOPNOTSUPP;
+
+ spin_unlock(&dcb_lock);
+
+ /* features flags */
+ if (ops->getfeatcfg) {
+ struct nlattr *feat = nla_nest_start(skb, DCB_ATTR_CEE_FEAT);
+ if (!feat)
+ goto nla_put_failure;
+
+ for (i = DCB_FEATCFG_ATTR_ALL + 1; i <= DCB_FEATCFG_ATTR_MAX;
+ i++)
+ if (!ops->getfeatcfg(netdev, i, &value))
+ NLA_PUT_U8(skb, i, value);
+
+ nla_nest_end(skb, feat);
+ }
+
+ /* peer info if available */
if (ops->cee_peer_getpg) {
struct cee_pg pg;
err = ops->cee_peer_getpg(netdev, &pg);
@@ -1695,16 +1829,24 @@ static int dcbnl_cee_get(struct net_device *netdev, struct nlattr **tb,
if (err)
goto nla_put_failure;
}
-
nla_nest_end(skb, cee);
- nlmsg_end(skb, nlh);
+ /* DCBX state */
+ if (dcbx >= 0) {
+ err = nla_put_u8(skb, DCB_ATTR_DCBX, dcbx);
+ if (err)
+ goto nla_put_failure;
+ }
+ nlmsg_end(skb, nlh);
return rtnl_unicast(skb, &init_net, pid);
+
+dcb_unlock:
+ spin_unlock(&dcb_lock);
nla_put_failure:
nlmsg_cancel(skb, nlh);
nlmsg_failure:
- kfree_skb(skb);
- return -1;
+ nlmsg_free(skb);
+ return err;
}
static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
--
1.7.3.5
^ permalink raw reply related
* Re: [PATCH] sctp: fix missing send up SCTP_SENDER_DRY_EVENT when subscribe it
From: David Miller @ 2011-07-02 11:55 UTC (permalink / raw)
To: weiyj.lk; +Cc: netdev, linux-sctp, Michael.Tuexen, seggelmann
In-Reply-To: <4E0F6F20.5020505@gmail.com>
From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Sun, 03 Jul 2011 03:18:56 +0800
> @@ -2073,10 +2073,33 @@ static int
> sctp_setsockopt_disable_fragments(struct sock *sk,
Patch corrupted by your email client.
^ permalink raw reply
* [PATCH v2] sctp: fix missing send up SCTP_SENDER_DRY_EVENT when subscribe it
From: Wei Yongjun @ 2011-07-02 19:28 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-sctp, Michael Tüxen, Robin Seggelmann
From: Wei Yongjun <yjwei@cn.fujitsu.com>
We forgot to send up SCTP_SENDER_DRY_EVENT notification when
user app subscribes to this event, and there is no data to be
sent or retransmit.
This is required by the Socket API and used by the DTLS/SCTP
implementation.
Reported-by: Michael Tüxen <Michael.Tuexen@lurchi.franken.de>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Tested-by: Robin Seggelmann <seggelmann@fh-muenster.de>
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6766913..99e25de 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2073,10 +2073,33 @@ static int sctp_setsockopt_disable_fragments(struct sock *sk,
static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
unsigned int optlen)
{
+ struct sctp_association *asoc;
+ struct sctp_ulpevent *event;
+
if (optlen > sizeof(struct sctp_event_subscribe))
return -EINVAL;
if (copy_from_user(&sctp_sk(sk)->subscribe, optval, optlen))
return -EFAULT;
+
+ /*
+ * At the time when a user app subscribes to SCTP_SENDER_DRY_EVENT,
+ * if there is no data to be sent or retransmit, the stack will
+ * immediately send up this notification.
+ */
+ if (sctp_ulpevent_type_enabled(SCTP_SENDER_DRY_EVENT,
+ &sctp_sk(sk)->subscribe)) {
+ asoc = sctp_id2assoc(sk, 0);
+
+ if (asoc && sctp_outq_is_empty(&asoc->outqueue)) {
+ event = sctp_ulpevent_make_sender_dry_event(asoc,
+ GFP_ATOMIC);
+ if (!event)
+ return -ENOMEM;
+
+ sctp_ulpq_tail_event(&asoc->ulpq, event);
+ }
+ }
+
return 0;
}
--
1.7.5.1
^ permalink raw reply related
* [PATCH] sctp: fix missing send up SCTP_SENDER_DRY_EVENT when subscribe it
From: Wei Yongjun @ 2011-07-02 19:18 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-sctp, Michael Tüxen, Robin Seggelmann
From: Wei Yongjun<yjwei@cn.fujitsu.com>
We forgot to send up SCTP_SENDER_DRY_EVENT notification when
user app subscribes to this event, and there is no data to be
sent or retransmit.
This is required by the Socket API and used by the DTLS/SCTP
implementation.
Reported-by: Michael Tüxen<Michael.Tuexen@lurchi.franken.de>
Signed-off-by: Wei Yongjun<yjwei@cn.fujitsu.com>
Tested-by: Robin Seggelmann<seggelmann@fh-muenster.de>
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6766913..99e25de 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2073,10 +2073,33 @@ static int sctp_setsockopt_disable_fragments(struct sock *sk,
static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
unsigned int optlen)
{
+ struct sctp_association *asoc;
+ struct sctp_ulpevent *event;
+
if (optlen> sizeof(struct sctp_event_subscribe))
return -EINVAL;
if (copy_from_user(&sctp_sk(sk)->subscribe, optval, optlen))
return -EFAULT;
+
+ /*
+ * At the time when a user app subscribes to SCTP_SENDER_DRY_EVENT,
+ * if there is no data to be sent or retransmit, the stack will
+ * immediately send up this notification.
+ */
+ if (sctp_ulpevent_type_enabled(SCTP_SENDER_DRY_EVENT,
+ &sctp_sk(sk)->subscribe)) {
+ asoc = sctp_id2assoc(sk, 0);
+
+ if (asoc&& sctp_outq_is_empty(&asoc->outqueue)) {
+ event = sctp_ulpevent_make_sender_dry_event(asoc,
+ GFP_ATOMIC);
+ if (!event)
+ return -ENOMEM;
+
+ sctp_ulpq_tail_event(&asoc->ulpq, event);
+ }
+ }
+
return 0;
}
--
1.7.5.1
^ permalink raw reply related
* Re: [PATCH] net: 8139too: Initial necessary vlan_features to support vlan
From: Francois Romieu @ 2011-07-02 9:51 UTC (permalink / raw)
To: Shan Wei; +Cc: David Miller, netdev, Alexey Dobriyan, tj
In-Reply-To: <4E0ED194.2030103@cn.fujitsu.com>
Shan Wei <shanwei@cn.fujitsu.com> :
> Offload setting of vlan device requires
> vlan_features to be initialed.
[...]
> @@ -993,6 +993,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
> * features
> */
> dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
> + dev->vlan_features = dev->features;
/* note: the hardware is not capable of sg/csum/highdma, however
* through the use of skb_copy_and_csum_dev we enable these
* features
*/
The commit message is a bit misleading wrt hardware capabilities but the
patch makes sense.
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
--
Ueimor
^ permalink raw reply
* Re: [PATCH] Disable router anycast address for /127 prefixes
From: Bjørn Mork @ 2011-07-02 9:38 UTC (permalink / raw)
To: Brian Haley; +Cc: netdev
In-Reply-To: <4E0E1B85.1080906@hp.com>
Brian Haley <brian.haley@hp.com> writes:
> On 07/01/2011 02:26 PM, Bjørn Mork wrote:
>> Brian Haley <brian.haley@hp.com> writes:
>>
>>> I'm not sure you'd need this part as there shouldn't be a /127 in the list to remove.
>>
>> I don't understand exactly what you mean here....
>
> If you never add an anycast address when the prefix length is 127, the address
> wouldn't be there when you went to remove it. In other words, the call to
> __ipv6_dev_ac_dec() would return -ENOENT, which is ignored anyways.
Doh! Of course. Sorry for being that slow...
And thanks for taking the time to feed it to me with a small enough
spoon :-)
> It's not a common codepath so the two lines of code wouldn't hurt anything
> I guess...
Personally I prefer "symmetric" coding because it leaves fewer questions
unanswered (necessary for the slow among us, as demonstrated above).
But I think that's for those actually maintaining this code to decide.
I can post an updated patch if required, or feel free to apply only the
first hunk.
Bjørn
^ permalink raw reply
* [PATCH] net: 8139too: Initial necessary vlan_features to support vlan
From: Shan Wei @ 2011-07-02 8:06 UTC (permalink / raw)
To: David Miller, 单卫, netdev, Alexey Dobriyan, tj
Offload setting of vlan device requires
vlan_features to be initialed.
Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
drivers/net/8139too.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index ed6355c..c2672c6 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -993,6 +993,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
* features
*/
dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
+ dev->vlan_features = dev->features;
dev->irq = pdev->irq;
--
1.7.4.1
^ permalink raw reply related
* Re: [RFC][NET-NEXT PATCH 2/2] net: Add GSO to vlan_features initialization
From: Shan Wei @ 2011-07-02 7:07 UTC (permalink / raw)
To: Ben Hutchings
Cc: David Miller, netdev, Eric Dumazet, Michał Mirosław,
therbert@google.com
In-Reply-To: <4E094EE7.1000203@cn.fujitsu.com>
Hi Ben:
Shan Wei wrote, at 06/28/2011 11:47 AM:
> Hi Ben:
>
> Ben Hutchings wrote, at 06/25/2011 12:51 AM:
>> Have you verified that GSO works correctly for VLAN devices if the
>> underlying device does not support VLAN tag insertion?
>
> OK. I will do some test in future days.
> Then report test results.
Results is coming....
GSO works correctly for VLAN devices when
underlying device is Realtek NIC with 8139too driver.
Network tracepoint shows as following:
<Begin:
tcpclient-5915 [000] 2114.246780: net_dev_queue: dev=eth1.44 skbaddr=f3051bc0 len=74
tcpclient-5915 [000] 2114.246790: net_dev_queue: dev=eth1 skbaddr=f3051bc0 len=74
tcpclient-5915 [000] 2114.246798: net_dev_xmit: dev=eth1 skbaddr=f3051bc0 len=78 rc=0
tcpclient-5915 [000] 2114.246799: net_dev_xmit: dev=eth1.44 skbaddr=f3051bc0 len=74 rc=0
<idle>-0 [000] 2114.246905: net_dev_queue: dev=eth1.44 skbaddr=f73cc480 len=66
<idle>-0 [000] 2114.246908: net_dev_queue: dev=eth1 skbaddr=f73cc480 len=66
<idle>-0 [000] 2114.246911: net_dev_xmit: dev=eth1 skbaddr=f73cc480 len=70 rc=0
<idle>-0 [000] 2114.246912: net_dev_xmit: dev=eth1.44 skbaddr=f73cc480 len=66 rc=0
tcpclient-5915 [000] 2114.247109: net_dev_queue: dev=eth1.44 skbaddr=f3051bc0 len=2962
tcpclient-5915 [000] 2114.247121: net_dev_queue: dev=eth1 skbaddr=f73cc380 len=1514
tcpclient-5915 [000] 2114.247130: net_dev_xmit: dev=eth1 skbaddr=f73cc380 len=1518 rc=0
tcpclient-5915 [000] 2114.247131: net_dev_xmit: dev=eth1.44 skbaddr=f73cc380 len=1514 rc=0
tcpclient-5915 [000] 2114.247132: net_dev_queue: dev=eth1 skbaddr=f73cc480 len=1514
tcpclient-5915 [000] 2114.247138: net_dev_xmit: dev=eth1 skbaddr=f73cc480 len=1518 rc=0
tcpclient-5915 [000] 2114.247139: net_dev_xmit: dev=eth1.44 skbaddr=f73cc480 len=1514 rc=0
end:>
But, test case requires following two patches:
1. Fix broken vlan GSO setting
[PATCH 1/2] net: vlan: enable GSO by default
http://patchwork.ozlabs.org/patch/101714/
2. Fix my 8139too NIC driver that does not initial vlan_features.
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -993,6 +993,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
* features
*/
dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
+ dev->vlan_features = dev->features;
--
Best Regards
-----
Shan Wei
^ permalink raw reply
* Re: [PATCH] [v3][net][bna] Fix call trace when interrupts are disabled while sleeping function kzalloc is called
From: David Miller @ 2011-07-02 0:50 UTC (permalink / raw)
To: rmody; +Cc: shyam.iyer.t, netdev, ddutt, huangj, shyam_iyer
In-Reply-To: <E5313AF6F2BFD14293E5FD0F94750F86A82D66F782@HQ1-EXCH01.corp.brocade.com>
From: Rasesh Mody <rmody@brocade.com>
Date: Tue, 28 Jun 2011 16:32:58 -0700
>>From: Shyam Iyer [mailto:shyam.iyer.t@gmail.com]
>>Sent: Tuesday, June 28, 2011 11:58 AM
>>
>>request_threaded irq will call kzalloc that can sleep. Initializing the
>>flags variable outside of spin_lock_irqsave/restore in
>>bnad_mbox_irq_alloc will avoid call traces like below.
...
> Patch looks fine.
>
> Acked-by: Rasesh Mody <rmody@brocade.com>
Applied, thanks
^ permalink raw reply
* Re: [PATCH] gianfar: code cleanups
From: David Miller @ 2011-07-02 0:46 UTC (permalink / raw)
To: sebastian.belden; +Cc: netdev, joe, sebastian.poehn
In-Reply-To: <1309510843.10177.10.camel@DENEC1DT0191>
From: "Sebastian Pöhn" <sebastian.belden@googlemail.com>
Date: Fri, 01 Jul 2011 11:00:43 +0200
> # moves if_vlan.h include from gianfar.c to gianfar.h
Please don't do this, keep the explicit includes as close
to the actual dependencies as possible. With your change
all of the other source files will load in and parse if_vlan.h
even though they have no need for it.
^ permalink raw reply
* Re: [net-2.6 PATCH 3/3] qlge:Version change to v1.00.00.29
From: David Miller @ 2011-07-02 0:36 UTC (permalink / raw)
To: ron.mercer; +Cc: netdev, jitendra.kalsaria, ameen.rahman
In-Reply-To: <1309464127-14797-3-git-send-email-ron.mercer@qlogic.com>
From: Ron Mercer <ron.mercer@qlogic.com>
Date: Thu, 30 Jun 2011 13:02:07 -0700
> From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
>
> Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
> Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Applied.
^ permalink raw reply
* Re: [net-2.6 PATCH 2/3] qlge: Fix printk priority so chip fatal errors are always reported.
From: David Miller @ 2011-07-02 0:36 UTC (permalink / raw)
To: ron.mercer; +Cc: netdev, jitendra.kalsaria, ameen.rahman
In-Reply-To: <1309464127-14797-2-git-send-email-ron.mercer@qlogic.com>
From: Ron Mercer <ron.mercer@qlogic.com>
Date: Thu, 30 Jun 2011 13:02:06 -0700
> From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
>
> Precedence of the printk should be at higher level so chip fatal
> errors are always reported.
>
> Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
> Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Applied.
^ permalink raw reply
* Re: [net-2.6 PATCH 1/3] qlge:Fix crash caused by mailbox execution on wedged chip.
From: David Miller @ 2011-07-02 0:36 UTC (permalink / raw)
To: ron.mercer; +Cc: netdev, jitendra.kalsaria, ameen.rahman
In-Reply-To: <1309464127-14797-1-git-send-email-ron.mercer@qlogic.com>
From: Ron Mercer <ron.mercer@qlogic.com>
Date: Thu, 30 Jun 2011 13:02:05 -0700
> From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
>
> When we are in a recover process from a chip fatal error,
> driver should skip over execution of mailbox commands during
> resetting chip.
>
> Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
> Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Applied.
^ permalink raw reply
* Re: [PATCH 3/3] xfrm4: Don't call icmp_send on local error
From: David Miller @ 2011-07-02 0:34 UTC (permalink / raw)
To: steffen.klassert; +Cc: herbert, netdev
In-Reply-To: <20110630092041.GD13201@secunet.com>
From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Thu, 30 Jun 2011 11:20:41 +0200
> Calling icmp_send() on a local message size error leads to
> an incorrect update of the path mtu. So use ip_local_error()
> instead to notify the socket about the error.
>
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Applied.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox