1. 24 7月, 2019 1 次提交
  2. 05 6月, 2019 1 次提交
  3. 22 1月, 2019 1 次提交
    • M
      can: dev: __can_get_echo_skb(): fix bogous check for non-existing skb by removing it · 7b12c818
      Manfred Schlaegl 提交于
      This patch revert commit 7da11ba5
      ("can: dev: __can_get_echo_skb(): print error message, if trying to echo non existing skb")
      
      After introduction of this change we encountered following new error
      message on various i.MX plattforms (flexcan):
      
      | flexcan 53fc8000.can can0: __can_get_echo_skb: BUG! Trying to echo non
      | existing skb: can_priv::echo_skb[0]
      
      The introduction of the message was a mistake because
      priv->echo_skb[idx] = NULL is a perfectly valid in following case: If
      CAN_RAW_LOOPBACK is disabled (setsockopt) in applications, the pkt_type
      of the tx skb's given to can_put_echo_skb is set to PACKET_LOOPBACK. In
      this case can_put_echo_skb will not set priv->echo_skb[idx]. It is
      therefore kept NULL.
      
      As additional argument for revert: The order of check and usage of idx
      was changed. idx is used to access an array element before checking it's
      boundaries.
      Signed-off-by: NManfred Schlaegl <manfred.schlaegl@ginzinger.com>
      Fixes: 7da11ba5 ("can: dev: __can_get_echo_skb(): print error message, if trying to echo non existing skb")
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      7b12c818
  4. 10 11月, 2018 4 次提交
  5. 27 7月, 2018 2 次提交
    • Z
      can: dev: enable multi-queue for SocketCAN devices · 03870907
      Zhu Yi 提交于
      The existing SocketCAN implementation provides alloc_candev() to
      allocate a CAN device using a single Tx and Rx queue. This can lead to
      priority inversion in case the single Tx queue is already full with low
      priority messages and a high priority message needs to be sent while the
      bus is fully loaded with medium priority messages.
      
      This problem can be solved by using the existing multi-queue support of
      the network subsytem. The commit makes it possible to use multi-queue in
      the CAN subsystem in the same way it is used in the Ethernet subsystem
      by adding an alloc_candev_mqs() call and accompanying macros. With this
      support a CAN device can use multi-queue qdisc (e.g. mqprio) to avoid
      the aforementioned priority inversion.
      
      The exisiting functionality of alloc_candev() is the same as before.
      
      CAN devices need to have prioritized multiple hardware queues or are
      able to abort waiting for arbitration to make sensible use of
      multi-queues.
      Signed-off-by: NZhu Yi <yi.zhu5@cn.bosch.com>
      Signed-off-by: NMark Jonas <mark.jonas@de.bosch.com>
      Reviewed-by: NHeiko Schocher <hs@denx.de>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      03870907
    • Y
      can: dev: use skb_put_zero to simplfy code · 8551e71d
      YueHaibing 提交于
      use helper skb_put_zero to replace the pattern of skb_put() && memset()
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      8551e71d
  6. 08 5月, 2018 1 次提交
    • J
      can: dev: increase bus-off message severity · 71c23a82
      Jakob Unterwurzacher 提交于
      bus-off is usually caused by hardware malfunction or configuration error
      (baud rate mismatch) and causes a complete loss of communication.
      
      Increase the "bus-off" message's severity from netdev_dbg() to
      netdev_info() to make it visible to the user.
      
      A can interface going into bus-off is similar in severity to ethernet's
      "Link is Down" message, which is also printed at info level.
      
      It is debatable whether the the "restarted" message should also be
      changed to netdev_info() to make the interface state changes
      comprehensible from the kernel log. I have chosen to keep the
      "restarted" message at dbg for now as the "bus-off" message should be
      enough for the user to notice and investigate the problem.
      Signed-off-by: NJakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>
      Cc: linux-can@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      71c23a82
  7. 26 1月, 2018 1 次提交
  8. 16 1月, 2018 1 次提交
  9. 27 6月, 2017 3 次提交
  10. 16 6月, 2017 1 次提交
    • J
      networking: make skb_put & friends return void pointers · 4df864c1
      Johannes Berg 提交于
      It seems like a historic accident that these return unsigned char *,
      and in many places that means casts are required, more often than not.
      
      Make these functions (skb_put, __skb_put and pskb_put) return void *
      and remove all the casts across the tree, adding a (u8 *) cast only
      where the unsigned char pointer was used directly, all done with the
      following spatch:
      
          @@
          expression SKB, LEN;
          typedef u8;
          identifier fn = { skb_put, __skb_put };
          @@
          - *(fn(SKB, LEN))
          + *(u8 *)fn(SKB, LEN)
      
          @@
          expression E, SKB, LEN;
          identifier fn = { skb_put, __skb_put };
          type T;
          @@
          - E = ((T *)(fn(SKB, LEN)))
          + E = fn(SKB, LEN)
      
      which actually doesn't cover pskb_put since there are only three
      users overall.
      
      A handful of stragglers were converted manually, notably a macro in
      drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many
      instances in net/bluetooth/hci_sock.c. In the former file, I also
      had to fix one whitespace problem spatch introduced.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4df864c1
  11. 09 6月, 2017 1 次提交
  12. 24 1月, 2017 3 次提交
    • M
      can: dev: add CAN interface API for fixed bitrates · 431af779
      Marc Kleine-Budde 提交于
      Some CAN interfaces only support fixed fixed bitrates. This patch adds a
      netlink interface to get the list of the CAN interface's fixed bitrates and
      data bitrates.
      
      Inside the driver arrays of supported data- bitrate values are defined.
      
      const u32 drvname_bitrate[] = { 20000, 50000, 100000 };
      const u32 drvname_data_bitrate[] = { 200000, 500000, 1000000 };
      
      struct drvname_priv *priv;
      priv = netdev_priv(dev);
      
      priv->bitrate_const = drvname_bitrate;
      priv->bitrate_const_cnt = ARRAY_SIZE(drvname_bitrate);
      priv->data_bitrate_const = drvname_data_bitrate;
      priv->data_bitrate_const_cnt = ARRAY_SIZE(drvname_data_bitrate);
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      431af779
    • M
      can: dev: can_changelink: allow to set bitrate on devices not providing {data_,}bittiming_const · c3606d43
      Marc Kleine-Budde 提交于
      Until commit
      
          08da7da4 can: provide a separate bittiming_const parameter to
                       bittiming functions
      
      it was possible to have devices not providing bittiming_const. This can
      be used for hardware that only support pre-defined fixed bitrates.
      Although no mainline driver is using this feature so far.
      
      This patch re-introduces this feature for the bitrate and the data
      bitrate (of CANFD controllers). The driver can specify the
      {data_,}bittiming_const (if the bittiming parameters should be
      calculated from the bittiming_const) as before or no
      {data_,}bittiming_const but implement the do_set_{data,}bittiming
      callback.
      Acked-by: NOliver Hartkopp <socketcan@hartkopp.net>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      c3606d43
    • O
      can: dev: add CAN interface termination API · 12a6075c
      Oliver Hartkopp 提交于
      This patch adds a netlink interface to configure the CAN bus termination of
      CAN interfaces.
      
      Inside the driver an array of supported termination values is defined:
      
      const u16 drvname_termination[] = { 60, 120, CAN_TERMINATION_DISABLED };
      
      struct drvname_priv *priv;
      priv = netdev_priv(dev);
      
      priv->termination_const = drvname_termination;
      priv->termination_const_cnt = ARRAY_SIZE(drvname_termination);
      priv->termination = CAN_TERMINATION_DISABLED;
      
      And the funtion to set the value has to be defined:
      
      priv->do_set_termination = drvname_set_termination;
      Signed-off-by: NOliver Hartkopp <socketcan@hartkopp.net>
      Reviewed-by: NRamesh Shanmugasundaram <Ramesh.shanmugasundaram@bp.renesas.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      12a6075c
  13. 22 9月, 2016 1 次提交
  14. 23 6月, 2016 2 次提交
  15. 17 6月, 2016 1 次提交
    • M
      can: dev: can-calc-bit-timing(): better sample point calculation · 7da29f97
      Marc Kleine-Budde 提交于
      This patch optimizes the calculation of the sample point. To understand what it
      does have a look at the original implementation.
      
      If there is a combination of timing parameters where both the bitrate and
      sample point error are 0 the current implementation will find it.
      
      However if the reference clock doesn't allow an optimal bitrate (this means the
      bitrate error is always != 0) there might be several timing parameter
      combinations having the same bitrate error. The original implementation will
      allways choose the one with the highest brp. The actual sample point error
      isn't taken into account.
      
      This patch changes the algorithm to minimize the sample point error, too. Now a
      brp/tseg combination is accepted as better if one of these condition are
      fulfilled:
      1) the bit rate error must be smaller, or
      2) the bit rate error must be equal and
         the sample point error must be equal or smaller
      
      If a smaller bit rate error is found the sample point error is reset. This
      ensures that we first optimize for small bit rate error and then for small
      sample point errors.
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      7da29f97
  16. 09 5月, 2016 1 次提交
    • O
      can: fix handling of unmodifiable configuration options · bb208f14
      Oliver Hartkopp 提交于
      As described in 'can: m_can: tag current CAN FD controllers as non-ISO'
      (6cfda7fb) it is possible to define fixed configuration options by
      setting the according bit in 'ctrlmode' and clear it in 'ctrlmode_supported'.
      This leads to the incovenience that the fixed configuration bits can not be
      passed by netlink even when they have the correct values (e.g. non-ISO, FD).
      
      This patch fixes that issue and not only allows fixed set bit values to be set
      again but now requires(!) to provide these fixed values at configuration time.
      A valid CAN FD configuration consists of a nominal/arbitration bittiming, a
      data bittiming and a control mode with CAN_CTRLMODE_FD set - which is now
      enforced by a new can_validate() function. This fix additionally removed the
      inconsistency that was prohibiting the support of 'CANFD-only' controller
      drivers, like the RCar CAN FD.
      
      For this reason a new helper can_set_static_ctrlmode() has been introduced to
      provide a proper interface to handle static enabled CAN controller options.
      Reported-by: NRamesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
      Signed-off-by: NOliver Hartkopp <socketcan@hartkopp.net>
      Reviewed-by: NRamesh Shanmugasundaram  <ramesh.shanmugasundaram@bp.renesas.com>
      Cc: <stable@vger.kernel.org> # >= 3.18
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      bb208f14
  17. 30 10月, 2015 1 次提交
  18. 13 7月, 2015 1 次提交
    • O
      can: replace timestamp as unique skb attribute · d3b58c47
      Oliver Hartkopp 提交于
      Commit 514ac99c "can: fix multiple delivery of a single CAN frame for
      overlapping CAN filters" requires the skb->tstamp to be set to check for
      identical CAN skbs.
      
      Without timestamping to be required by user space applications this timestamp
      was not generated which lead to commit 36c01245 "can: fix loss of CAN frames
      in raw_rcv" - which forces the timestamp to be set in all CAN related skbuffs
      by introducing several __net_timestamp() calls.
      
      This forces e.g. out of tree drivers which are not using alloc_can{,fd}_skb()
      to add __net_timestamp() after skbuff creation to prevent the frame loss fixed
      in mainline Linux.
      
      This patch removes the timestamp dependency and uses an atomic counter to
      create an unique identifier together with the skbuff pointer.
      
      Btw: the new skbcnt element introduced in struct can_skb_priv has to be
      initialized with zero in out-of-tree drivers which are not using
      alloc_can{,fd}_skb() too.
      Signed-off-by: NOliver Hartkopp <socketcan@hartkopp.net>
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      d3b58c47
  19. 22 6月, 2015 1 次提交
  20. 09 3月, 2015 1 次提交
  21. 22 1月, 2015 1 次提交
  22. 20 1月, 2015 1 次提交
  23. 15 1月, 2015 1 次提交
    • O
      can: dev: fix crtlmode_supported check · 9b1087aa
      Oliver Hartkopp 提交于
      When changing flags in the CAN drivers ctrlmode the provided new content has to
      be checked whether the bits are allowed to be changed. The bits that are to be
      changed are given as a bitfield in cm->mask. Therefore checking against
      cm->flags is wrong as the content can hold any kind of values.
      
      The iproute2 tool sets the bits in cm->mask and cm->flags depending on the
      detected command line options. To be robust against bogus user space
      applications additionally sanitize the provided flags with the provided mask.
      
      Cc: Wolfgang Grandegger <wg@grandegger.com>
      Signed-off-by: NOliver Hartkopp <socketcan@hartkopp.net>
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      9b1087aa
  24. 08 12月, 2014 1 次提交
  25. 18 11月, 2014 2 次提交
    • R
      can: dev: fix typo CIA -> CiA, CAN in Automation · 67b5909e
      Roman Fietze 提交于
      This patch fixes a typo in CAN's dev.c:
      
          CIA -> CiA
      
      which stands for CAN in Automation.
      Signed-off-by: NRoman Fietze <roman.fietze@telemotive.de>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      67b5909e
    • T
      can: dev: avoid calling kfree_skb() from interrupt context · 5247a589
      Thomas Körper 提交于
      ikfree_skb() is Called in can_free_echo_skb(), which might be called from (TX
      Error) interrupt, which triggers the folloing warning:
      
      [ 1153.360705] ------------[ cut here ]------------
      [ 1153.360715] WARNING: CPU: 0 PID: 31 at net/core/skbuff.c:563 skb_release_head_state+0xb9/0xd0()
      [ 1153.360772] Call Trace:
      [ 1153.360778]  [<c167906f>] dump_stack+0x41/0x52
      [ 1153.360782]  [<c105bb7e>] warn_slowpath_common+0x7e/0xa0
      [ 1153.360784]  [<c158b909>] ? skb_release_head_state+0xb9/0xd0
      [ 1153.360786]  [<c158b909>] ? skb_release_head_state+0xb9/0xd0
      [ 1153.360788]  [<c105bc42>] warn_slowpath_null+0x22/0x30
      [ 1153.360791]  [<c158b909>] skb_release_head_state+0xb9/0xd0
      [ 1153.360793]  [<c158be90>] skb_release_all+0x10/0x30
      [ 1153.360795]  [<c158bf06>] kfree_skb+0x36/0x80
      [ 1153.360799]  [<f8486938>] ? can_free_echo_skb+0x28/0x40 [can_dev]
      [ 1153.360802]  [<f8486938>] can_free_echo_skb+0x28/0x40 [can_dev]
      [ 1153.360805]  [<f849a12c>] esd_pci402_interrupt+0x34c/0x57a [esd402]
      [ 1153.360809]  [<c10a75b5>] handle_irq_event_percpu+0x35/0x180
      [ 1153.360811]  [<c10a7623>] ? handle_irq_event_percpu+0xa3/0x180
      [ 1153.360813]  [<c10a7731>] handle_irq_event+0x31/0x50
      [ 1153.360816]  [<c10a9c7f>] handle_fasteoi_irq+0x6f/0x120
      [ 1153.360818]  [<c10a9c10>] ? handle_edge_irq+0x110/0x110
      [ 1153.360822]  [<c1011b61>] handle_irq+0x71/0x90
      [ 1153.360823]  <IRQ>  [<c168152c>] do_IRQ+0x3c/0xd0
      [ 1153.360829]  [<c1680b6c>] common_interrupt+0x2c/0x34
      [ 1153.360834]  [<c107d277>] ? finish_task_switch+0x47/0xf0
      [ 1153.360836]  [<c167c27b>] __schedule+0x35b/0x7e0
      [ 1153.360839]  [<c10a5334>] ? console_unlock+0x2c4/0x4d0
      [ 1153.360842]  [<c13df500>] ? n_tty_receive_buf_common+0x890/0x890
      [ 1153.360845]  [<c10707b6>] ? process_one_work+0x196/0x370
      [ 1153.360847]  [<c167c723>] schedule+0x23/0x60
      [ 1153.360849]  [<c1070de1>] worker_thread+0x161/0x460
      [ 1153.360852]  [<c1090fcf>] ? __wake_up_locked+0x1f/0x30
      [ 1153.360854]  [<c1070c80>] ? rescuer_thread+0x2f0/0x2f0
      [ 1153.360856]  [<c1074f01>] kthread+0xa1/0xc0
      [ 1153.360859]  [<c1680401>] ret_from_kernel_thread+0x21/0x30
      [ 1153.360861]  [<c1074e60>] ? kthread_create_on_node+0x110/0x110
      [ 1153.360863] ---[ end trace 5ff83639cbb74b35 ]---
      
      This patch replaces the kfree_skb() by dev_kfree_skb_any().
      Signed-off-by: NThomas Körper <thomas.koerper@esd.eu>
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      5247a589
  26. 18 8月, 2014 1 次提交
  27. 16 7月, 2014 1 次提交
    • T
      net: set name_assign_type in alloc_netdev() · c835a677
      Tom Gundersen 提交于
      Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
      all users to pass NET_NAME_UNKNOWN.
      
      Coccinelle patch:
      
      @@
      expression sizeof_priv, name, setup, txqs, rxqs, count;
      @@
      
      (
      -alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
      +alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
      |
      -alloc_netdev_mq(sizeof_priv, name, setup, count)
      +alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
      |
      -alloc_netdev(sizeof_priv, name, setup)
      +alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
      )
      
      v9: move comments here from the wrong commit
      Signed-off-by: NTom Gundersen <teg@jklm.no>
      Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c835a677
  28. 25 4月, 2014 1 次提交
  29. 07 3月, 2014 2 次提交
新手
引导
客服 返回
顶部